Data Ingestion¶
This guide explains how pycWB obtains the detector strain for one job segment: where the frame files come from, how they are cut to the segment’s padded GPS window, the synthetic-noise alternative, and the checks applied before the data is passed to conditioning.
Why this matters¶
Every later stage works on the time series produced here. The first WDM time
bin is the start of the padded window, and cluster and event times are measured
from it. Many setup failures appear at this stage: a frame list that does not
cover the padded window, a wrong channel name, or frames whose sample rate
differs from inRate. The checks below stop the job at these errors, so the
data is never silently shifted or truncated.
Overview¶
Data ingestion is split between job setup and the job itself:
Frame selection (job setup, once per run). After the job segments are built, frame files are collected from
frFilesorgwdatafindand attached to every job whose padded window they overlap (attach_frame_files_to_job_segments()). See the Frame File Selection section of Job Control.Reading (once per job, before the trial loop). The frames attached to the job are read and merged into one time series per detector.
Synthetic noise (optional). If the job has a noise specification, Gaussian noise is generated for the same padded window. Frame data, if present, is added to it.
Injections are then added for each trial (see below and Injection Infrastructure).
Padded window¶
A job with analysis window \([t_s, t_e]\) is always read over the padded window
of length \(t_e - t_s + 2\,\text{segEdge}\) (WaveSegment.padded_start,
padded_end, padded_duration). For jobs built from DQ files or a GPS
period, job setup has already trimmed segEdge from good time, so the padding
lies inside good time.
With super lags, detector \(k\) has a shift \(\Delta_k\) in seconds
(WaveSegment.shift, the super-lag id times segLen). Its data is read from
the physical window \([t_s - \Delta_k - \text{segEdge},\; t_e - \Delta_k
+ \text{segEdge}]\) (physical_padded_starts / physical_padded_ends), and
the time labels are then shifted onto the common padded window. After reading,
all detectors share one time axis.
Reading a frame¶
For every attached frame file, the reader:
Clips the detector’s physical padded window to the frame’s
[start, start + duration].Reads the detector’s channel (
channelNamesRaw, inifoorder) over that range withgwpy.timeseries.TimeSeries.read.Shifts the time labels from physical to segment time.
Checks that the sample rate equals
inRate(ValueErrorotherwise). Frames are not resampled here; that is the first step of Data Conditioning.
The pieces for each detector are then sorted by start time and joined with
gwpy’s append(gap='raise'), so any gap between frames is an error. The
merged series must start exactly at padded_start and end exactly at
padded_end.
Injections¶
The strain is read once per job. If the job has several injection trials, each
trial works on its own copy. Fixed-amplitude injections are added to the strain
at inRate, before resampling. Target-SNR injections follow the native cWB
convention: they are resampled separately and added after the
strain is resampled. In both cases the signal is in the data before whitening.
Implementation¶
pycwb.modules.read_data.read_data.read_from_job_segment()— reads all frames of aWaveSegmentand merges them. Withnproc > 1the frames are read in amultiprocessingpool ofmin(nproc, number of frames)processes.read_single_frame_from_job_segment()(one frame),read_from_gwf()(GWF read with file and NaN checks) andmerge_frames()(join and window check).pycwb.modules.read_data.parallel.read_from_job_segment()— bounded thread or spawned-process reads followed by the same merge. The CUDA processor (see Scientific backends and execution support) uses it whengpu.read_workers > 1.pycwb.modules.read_data.simulations.generate_noise_for_job_seg()— Gaussian noise for the padded window (pycwb.modules.noise.gaussian.generate_noise()).
The native processor
pycwb.workflow.subflow.process_job_segment_native.process_job_segment()
calls these functions directly. Optional shared-frame grouping
(Configure Resources and Resume Work) reduces repeated cluster transfers through a union
of source paths per allocation. It uses metadata only; the runtime has no
decoded-frame cache or input-provider protocol.
Synthetic noise. A job has a noise specification when the injection
block contains noise (keys type, psds and delta_seeds, each
mapped by detector) or, deprecated, injection.segment.noise. Noise is
generated at inRate with fLow as low-frequency cutoff. Each psds
entry is a two-column frequency/ASD text file. A detector’s seed is its
delta_seeds value plus the job’s physical analysis start time.
Public open data. pycwb.modules.gwosc downloads GWOSC frames and
writes ordinary frame lists, which are then read through frFiles.
pycwb gwosc-data <yaml> fetches [gps_start - segEdge, gps_end + segEdge]
at inRate and writes DQ files into <work-dir>/input.
pycwb gwosc <event> fetches the event’s 4096 Hz files and writes DQ files,
cwb_period.txt and a template user_parameters.yaml. inRate must match
the downloaded files. See Search Public Detector Data.
Online search. pycwb online does not use read_from_job_segment. It
streams data through the sources in pycwb.modules.online.data_source
(NDS2, Kafka, shared-memory frame directory). See Configure a Streaming Search.
cWB-2G correspondence. cwb2G::ReadData, part of the data-conditioning
stage in the Pipeline Lifecycle table, reads the frames with
channelNamesRaw, stops on NaN samples or a rate other than inRate,
applies the super-lag shift, then applies dcCal, fResample and the
levelR resampling. pycWB does the reading, checks and super-lag relabelling
here, and applies dcCal and resampling in
check_and_resample_py() at the start
of Data Conditioning. pycWB generates injections in memory; the native
reader does not use the MDC channels channelNamesMDC.
Configuration¶
Parameter |
Default |
Meaning |
|---|---|---|
|
required |
Detector order. All per-detector lists below follow it. |
|
|
One frame-list file per detector, one |
|
required with |
One frame type per detector. |
|
first letter of each |
One site letter per detector. |
|
— (gwdatafind default) |
Datafind server. |
|
|
URL type. An |
|
unset |
Optional regular expression selecting a storage replica by URL. One matching replica is used per logical frame. Filename lookup supplies alternatives when the interval index lists only another replica; absence of a match raises an error without dropping that frame. |
|
|
One strain channel per detector, for example |
|
16384 |
Sample rate the frames must already have [Hz]. Checked, not converted, at read time. |
|
8 s |
Padding read on each side of the analysis window. |
|
1 |
More than 1 reads frames in a process pool (native reader). |
|
1 (max 2) |
Concurrent frame reads in the CUDA processor. |
|
|
Spawn reader processes instead of threads. |
|
|
Repeat the reads serially and require bitwise-identical data. |
|
— (unset) |
Generate Gaussian noise for each job (see above). |
Output¶
Conditioning receives a list of pycwb.types.time_series.TimeSeries,
one per detector in ifo order. Each series:
covers the padded window
[padded_start, padded_end]in segment time (segEdgeon both sides, super-lag shift removed) atinRate;contains frame strain, synthetic noise, or both, plus the trial’s fixed-amplitude injections.
Troubleshoot input data¶
Frames exist and are named correctly: every file in a
frFileslist must exist and be named...-<gps>-<duration>.gwf(GPS start ≥ 1104105616, i.e. 2015-01-01; duration ≥ 1 s). Lines starting with#are skipped.Coverage fails early:
pycwb run ... --list-jobsruns job setup. A detector without frames, or frames that do not cover a job’s padded window without gaps, raisesValueErrorthere, before any strain is read.Sample rate matches
inRate: the log linedata info: start=..., duration=..., rate=...shows each merged detector series. A rate mismatch is aValueErrornaming the frame file.Channel is present: a wrong
channelNamesRawentry appears as aRuntimeErrornaming the file, channel and read window.No NaN, no empty files: NaN samples or 0-byte files raise
ValueError.Something to analyse: a job with no frames, noise or injections stops with
No data to process.
See also: Pipeline Lifecycle · Job Control · Injection Infrastructure
Next: Data Conditioning — resampling, line removal and whitening