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:
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:
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:
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.data_find.get_from_data_find(ifo_list, t_start=None, t_end=None, t_center=None, duration=1200, host='datafind.ldas.cit:80')[source]

Get data from data find

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_seg with bounded parallelism.

Parameters:
  • config (Config) – Search configuration; segEdge is passed to the native merge.

  • job_seg (WaveSegment) – Job segment whose frames are 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_frames result (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.merge_frames(job_seg, data, seg_edge)[source]
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:

gwpy.timeseries.TimeSeries

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:
Returns:

list of strain data

Return type:

list[pycwb.types.time_series.TimeSeries]

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:

list[gwpy.timeseries.TimeSeries]

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:
Returns:

strain data

Return type:

TimeSeries

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.simulations.generate_injections(config, job_seg, strain=None)[source]

Inject all simulations assigned to a job segment into detector data.

pycwb.modules.read_data.simulations.generate_noise_for_job_seg(job_seg, sample_rate, f_low=2.0, data=None)[source]

Generate Gaussian noise for the padded window of a job segment.

pycwb.modules.read_data.write_data module

Writers for gravitational-wave strain data.

pycwb.modules.read_data.write_data.save_to_gwf(signals, detectors, channel_name, out_dir, start_time, duration, label)[source]

Save one strain signal per detector to GWF files.

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.