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 conda 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.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.4.2-cp314-cp314-manylinux_2_34_x86_64.whl (18.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

gwframe-0.4.2-cp314-cp314-manylinux_2_34_aarch64.whl (18.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

gwframe-0.4.2-cp314-cp314-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

gwframe-0.4.2-cp314-cp314-macosx_13_0_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.14macOS 13.0+ x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.13macOS 13.0+ x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.12macOS 13.0+ x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.11macOS 13.0+ x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.10macOS 15.0+ ARM64

gwframe-0.4.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.4.2.tar.gz.

File metadata

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

File hashes

Hashes for gwframe-0.4.2.tar.gz
Algorithm Hash digest
SHA256 b65e0b795dbbf036af6ad4f959e4ad02ea4156d2fe9f8ce6e3a7982883ac86a4
MD5 f48c4363daff853f4ba3b23b9db80cff
BLAKE2b-256 1b832fec14163e9236bf4ffe541f5a65de6f0486ec5c65cdf9fab2b27620d82a

See more details on using hashes here.

File details

Details for the file gwframe-0.4.2-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.4.2-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7d47a88cb1a9a2f30d1e06650c8777e6360a189d514d9aa54a76ea418e3490af
MD5 0e8fffb28d71755e97c3580c346ef0f6
BLAKE2b-256 6f01304aa5bf9e69ccea526636bd53ee3cdcf6b39151cb62bbfe178a575f81bd

See more details on using hashes here.

File details

Details for the file gwframe-0.4.2-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for gwframe-0.4.2-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 1c209af65c35ca70e976eb22ae2e4f83f74f3159391307dabc0ce98496e5f40b
MD5 27b0b094015898e6887f64356842b5bf
BLAKE2b-256 fa9ba87a20452e055611e6eed415d523385571802c6060f26c0804cda27b1114

See more details on using hashes here.

File details

Details for the file gwframe-0.4.2-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for gwframe-0.4.2-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 920f4f30c9507193b10b00edac5598baf5cec937a3b7b4d2dc4b7a38c45d840a
MD5 794c9bc0e63e9325531e4cc8b5c25b58
BLAKE2b-256 1d415bd32d4ddc87d6f49e201d0ee9af87652ba99f7b5ad1877eeebd9d171d04

See more details on using hashes here.

File details

Details for the file gwframe-0.4.2-cp314-cp314-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.4.2-cp314-cp314-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 7079289da5cbdf18915cf7cb46cbbec977d10c1f3aa01e9cbb50bb2d5afde97a
MD5 cd557582fe8a07cee835cd2d0d4d21da
BLAKE2b-256 291fbdf4041ab073cf7bd4a896082e75eb894a6c4bdd0e69369c01e1dbb8edb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4baf4a4cfc9ec01e43d1f37ae8e580965b2f4a4b9a4806e80e264acfc081cc00
MD5 76706a5f9ab4241b9d79dfac585f4421
BLAKE2b-256 4348e2b3f255bad2dd363e4f92e923f470728a1ce20d2495569d10690ddc9895

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 8a61e0dd0e699ffa7aca25c93c648eb70e02eb301070af01748f78f061aeb89a
MD5 ca1ac59697e7a9fc37219cc9dab82ae5
BLAKE2b-256 21ca46e95f4236a8550f728611ad31cb8558937a4048f67639165ffb3bb95295

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 681bcc8e04066233f0d62eadcbba776581892236e10d303ae441e67e1ea21c1d
MD5 5331cfa5273d230db8a9b57400290040
BLAKE2b-256 9517b9110df594a8dfbb40eb4443a4d95adb8ed6182f14e9d926f944d17f7912

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 419d116ef270ac27a50cde8d1a277e51143723d63cfb2970046f1d671ecb1020
MD5 09f9598f8df74ab512254b7618b92e52
BLAKE2b-256 20e84f6db565e82cf2a25cd4c4641873eb74505ea039357dc206668b1684e10f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 069658c8c38647fc6e6b9774bdd17b4d732cf48ce8928486edbc1b0c7f9b18e6
MD5 10eb0d489346b91e971d7b25818dcf7b
BLAKE2b-256 9e507a804738b19fd26b1462b09c3d63f8155c50a243e2d884543fa59100bb67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 e2516d8269ac64b46ec9d18dbebafbd9eb5ca5781f4bf0304f726ab89829b753
MD5 c03241a9dc24767b72a0e117fcb8185f
BLAKE2b-256 6a5431760e472271ebe1537e7516d06774328d388c6404f1e9f7354aeca09189

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2f25827a9334978dd5805f7d209d16603a07e5db353ba8fe6598adfa4eacd7d9
MD5 f32b86c975da2f2258813a7b2f07679e
BLAKE2b-256 7d709c27f4609b81eb9a7f241aee24a251fb3298e813e1f46b8d1152e5528a06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 b3f64d48c678c6a78ef6c1bbf51dd8dc71452cbc58d2c5cf4cbb29462ee369af
MD5 1ce742e7d84d92f9397d124e05c03192
BLAKE2b-256 74578303d37af1ab6d60f1576dbce6409489128b9c7b97004924fe7af69e73c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 06b613d6987a845725816a0e3de9f7505b694e727b2f3407d4288b32593118cc
MD5 7eaf408e4f18e69396fe2e0eb2c51f9f
BLAKE2b-256 05df59b36487098cc61f1a5e411418fc38c0cb11fa26e2f452ace1c92d8fd480

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 727ab27a14d7c14a9437bc25a8d7f2dfe0cddb3d00e6cdae571584801a9d3978
MD5 c1a5bac32129a4ef1a489d30322c6737
BLAKE2b-256 c8fd33aac9684f49cc839dd26204992dfd67cc0e8edb351ab5e3879166a4f485

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 50c906b2d02fa5b180b8908b7cf25840d1250e92d37a470397fd418c0f0be42d
MD5 b60267fc474a947ed7c6f5ad22f739ad
BLAKE2b-256 27883b42b98f2af82846d304920e7bce208f8f378e379225e76173cce914d515

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 700ef1dc15641d7bb19f9047a29c6e2655f766bc222ea3d452675841c7e91408
MD5 0d361fa0ded734047ac72b199be3b237
BLAKE2b-256 75c8cee3257ba58664fe6223a96273681694bb3c3411de199fd01fac304d9e2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 27eb933337f1866e42d7272bad32d24ba7bcd5cd27a29c81b9a7dab1bd665e2e
MD5 315d9faa34a333a396f1a3276175bfbc
BLAKE2b-256 da69238427082c9b8617c9a7d2575e70a529d158a7ad237ec43f2f85b59ee66b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 cf20b06390cfcc651a751a96ff7fd14353f931ebd8b1f6c73fc92d08b0066998
MD5 7b3a1bb4a55ddc077b4db2a047be31b1
BLAKE2b-256 0bf375a3d131d77e56cd0eb755b591144f3d2ac789b29244b2a86a2858d7fcd8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 832241f7b09006c70eaef88ce8b20045e60df441a35e36ab4f5cf039b2fec730
MD5 66395dd5a0ad2af11e846376a9ef2c30
BLAKE2b-256 d51bf7d09d1e9cdc1e9295fab61a65c49eff6bad6bf6ed336899c9fbaee8574b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.2-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 66a8378df06a2d296cb49c7fd9a0b4b753d0bf3524a1632c694b4ec55049edb6
MD5 1c023fca768174f62b88e7578c5eac9b
BLAKE2b-256 a3a958b33241858e2c6f3d7fe5f51c23ff0c02c31481f98c93d99605c8dcdbd0

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

This release

0.4.2 This release

21 files

0.4.1

17 files

0.4.0

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