Skip to main content

sega

Segment Evaluation & Generation Application

ci coverage documentation pypi version


Evaluate data quality conditions on detector channel data and produce IGWN XML segment files or publish directly to DQSegDB. SEGA is built on the SGN streaming pipeline framework and driven by declarative YAML configuration.

Resources

Installation

pip install sega

Note: Older operating systems may not have C libraries that are compatible with SEGA due to requirements of the gwframe dependency. For these systems, it is recommended that users install sega inside of a previously made conda environment to ensure that a compatible C library is available. Additional details on the minimum requirements for gwframe can be found in the gwframe installation documentation.

Where to Start

  • Tutorial -- New to SEGA? Write a config file and generate your first segments step by step.
  • User Guide -- Configuration, condition types, data sources, output modes, and the CLI.
  • API Reference -- API documentation.

Features

  • Declarative YAML configuration with includes, defaults, and bulk expansion
  • Per-sample threshold, range, and bitwise condition checks
  • Aggregate statistics (mean, RMS) with trend detection
  • Boolean condition logic with arbitrary nesting (all_of, any_of, not)
  • Infix expression syntax for complex boolean conditions (a & !b | c)
  • Multiple data sources: gravitational wave frames, Arrakis, or synthetic data
  • Output to IGWN XML segment files or DQSegDB
  • Durable DQSegDB publishing through a local spool: server outages, bad credentials, and crashes never lose an evaluated stride
  • Operator tooling to create flags, inspect a spool, and backfill gaps (sega create-flags, sega inspect, sega reconcile)
  • Live monitoring with a dashboard, Prometheus metrics, and health checks
  • Dry-run mode for config validation

Quickstart

Write a configuration file

Create a file called config.yaml:

meta:
  ifo: H1
  subsystem: DQ

conditions:
  calibrated:
    operator: bits_set
    channel: H1:GDS-CALIB_STATE_VECTOR
    bits: [0, 6]

  low_noise:
    operator: below
    channel: H1:PEM-CS_ACC_BEAMTUBE_YMAN_X_DQ
    threshold: 500.0

  science_ready:
    operator: boolean
    expr: "calibrated & low_noise"

segments:
  H1:DQ-SCIENCE_READY:
    condition: science_ready
    version: 1
    limit: 16
    comment: "Calibrated and low noise"

Run from frame files

sega --config config.yaml --source frames \
     --frames /path/to/H-H1_R-*.gwf \
     --start 1187000000 --end 1187001000

This evaluates the conditions over the specified time range and writes an XML segment file to the current directory.

Validate a config without running

sega --config config.yaml --source fake --dry-run

The --dry-run flag parses and validates the configuration, printing a summary table of conditions and output segments. Use -v to include the full segment listing.

Stream from Arrakis

sega --config config.yaml --source arrakis

Without --start and --end, SEGA streams live data continuously. Press Ctrl+C to stop.

Publish to DQSegDB

Create the configured flag versions on the server once, then run:

sega create-flags --config config.yaml --segment-server https://segments.ligo.org

sega --config config.yaml --source arrakis \
     --output-mode dqsegdb \
     --segment-server https://segments.ligo.org \
     --integer-boundaries

Each stride is recorded in a local spool before it is sent, and a publisher drains the spool to the server with retries, so nothing evaluated is lost if the server is down. sega inspect --spool FILE shows what is still unpublished and why. See Publishing to DQSegDB for what to expect in operation.

Boolean expressions

Boolean conditions support infix notation with & (AND), | (OR), and ! (NOT), with standard precedence:

conditions:
  calibrated:
    operator: bits_set
    channel: H1:GDS-CALIB_STATE_VECTOR
    bits: [0, 6]

  injecting:
    operator: bits_set
    channel: H1:GDS-CALIB_STATE_VECTOR
    bits: [5]

  low_noise:
    operator: below
    channel: H1:PEM-CS_ACC_BEAMTUBE_X_DQ
    threshold: 500.0

  analysis_ready:
    operator: boolean
    expr: "calibrated & !injecting & low_noise"

This is equivalent to the explicit form:

  analysis_ready:
    operator: boolean
    all_of:
      - calibrated
      - not: injecting
      - low_noise

Metadata

Release files for sega 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sega 0.5.0
File Size Uploaded Provenance Actions
sega-0.5.0.tar.gz 360.4 kB Without provenance Details for sega-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sega 0.5.0
File Interpreter ABI Platform Actions
sega-0.5.0-py3-none-any.whl Python 3 none any Details for sega-0.5.0-py3-none-any.whl

Total release size: 510.6 kB

Release files / sega-0.5.0.tar.gz

Download URL sega-0.5.0.tar.gz
Size 360.4 kB
Tags Source
SHA-256 checksum
How to use checksums
84b5be082d8d709b74a5cb3e809f944975c5ab06c865292207c7865e384c611f
BLAKE2b-256 checksum
How to use checksums
426a3a843f60df40d0a0d10452a5ac0e37c363a38685d6b2a39ac6d1ae91ecf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / sega-0.5.0-py3-none-any.whl

Download URL sega-0.5.0-py3-none-any.whl
Size 150.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6bcc83eaca5a755072cebabb9bf38acfcc3b04c56e6ad61a691389200bb2361
BLAKE2b-256 checksum
How to use checksums
542837d86dba5781e0bb734d004f05c80cbe9e1a778015c5fb59f82a018d876c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Security for sega 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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