Skip to content

sgn-gwframe

Gravitational wave frame file I/O elements for sgn-ts

ci coverage documentation pypi version


Resources

Installation

pip install sgn-gwframe

Features

  • Read timeseries data from .gwf frame files, frame caches, or lists of frame files
  • Watch directories for new frame files in real-time with automatic gap detection
  • Write timeseries data to .gwf files with compression, multi-frame support, and retention policies
  • Integrates as source and sink elements for SGN pipelines

Quickstart

Read from frame files

from sgn_gwframe.sources import FrameSource
from sgn.apps import Pipeline

src = FrameSource(
    name="gwosc",
    channels=["L1:GWOSC-16KHZ_R1_STRAIN"],
    frames="frames.cache",
    start=1187008882,
    end=1187008896,
)

pipeline = Pipeline()
pipeline.insert(src, ...)
pipeline.run()

Watch a directory for live frame data

from sgn_gwframe.sources import FrameWatchSource
from sgn.apps import Pipeline

src = FrameWatchSource(
    name="L1_live",
    channels=["L1:GDS-CALIB_STRAIN"],
    watch_dir="/data/frames/L1",
)

pipeline = Pipeline()
pipeline.insert(src, ...)
pipeline.run()

Write frame files

from sgn_gwframe.sinks import FrameSink
from sgn.apps import Pipeline

sink = FrameSink(
    name="writer",
    channels=["H1:GDS-CALIB_STRAIN"],
    duration=1,
    path="output/{instruments}-{description}-{gps_start_time}-{duration}.gwf",
    description="FILTERED",
    max_files=100,
)

pipeline = Pipeline()
pipeline.insert(..., sink)
pipeline.run()