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.t0} to {data.t0 + data.duration}")

# Read all channels
channels = gwframe.read('data.gwf', channel=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, t0=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, t0=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.t0}, 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(
    t0=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/

# 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

gwframe-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl (18.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.13macOS 13.0+ x86-64

gwframe-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl (18.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.12macOS 13.0+ x86-64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.11macOS 13.0+ x86-64

gwframe-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl (18.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.10macOS 15.0+ ARM64

gwframe-0.1.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.1.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for gwframe-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8bf5e85c1ea998f5bf2bf44f459fc122ae53ecf5b227d85bbe5b3dfb33be6782
MD5 076bac497bfc2901eabf7e1c3fbddc5f
BLAKE2b-256 b42ae56fed1e2ba7c3829e1c205f462e155c9ecf47c3df79d495ca9f3174fccc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 47c64f9aefe3c1ae422fa2440802c624dbb8a8e1276e3d356bcf133d0a8f04a8
MD5 04fbd8a1ae5d3bc26ab17c67602f6758
BLAKE2b-256 49b700ed8a9f81614f6ce2f4038e004fe7894098d6cf76a8a9d0786afaece00d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 9d3142707161ded3b9f9944788721dd3782d28487a805bc3fd3c1656dedc621a
MD5 ce8065084902f853dedf9b68f92446f6
BLAKE2b-256 c9040301b06ff7e30e1b02724916fbd8f590be0d78b3216a9a72fdb5a7023cf3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 33659a6b1b09c9e6272b537745d44a35e41efa76b06b72da447d46166dc88ed3
MD5 b297bded27251b94fff60ca2b6ef5bac
BLAKE2b-256 03e1c1306cfa7feef762f4e9aea1e56f22aefbb0c1e4a1d74a8fd208bb95c081

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2e884cd11d1f4266f3fe67c0b0905bb52e49626a79d00daa3b3c33b8c3c5e151
MD5 bad7111c75407551cbe5f15bc8947f1b
BLAKE2b-256 fed404ea3e23979cabdb11819a46f1332b59ed960cd86804d3671052b291bf0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 df8fe1fb4a9e4aa2fd1f2a14b6034edaa55b644e2c76d3d9b6890b1222b8e625
MD5 aaaeb24bbe7979d9b0632a3fd7f94dc9
BLAKE2b-256 6d7f07458b6cab8cd5abf9ec579d5001cb1d1080f1ecddbb1c163a7a30ecccf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 dc54bf846e9c0fe437d2da4af47c3244d73e9b2e41acf1d9145e33ddd64a1e0e
MD5 b690b41b419f9b7ba4084b7dee8db76e
BLAKE2b-256 6de6e2ff40f685444e6b8b0b361c157c3b169b7e89177831b72808062cc4364f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 f2201e45360ec720a23ee147afb853ff214e6555aea3e923e6a0642993fd5a4b
MD5 fe5a7a2089a134e698bb140c542c127e
BLAKE2b-256 01c62166a3a020e76613e026b6495817584d4130c7f2c026e0b9190052fddf56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1adb67f29485a39c81e7413714bd3fb9e73caf7c246322b08aa2a94a4d41a69c
MD5 f5f03da5535e2fe50732f58b4d405997
BLAKE2b-256 8029f7aa3ff1b2c5b5bad1dc9523ddd08f3ebbb8671f23136d5abffce47d3f38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b379e10de9ce023db496bc1276217a3dd67c6712a4ae614b8eb47c6eb8f09a82
MD5 37585610e5ce3926669b171caefa2ad3
BLAKE2b-256 103383c5c2cb511676f538cf2ecf69ec9d5cb659ce8b417413c09e0b6afd4594

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gwframe-0.1.0-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 52a42ad9f801e91ccab9e5d77375a4eb9751df3b4a58a10cbe7f16d8785d4b90
MD5 ffd6daf54dddb0f6aedd9c7a7743d8f9
BLAKE2b-256 0ad092a995790aeb4b76f5a96fd578bd76a35c92cce627da74164d0c6b504927

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