Skip to main content

High-level Python library to work with gravitational-wave frame (GWF) files, based on framecpp

Project description

gwframe

High-level Python library to work with gravitational-wave frame (GWF) files, based on framecpp

ci license documentation pypi version


Resources

Installation

With pip:

pip install gwframe

With conda:

conda install -c conda-forge gwframe

Features

  • Multi-frame writing - Write multiple frames to a single file
  • Multi-channel support - Read all channels or specific lists with a single call
  • Self-contained wheels - No external dependencies required for pip installation

Quickstart

Reading frames

import gwframe

# Read single channel
data = gwframe.read('data.gwf', 'L1:GWOSC-16KHZ_R1_STRAIN')
print(f"Read {len(data.array)} samples at {data.sample_rate} Hz")
print(f"Time range: {data.start} to {data.start + data.duration}")

# Read all channels
channels = gwframe.read('data.gwf', channels=None)
for name, timeseries in channels.items():
    print(f"{name}: {len(timeseries.array)} samples")

# Time-based slicing (automatically stitches multiple frames)
data = gwframe.read('multi_frame.gwf', 'L1:STRAIN',
                    start=1234567890.0, end=1234567900.0)

Writing single frames

import gwframe
import numpy as np

data = np.random.randn(16384)
gwframe.write('output.gwf', data, start=1234567890.0,
              sample_rate=16384, name='L1:TEST')

Writing multiple frames

import gwframe
import numpy as np

# Write multiple frames to a single file
with gwframe.FrameWriter('multi_frame.gwf') as writer:
    for i in range(20):
        data = np.random.randn(16384)
        writer.write(data, start=1234567890.0 + i,
                     sample_rate=16384, name='L1:TEST')

Inspecting frames

import gwframe

# Get frame information
info = gwframe.get_info('data.gwf')
print(f"Number of frames: {info.num_frames}")
for frame in info.frames:
    print(f"Frame {frame.index}: {frame.name} at GPS {frame.start}, duration {frame.duration}s")

# List all channels
channels = gwframe.get_channels('data.gwf')
num_channels = len(channels)
for channel in channels:
    print(channel)

Advanced: Full control with Frame objects

import gwframe
import numpy as np

# Create frame with multiple channels and metadata
frame = gwframe.Frame(
    start=1234567890.0,
    duration=1.0,
    name='L1',
    run=1
)

# Add channels
strain = np.random.randn(16384)
frame.add_channel('L1:STRAIN', strain,
                  sample_rate=16384,
                  unit='strain',
                  channel_type='proc')

aux = np.random.randn(1024).astype(np.float32)
frame.add_channel('L1:AUX', aux,
                  sample_rate=1024,
                  unit='counts',
                  channel_type='adc')

# Add metadata
frame.add_history('gwframe', 'Created with gwframe')

# Write with custom compression
frame.write('output.gwf', compression=gwframe.Compression.GZIP)

CLI Tools

gwframe includes a command-line interface for common frame manipulation tasks:

# Rename channels
gwframe rename input.gwf -o output.gwf -m "L1:OLD=>L1:NEW"

# Combine channels from multiple files
gwframe combine file1.gwf file2.gwf -o output/

# Keep only specific channels
gwframe select input.gwf -o output.gwf -c L1:STRAIN

# Remove unwanted channels
gwframe drop input.gwf -o output.gwf -c L1:UNWANTED

# Change frame duration
gwframe resize input.gwf -o output/ -d 4.0

# Replace NaN or sentinel values
gwframe impute input.gwf -o output.gwf --fill-value 0.0

# Update channel data from another file
gwframe replace base.gwf --update new.gwf -o output/ -c L1:STRAIN

# Change compression settings
gwframe recompress input.gwf -o output.gwf -c GZIP -l 9

All commands support batch processing with directories and glob patterns. See the CLI documentation for detailed usage and examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gwframe-0.2.0.tar.gz (6.1 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gwframe-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl (18.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

gwframe-0.2.0-cp313-cp313-manylinux_2_34_aarch64.whl (18.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

gwframe-0.2.0-cp313-cp313-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

gwframe-0.2.0-cp313-cp313-macosx_13_0_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 13.0+ x86-64

gwframe-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl (18.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

gwframe-0.2.0-cp312-cp312-manylinux_2_34_aarch64.whl (18.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

gwframe-0.2.0-cp312-cp312-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

gwframe-0.2.0-cp312-cp312-macosx_13_0_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 13.0+ x86-64

gwframe-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl (18.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

gwframe-0.2.0-cp311-cp311-manylinux_2_34_aarch64.whl (18.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

gwframe-0.2.0-cp311-cp311-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

gwframe-0.2.0-cp311-cp311-macosx_13_0_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 13.0+ x86-64

gwframe-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl (18.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

gwframe-0.2.0-cp310-cp310-manylinux_2_34_aarch64.whl (18.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ ARM64

gwframe-0.2.0-cp310-cp310-macosx_15_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

gwframe-0.2.0-cp310-cp310-macosx_13_0_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 13.0+ x86-64

File details

Details for the file gwframe-0.2.0.tar.gz.

File metadata

  • Download URL: gwframe-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for gwframe-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b3974101ca34de2dfed4f00d1b586f93900c8b85d92990d8994b75848ea761dd
MD5 b17fc79a1ee255fc5948f74a7f66a762
BLAKE2b-256 1d45edf1b780ce2c2cbe399f4d494b53eca1f546574f645757b67fde814fb4c9

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6ccf99307080571f73c590ede60bed94837552a2f5929de80a60e2815c5cdab9
MD5 88ae8c45b56089bcd81550b0af7cf5de
BLAKE2b-256 9f422615b9a5716f6207d439a630b031eeb0ebc09a72daf6e8cbd9ed43726804

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 7c1fef878c550765dab66ad4abe9c0c4ab7cccf4aaacb5a08d8e458cd5ab3fc7
MD5 d09532bf7e83b71f86047929cade7c0f
BLAKE2b-256 76a09094d2fd1fc7ebedead0de561875a8bca6dbeb0f2ea5aa167f75ad621f73

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 53cbc35d8bc248fa25ddb4e47f97bdd6f426a217bd0ef83a282739e5dd5ab805
MD5 7793e5df542ead880e9587fedbb07f06
BLAKE2b-256 6928231071dc0199f2ee59a64244457e1e16176b8558cc04968d336b927f40a2

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp313-cp313-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 ae1b487ba2b8682cbce74226e6bb8ec77c5a439aeb0b847ae441d4f70d050a1d
MD5 0966d5bba3831ac8e9f487892ca8b9b3
BLAKE2b-256 c901139f91c49c532079db71f113708d40b2e0735acaead20a7f67597ec60684

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2ce5857fad6c5b82828f94f42f0e8609f5aadf991b55e284f9d104f5eba15a63
MD5 65cc7bcc0fb98f17b9b4e3824e742036
BLAKE2b-256 c7fb417bc9c33bef004ab3bf70d2b19ecd1094e1e2c4a1d4e686048a89956246

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 5448f8ae16a6d0039f739ea426c38e31f1f9d95f1a6310d11b55c390d83cc275
MD5 c8b9f11c016f0762410476c5d62e9a01
BLAKE2b-256 1358392433d9d2cde9dcc5821015a911a5732942c49e67893999f523a5d53e8e

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 5ff92226cfe59717fef002b964b0f841187923cfcdd95f093958dafbf318c8ed
MD5 bc9ce06474350e446dfb933496785f38
BLAKE2b-256 2e6bcfd5b6bebaf73da1a7f84560c4bfdcfc20934e87a8d0f3b3682a397fa94b

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 bcf1ae0fa02166cc6b855bfb665370ef8cdfd88967b67d236cf2c765d8ef9f81
MD5 ada01da99bed90960e2d6596110f1d45
BLAKE2b-256 77f66263c4c19321dda3515f9a517bfda931e2847c112cccd3d9944f1176d622

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4f714f429243a078e27f3f30a4ae28073dcf1be639fe249cd6946de4c5214937
MD5 7957b73a552d69acfddb19681ceb66b2
BLAKE2b-256 62817d8ff358d4d8f4fce7ca58f1622a53977a5cb25d15e43a0d1878a677422a

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp311-cp311-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 9984a200425f6816823827c48936710ba703243407d02d058efeb27d606ff4d7
MD5 f7d9ce07dde84bf57baa3264b78a52cc
BLAKE2b-256 a2ec1ff18311ef04d0883f938b9cbc0da68b05aa2693a698405867086e343ec8

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 4f6ddc24fac471df900e03859cb08d4d5c7c74fb25bc71791a994dbe93d09bcc
MD5 c9304b5c0c26798bdecc05c8d633a9df
BLAKE2b-256 21ba24559166a136a4cc77e746ff2a4cf5ce50b56c71a682226d4b7d2d00a94b

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 bd30dc9488c3d8ca8fec2431bf1208093b72145973738ee26f539406e7da2467
MD5 cee6728f4b7d340448ddcdcd8f4c929c
BLAKE2b-256 16f9b20816309a3baff0f6f2fdca1a8b490d227a0bf29daa0705f28c2fb8872d

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e546abfa964c391ae3bec318f536185128cd5d22bbe8a0deab6e1859b6e6e32d
MD5 52aa29d9d22dc4145d28acf275f13734
BLAKE2b-256 73bf1dbe47e7da454d50ae2a969ac770fcb68e17945a3428a620e91795235c44

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp310-cp310-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 6fbd33363e0e6a89fcb4788ce2c456bd90d85c0e9f7ce308b46f53aaced473f5
MD5 12e16ba088bb4b09630dc30b61a360ba
BLAKE2b-256 23c62c0d55460687f1128ea6b55a57c5b5b39e3215dd56f6f509d78c9bf642f5

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c32bf2d3140359055c011609ce41d0eb3fa70a7f37b709701435f625c4545692
MD5 bc96a6e16dbf9bd1fe8cc2648e05263f
BLAKE2b-256 1ead51dd330b26bab09b7feb1feed8f2301f9ae3e9e348f7cc2f5a3bb21c988f

See more details on using hashes here.

File details

Details for the file gwframe-0.2.0-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.2.0-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 af226f06bf3567b1a9cfb67318dd0143d43f24e7bead6bcf028306258d18bf11
MD5 ce85675e1e5d2d7b061bf526b7606f9a
BLAKE2b-256 a76f00f346f04c13e9075f98264ea486ef7c5cd6a77ee9802c03aad8b6e2335e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page