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

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

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.3.2.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.3.2-cp313-cp313-manylinux_2_34_x86_64.whl (18.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

gwframe-0.3.2-cp313-cp313-manylinux_2_34_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.13macOS 13.0+ x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

gwframe-0.3.2-cp312-cp312-manylinux_2_34_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.12macOS 13.0+ x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

gwframe-0.3.2-cp311-cp311-manylinux_2_34_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.11macOS 13.0+ x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

gwframe-0.3.2-cp310-cp310-manylinux_2_34_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.10macOS 15.0+ ARM64

gwframe-0.3.2-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.3.2.tar.gz.

File metadata

  • Download URL: gwframe-0.3.2.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1

File hashes

Hashes for gwframe-0.3.2.tar.gz
Algorithm Hash digest
SHA256 86f89414c9e7e46f5a4ff277a4fcf83bca2c816a6e66b8602dd51e06f9d41dc2
MD5 c899675e1d6d8ba9f6fe4de4faebe202
BLAKE2b-256 9cec22cb6888ec146dc9d9828026496a25d89fe4b889dcb7a131f4cff92dddf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 20b31ba732e10d6642fbe500f09c2b4b94ae84b2fd2d87c080bdaa31d7a9bb41
MD5 2bc265828c50417545b595863cc79318
BLAKE2b-256 21b7a38c71258c8c4cbedb6469c41af8494003801f423a84d0d3506a7657bb94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 3e7b574bad4adbc42e69cd3c6380b137b9313e7b5690d3d12c2906e0bb445303
MD5 5b49967186a9f58c8f309b1503ac34da
BLAKE2b-256 65691b7e5302d0fd71c6adf936861f3240b2803458f607721f95efa486956afe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 98cb59d04342317c70173eb945a68511a4328a6042776d101a9e0675bf12e781
MD5 eac2fef462ea29ca7b4bc0d8bca239b1
BLAKE2b-256 e0e4db0b7ba0bd9d243586482abaf50f130a00a802323ff8c18039007f3b432c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 043b462aff998be5504b6edf6539b5fde7426d14d8e4487d93184cd58ee5be2f
MD5 1eebaada158663613eaeacb44fc98fbe
BLAKE2b-256 a62bfc053fecf96e166c1f6e94b512dd49676b4e73aef5f05353ed8723dab5d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 92c66d9d41944ee55c213a0a48cc328806c4cd284359ea98a8cc354b638451af
MD5 baf1c43899f8ea22ad76e620f49792db
BLAKE2b-256 ffd4ac3428da99aeac78e8032797e547903e35136682beb1842ee3c3a9981686

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 c43bd416f8e2cfa9572ecd468e1e33b4fcba5c391d733f7a6f0dd85ba939090c
MD5 bab06446c384d0751b00805f44625a7c
BLAKE2b-256 6b35bdf130f8eee9068795f3286c07b529b1623e1aa6576de676496778805a4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 269ac98e8f9905d246ed180ec1140d42c559921b453300d3a427c8779f250f9b
MD5 d71b8f31a5f86609ea3203c8d51015b6
BLAKE2b-256 d8cc79219c71341485add0022b94a6aa0a7489e5ea626cc5afb12f3661e9a52b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 d3f2c54482c01101fbc5d8843df90bbc6396fd85bb6319a502062d1703c65ab6
MD5 6fd65eeb5f57cb6b711f18fd04a72246
BLAKE2b-256 678e204fa901bd87bebf436bba08ac69ee5b7754559a901d41c2e3d55bbccc2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 530117239556b8fefeecbca67cd383a915e204f5664170f738a97ba76a79bde4
MD5 236af1d715b58a870d513fa71588bffc
BLAKE2b-256 fee98e58a39fd0d993752dd11e5565de09d8a1f792762669f10c5e4815baf1f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 b12fc0487dca19ba834ab4d0d23acec3863438bf3b5a1e0871125887ff7c3389
MD5 ba97def28d8531e8065357f236f5fa34
BLAKE2b-256 c333f5959ee6c759d143bf2366b63a7385ec62f771b8f4645c34b59ac73a9a30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b64a7b2937d7fa0e9ce40f86550465ac283eccf033edbc2748090700c0b21801
MD5 dd0fc6f6af116a15e89e4cc0659761ba
BLAKE2b-256 88f6fcfca7c98634c4212d241503934184ebc63dde5ab14241e2da38f8c1dc97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 45b96fe8979f9cd61ce8a9df71fc06beb3e985977ae4a42a771e4ca93c357382
MD5 c47d5aa4123e800fcc3f8ba5f7f5d690
BLAKE2b-256 b74904602aa9bbe8e067474c73d88abec05443498e44fd306bdbaf0e2cc3482e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 76553382302f743d2931a6b0cd708e9ee27e53fa6401f00122cf1a949ff6664e
MD5 3c84247ad5637b2da2732842c66bd0d3
BLAKE2b-256 ed206fddf9dd44cf97a592a346bfbb18871f325431123d617f5e2d58b837ec77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 f8af394d1718f8d4332b8c0a041ebaa8819cc9b9c670bba4a7729d00667a754e
MD5 9c3c75a423dde6a9e0bf158c7db53ab7
BLAKE2b-256 0a021644b884cb6d46d926c96bf5b1ad2b8cef99f744d54b0f391be7626eb371

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3c053e770dbc2edeedbc1dd15ae573990796031ac7702ab5403b3a295f30d705
MD5 b162fdb00ba26321ad151d260c1deae6
BLAKE2b-256 475e88d048b63f0f243ca21159e531ea18d48b3e7aef11b5f6f46a47bb6201d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.3.2-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 de6a874a9a71d34575a440acbb4ab980d51dfefbc15a5a331d0d34087fe0b93b
MD5 8eb552a47402cc135ede05ee29126ecb
BLAKE2b-256 523d3ce5698d352843b504a9fe3b3b94355c5a9ffd8e1769ef200b758d429692

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

0.4.0

17 files

This release

0.3.2 This release

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