Skip to main content

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

Pre-built wheels are available for:

Platform Architecture Minimum Version
Linux x86_64, aarch64 glibc 2.34 (e.g., Debian 12, Ubuntu 21.10, Fedora 35, RHEL 9)
macOS x86_64 macOS 13 (Ventura)
macOS ARM64 macOS 15 (Sequoia)

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
  • Masked array support - Detect and propagate invalid-data flags as NumPy masked arrays
  • 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')

# Or without a context manager
writer = gwframe.FrameWriter('multi_frame.gwf')
writer.open()
for i in range(20):
    data = np.random.randn(16384)
    writer.write(data, start=1234567890.0 + i,
                 sample_rate=16384, name='L1:TEST')
writer.close()

Inspecting frames

From the command line:

gwframe inspect data.gwf            # file summary
gwframe inspect -v data.gwf         # + channel listing
gwframe inspect -vvv data.gwf       # + sample rates, dtypes, units, validity
gwframe inspect -vvvv data.gwf      # + invalid-channel report
gwframe inspect -vvvvv data.gwf     # + data preview (reads all data)

Or from Python:

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')
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)

Handling invalid / masked data

ADC channels in GWF files can carry a data-valid flag indicating the entire channel is suspect. gwframe surfaces this through NumPy masked arrays:

import gwframe

# By default, reading a channel flagged invalid raises an error
try:
    data = gwframe.read('data.gwf', 'H1:ADC-CHANNEL')
except gwframe.InvalidDataError as e:
    print(e)  # suggests allow_invalid=True

# Allow invalid data — returns a masked array
data = gwframe.read('data.gwf', 'H1:ADC-CHANNEL', allow_invalid=True)
if isinstance(data.array, np.ma.MaskedArray):
    print(f"{data.array.count()} valid samples out of {len(data.array)}")

# Write a masked array — ADC channels preserve the flag,
# proc/sim channels warn that the mask is discarded
masked = np.ma.MaskedArray(values, mask=quality_mask)
frame = gwframe.Frame(start=1234567890.0, duration=1.0, name='H1')
frame.add_channel('H1:ADC-CHANNEL', masked,
                  sample_rate=16384, channel_type='adc')

# Control behavior when mask fidelity is lost
frame.add_channel('H1:PROC-CHANNEL', masked,
                  sample_rate=16384, channel_type='proc',
                  on_mask_loss='ignore')  # or 'warn' (default), 'raise'

CLI Tools

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

# Inspect a frame file (add -v, -vv, -vvv for more detail)
gwframe inspect data.gwf

# 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

# Check two files (or directories) for consistency of data and metadata
gwframe validate a.gwf b.gwf
gwframe validate dir1/ dir2/ --common          # only compare what both sides have
gwframe validate a.gwf b.gwf --metadata-only   # skip sample data (faster)
gwframe validate a.gwf b.gwf --atol 1e-9       # tolerate small float differences

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

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.4.0.tar.gz (4.2 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.4.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.4.0-cp313-cp313-manylinux_2_34_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

gwframe-0.4.0-cp313-cp313-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

gwframe-0.4.0-cp313-cp313-macosx_13_0_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 13.0+ x86-64

gwframe-0.4.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.4.0-cp312-cp312-manylinux_2_34_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

gwframe-0.4.0-cp312-cp312-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

gwframe-0.4.0-cp312-cp312-macosx_13_0_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 13.0+ x86-64

gwframe-0.4.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.4.0-cp311-cp311-manylinux_2_34_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

gwframe-0.4.0-cp311-cp311-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

gwframe-0.4.0-cp311-cp311-macosx_13_0_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11macOS 13.0+ x86-64

gwframe-0.4.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.4.0-cp310-cp310-manylinux_2_34_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ ARM64

gwframe-0.4.0-cp310-cp310-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

gwframe-0.4.0-cp310-cp310-macosx_13_0_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 13.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for gwframe-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c457367dadf6c6c61ededd3da35a2d8987e9b69a5de8f05a66c8803e0ff9866f
MD5 a714cfb10ca688b48206d8b66e3401c2
BLAKE2b-256 82e92a11b10fd501a98cf0794247992f1fe573f80b58462b85a2b31f20f32daf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1a577efa77ad1ff7a351092f8774a1d3eb5544037a1ca7cce4c6b25a976f364c
MD5 399a8050765bb12f5f4363529167eae5
BLAKE2b-256 b319d729537d6db863c7481edc6e3383828a093435c3f77b1db1dc84146cd7d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 dbc020cbc4ee59cafb5afb81c1056ff1647003703936d0e665e83d7f6d2f5e57
MD5 3bd7709c456b6d1734b4ec6fb4eae100
BLAKE2b-256 e996c9e8aa35e895fc03ffac1e86a364cde72c8ecefef7d8f339cc584c86c95f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 79aef23857aaba71b4f5c9fd38a0c94cfcd8789e5ceacd4cad48e959cd4f7550
MD5 6e612193566be0e4e3763b5a0fc81ff2
BLAKE2b-256 84e8e320954468d03d5f5fbeab895895a43398ba30cdb9689bc0ebe9217b2192

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 35772c6ee16a66d6b8e5710fa204e499753ca8b01d667170d7c2641d10fd6780
MD5 2047bd6fcdb0569acf7d54f2cfb6cfcb
BLAKE2b-256 a24ec1ff5e2a2bae89150d4a32005e0b2c97ebc4caf7e2de0d792893b5a55c84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0e614b07e65d5bb7f6849131c1dfd3903c42e5f1930b2c972e0672830f50bc76
MD5 ef5afb03e6b17b9086293b497df070c6
BLAKE2b-256 dc5782dae9dac45f07408aba09a42feb03606da7408ec8e1dd09463765ba27a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 50aa3e72df76aa7981426d4d3c756cbea9b26e2bb1b94b72e287d500e270df8a
MD5 d5ccfca4c203bff99671ca186f5eedd5
BLAKE2b-256 f26eca8f3cbf97ae225e1e5ff9850006e5c5964946b4e9312bd3a8f058ca5d87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2058472c709932291283e8e9480589500617010801e70dc3a195b636c025e09c
MD5 5a93ccd18bd4b0dce0f34f8e537c0003
BLAKE2b-256 da5fe96cb067b20be14e7a9720c4ae6e51291cf87486cd53b14566b1e12a3579

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 9546ca273954c0d766678b49768e377cf2a625857db775a365456e79de04cfb5
MD5 994e3f86cd9484395f72d680c6be2c94
BLAKE2b-256 0f9152d794e1d630f93e354de03555b76d0c84307734f7aba40a3fc5c1db5635

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e16914b71161b0cf5b3d9fadffabcc8eac33b432894f8d5d0bc5d0e0e5d801d5
MD5 720c2617cffdc34253c629dec1107eac
BLAKE2b-256 fd968a53b864b07f17dac92a5a19349a338ef9cb103f4e7d4729045f5de73ce3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 670c3134ec6ae47f0ae9cd0f31ce70c8e1d310945a93766bd2575d0cc7b7c5e4
MD5 3a2d76c9602609d2473aeb76b270e031
BLAKE2b-256 584bd3bdf9385eca7245b5a981e09f8f316bb39c8417cf46a9607e671ed31fd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8d190d7e88aaf8e5d7136d393b96fa6b1b7a2223d0e076707310a8b4bf353b2b
MD5 4209d0674d5b64c40cc894e42039cef7
BLAKE2b-256 ef1fd46b1c70e5b593e7a5cdfe597460b595517cec6c4f05911f983ce906f4c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 1fce2dbf778d9d1f32cda749de77d2421106472df25439795d623337c33fd739
MD5 214db33e7a42df6206a11497057d29a9
BLAKE2b-256 96b46c9f7381ee8ab73f926aba4c337da1af893c4907b17d7860c935c676f13f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 da877feba7a44635601860eef2b025d2da30de38b91136c58556d9c8c968b49f
MD5 bbb318d28fb13dab371689375738312a
BLAKE2b-256 bdc926f6af856cef8abbea36cde3b5d594cf08870bb67a01fb82200438d227af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 456f5ad5bd549fb6dca041d4950e38ae353de3128d10ae53c86403035bfefacd
MD5 2eb99c55acd82b36ec05caed96390d44
BLAKE2b-256 658161f3ec5daa89fac11584dda0c2152011bbd5d490d41278c6580de61c04e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 969577640a8d74c3cead99e3fed5780901fc604c1adae61d6acb1fa88d72b0e3
MD5 08a90d71a731140569466f909f3c497d
BLAKE2b-256 54e0d7de115e1fdf3311ace0f17072693ac8c9d7dff94b19c5a86b9546e9cf85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.0-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 6c8b525047f19cac1e22658abf56f2adbf30a094d73359d58b5f9ebd2b89e252
MD5 1bb205fdd66ba9f2221958e1a3d4906f
BLAKE2b-256 1d29cff0f6dd58f972b122af9966e99b86f33551b8ab6971e676f3b7cdd07936

See more details on using hashes here.

Release history Release notifications | RSS feed

0.7.0

25 files

0.6.0

25 files

0.5.0

25 files

0.4.4

25 files

0.4.3

25 files

0.4.2

21 files

0.4.1

17 files

This release

0.4.0 This release

17 files

0.3.2

17 files

0.3.1

17 files

0.3.0

17 files

0.2.2

17 files

0.2.1

17 files

0.2.0

17 files

0.1.2

17 files

0.1.1

17 files

0.1.0

11 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page