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

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.13macOS 13.0+ x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.12macOS 13.0+ x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.11macOS 13.0+ x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.10macOS 15.0+ ARM64

gwframe-0.4.1-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.1.tar.gz.

File metadata

  • Download URL: gwframe-0.4.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f57558ad9f4d5147e9c95cd326e5b6d02add4478e2a79b582ddb683200135cc8
MD5 a21f6c770fff5d42c3aa4fa721dd837c
BLAKE2b-256 cd8d03d4df2496a43d6aaa654b0f6322153c5e19ea93512c2cef101251e87491

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1ed0760ef761bde5fe667dd0ca60367ca07b9390c6eefd940e48abe591bb1e17
MD5 099caf9bf5e850a39d0b73f74009a3b5
BLAKE2b-256 0ad9c14661b748feda9689e97e612939130d318f519c51606094d6ed5079578a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 79c79e8ee062f257ba992fd97625a8a82d419a841096809cf300a82991807356
MD5 adfc092065cf53845571645244b3d237
BLAKE2b-256 acc5d6e750774ae4e84a5bf3e34eed6afd260bd8a323c71692c314ef75749a5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c06dfad67180ff76c0f1aadee8134ff75a88683b4ca95f79e09b8149e3f7fc3b
MD5 0b8cd7231bd99402832d7e0b7e6643bd
BLAKE2b-256 fa9929c3a0a1f9bb3561bbfb949c26591928100b4242fc842ea41ec5ceb42d6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 cb05bc75614d3d748500809bf872c6155dce25b303e9f0cf4325a7adc96206ce
MD5 c41815eed70c723799aa4397efa3d620
BLAKE2b-256 4a6b4e5053cc68821aa48ce614c53d820d48f17f275e5f0009dd5b80cd8b72d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5214b0eed902177e20ef04db67a7d3ae63947fb072c1a7a5f827ad59ede33974
MD5 6f335d33ab17581e0fe9f30b12fa0eb0
BLAKE2b-256 8f16c683ad07951a9eda35b12576f9939ce690955babe3225901591818821dcf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 34c970c12f25b51b630221e6856c971fe3be3e008cd11445e6ef34d99c865848
MD5 34b4e83775ab7b9fb2609153b7fc0665
BLAKE2b-256 ce56fdf37a6671d8ec9d9833d40d5add12a61f0b1c70d272354680d6322f9dc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 97191bf8193b37cefc0a8101bc78c5111080de0c3b3e9ddc38de2a78f6782915
MD5 96eff4967aec39c517b5de208185001b
BLAKE2b-256 3751d3f135de4a8182c45ade60ab2dedefce76e2db49225da67466f11900c37d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 13961f71b049eed01f94173fbc42073f54cbb96aad73acdc9a10a91aa277ad1d
MD5 6c5d64db5b793d14886f62adefbfbbc4
BLAKE2b-256 74ffaabd7d49ec7a53c1c3f88d6f96b96692e2c8c383426cd75c7640e685a01f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6dec2997560031ff84b17a9e653122efa442e58ee4ebfa8ed9a9f3ca4a8c1726
MD5 21d8743a0105f705ccb829d22e979a79
BLAKE2b-256 13617638d03c869f6e528d73cb0accc0ed3c563629cf5cf52f005a43d4ff087b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 9f821fa0da9414345e6b033d9b8dc11cfb7038cdeb251542f5e2283a13fafa66
MD5 8ac4c9560a3222e4b2afec1409691459
BLAKE2b-256 2a23df83102a8bbbf41840db4d6fffa81799fdab54463a7445bc2e494ef0b0b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 4c06ba49f5ef13b4362ad845859d14e6fc6f59a5154b91438f99df08204d9846
MD5 4997a6be315293b3c9944557ecdf8b0c
BLAKE2b-256 59509310b9b378850e35c0b5d176174d7fab53e8d016643d85a80db78f544d77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 792344c06d5563af32f97b979ae8801b994e7400f905702636d4fe14d30bfc4c
MD5 c7bd0c3358265a2171cfa5052c72c0e8
BLAKE2b-256 a5aa36ea3c1795373b661c3e97094664c5be2355279d7c1ec063a3d49b05491e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0d9d442fef2bcacaa609ab6a6d24e4de6931f21c9dc1683991b805b5c4fbac0d
MD5 e86e360a4f257246a172e54bc4d1782c
BLAKE2b-256 475f1841d95a08971896fdf3b4e0c12c799dc3f6f44d3aaa0f369c45222070e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 e8b35e130a29a27ddaa286d58099e5745088424b511bf22e7b6e03f770fd85bc
MD5 8e76bcc318d7441cf5ba62016f644607
BLAKE2b-256 f2af4c0b0d33cd34c51569b7ac1b7cca02f4c896233d8f55b5789dad3739c8f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 dfb867f595187124c0716b4564938cc54d0ad75cefab66e888f9579dc1eb4ef6
MD5 5dfabaf8ebf564389ccc9308b28ed16f
BLAKE2b-256 48143a38a18f0b95cbf8e9bc725296d609c97db53b00b55239bef88fd6fe7f20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.4.1-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 cb8f07da887271031e91d5c33b1ade21a102f233b1c5027897509cd1e69c9989
MD5 5a4fc58edee77a1c23f3880409a93a59
BLAKE2b-256 7a4d54569ce3287ab7ef64d6cf3017250f93c084fb1ddca3f81670a7a39e2daf

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

This release

0.4.1 This release

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