pycwb.modules.read_data package¶
Submodules¶
pycwb.modules.read_data.data_check module¶
- pycwb.modules.read_data.data_check.check_and_resample(data, config, ifo_index)[source]¶
Legacy-compatible data check and resampling.
Normalises input to pycwb TimeSeries, validates, applies DC correction and resampling as configured.
- Parameters:
data (pycwb.types.time_series.TimeSeries or gwpy.timeseries.TimeSeries)
config
ifo_index
- Returns:
pycwb.types.time_series.TimeSeries
- pycwb.modules.read_data.data_check.check_and_resample_py(data, config, ifo_index)[source]¶
Python-native data check and resampling.
Input is normalized to pycwb TimeSeries and output remains pycwb TimeSeries.
- Parameters:
data (pycwb.types.time_series.TimeSeries or gwpy.timeseries.TimeSeries)
config
ifo_index
- Returns:
pycwb TimeSeries
- pycwb.modules.read_data.data_check.data_check(data: TimeSeries, sample_rate: int)[source]¶
Check if data contains NaNs and if the sample rate is consistent with configuation
- Parameters:
data (gwpy.timeseries.TimeSeries) – time series data to be checked
sample_rate (int) – sample rate from configuration
- Returns:
True if data is valid
- Return type:
bool
- Raises:
ValueError – if data contains NaNs or sample rate is not consistent with configuation
pycwb.modules.read_data.data_find module¶
pycwb.modules.read_data.mdc module¶
Deprecated compatibility imports for the former MDC module.
pycwb.modules.read_data.parallel module¶
Opt-in bounded frame reads, followed by unchanged native frame merging.
Runs in the job (parent) process before any lag worker exists. Each frame is
decoded by the unchanged native read_single_frame_from_job_segment; only
the scheduling of the per-frame reads changes, and the merge is the native
merge_frames on the frames in their original order.
- pycwb.modules.read_data.parallel.read_from_job_segment(config: Config, job_seg: WaveSegment, *, workers: int = 1, processes: bool = False, validate: bool = False) Any[source]¶
Read and merge every frame of
job_segwith bounded parallelism.- Parameters:
config (Config) – Search configuration;
segEdgeis passed to the native merge.job_seg (WaveSegment) – Job segment whose
framesare read.workers (int) – Maximum concurrent reads or detector tasks; positive, defaults to one.
processes (bool) – Spawn independent frame readers instead of threads.
validate (bool) – Also run the serial reference and compare exact outputs.
- Returns:
The native
merge_framesresult (per-detector merged data).- Return type:
object
- Raises:
ValueError – If workers is not a positive integer.
AssertionError – If validation is enabled and the parallel result differs from the serial reads.
pycwb.modules.read_data.read_data module¶
- pycwb.modules.read_data.read_data.read_from_catalog(catalog, event, detectors, time_slice=None)[source]¶
Read data from catalog via GWOSC (Gravitational-Wave Open Science Center).
- Parameters:
catalog (str) – the name of the catalog (unused, kept for API compatibility)
event (str) – the name of the event (e.g. ‘GW150914’)
detectors (list[str]) – list of detectors
time_slice (tuple, optional) – time slice for cropping the data, defaults to None
- Returns:
(time series data, event GPS time)
- Return type:
tuple[list[pycwb.types.time_series.TimeSeries], float]
- pycwb.modules.read_data.read_data.read_from_gwf(filename, channel, start=None, end=None) TimeSeries[source]¶
Read data from GWF file
- Parameters:
ifo_index (int) – the index of the ifo in the config.ifo list for processing with user defined parameters
config (Config) – user configuration
filename (str) – path to the gwf file
channel (str) – channel name to read from the gwf file
start (float, optional) – start time to read from the gwf file, defaults to reading from the beginning of the file
end (float, optional) – end time to read from the gwf file, defaults to reading to the end of the file
- Returns:
strain data
- Return type:
- pycwb.modules.read_data.read_data.read_from_job_segment(config: Config, job_seg: WaveSegment) list[PycwbTimeSeries][source]¶
Read data from the frame files in job segment in parallel and merge them if there are more than one frame files for each ifo
- Parameters:
config (Config) – user configuration
job_seg (WaveSegment) – job segment
- Returns:
list of strain data
- Return type:
- pycwb.modules.read_data.read_data.read_from_online(channels, start, end)[source]¶
Read data from data server with gwpy
- Parameters:
channels (list[str]) – list of channels to read
start (float) – start time to read from the data server
end (float) – end time to read from the data server
- Returns:
list of strain data
- Return type:
- pycwb.modules.read_data.read_data.read_single_frame_from_job_segment(config: Config, frame: FrameFile, job_seg: WaveSegment) PycwbTimeSeries[source]¶
Read data from a single frame file in job segment, this functions also handles the shift defined in the WaveSegment. It will read the data with the physical start and end time of the frame, and shift the data to the data start time. The segment edge of the job segment will be added to the start and end time of the data. Additionally, it will resample the data if the sample rate of the data is different from the job segment sample rate.
- Parameters:
config (Config) – user configuration
frame (FrameFile) – frame file to read
job_seg (WaveSegment) – job segment
- Returns:
strain data
- Return type:
pycwb.modules.read_data.simulations module¶
Construct simulated job-segment data from Gaussian noise and injections.
- pycwb.modules.read_data.simulations.generate_injection(config, job_seg, strain=None)¶
Inject all simulations assigned to a job segment into detector data.
pycwb.modules.read_data.write_data module¶
Writers for gravitational-wave strain data.
Module contents¶
pycwb.modules.read_data — Gravitational-wave strain data reader.
Reads GW strain from frame files (GWF) or online data servers, constructs simulated job-segment data, writes GWF output, and checks data quality.