sage.data.primer.get_data_release
Filename : real_noise.py Description : Short description of the file
Created on 2025-11-06 15:00:16
__author__ = Narenraju Nagarajan __copyright__ = Copyright 2025, ProjectName __license__ = MIT Licence __version__ = 0.0.1 __maintainer__ = Narenraju Nagarajan __affiliation__ = N/A __email__ = N/A __status__ = [‘inProgress’, ‘Archived’, ‘inUsage’, ‘Debugging’]
GitHub Repository: NULL
Documentation: NULL
Classes
Immutable, multiprocessing-safe download configuration. |
|
Parallel GWOSC data downloader that stores validated strain segments to HDF5. |
Functions
|
Verify the checksum of a single binary segment. |
|
Verify checksums for all segments in metadata. |
|
Compute the checksum of an entire file using streaming reads. |
Module Contents
- class DownloadConfig[source]
Immutable, multiprocessing-safe download configuration.
Frozen dataclass passed to worker processes via
multiprocessingPool.starmap; must be pickleable (no open file handles, no locks).
- validate_segment(bin_path, seg_meta, *, strict=True)[source]
Verify the checksum of a single binary segment.
- Parameters:
- Returns:
Trueif the checksum matches,Falseotherwise.- Return type:
- file_checksum(path, algo='sha256', block=1 << 20)[source]
Compute the checksum of an entire file using streaming reads.
- class DataReleaseDownloader(segments_metadata, save_parent_dir, noise_low_freq_cutoff=15.0, minimum_segment_duration=22.0, corrupt_trim_length=0.2, max_download_retries=10, retry_delay=0.5, num_workers=4, proxy_reset_every=50, proxy_reset_sleep=90.0, make_monolithic_file=True, save_bin=False, sample_rate=2048.0, release_dirname='data_release')[source]
Parallel GWOSC data downloader that stores validated strain segments to HDF5.
Downloads LIGO/Virgo/KAGRA open-data strain segments from GWOSC for a structured-array of (detector, observing-run, segment-list) records. Supports both a monolithic HDF5 file and a raw binary output format, with optional checksum validation per segment.
- Parameters:
segments_metadata (np.ndarray (SEGMENT_DTYPE)) – Structured array produced by
TimelineQuery.save_parent_dir (str) – Root directory under which the
data_release/sub-folder is created.noise_low_freq_cutoff (float) – High-pass cutoff applied during downsampling (default
15.0Hz).minimum_segment_duration (float) – Segments shorter than this (seconds, post-trim) are discarded (default
22.0).corrupt_trim_length (float) – Seconds trimmed from each edge to discard corrupted data (default
0.2).max_download_retries (int) – Maximum number of GWOSC fetch retries per segment (default
10).retry_delay (float) – Seconds between retries (default
0.5).num_workers (int) – Number of parallel worker processes (default
4).make_monolithic_file (bool) – If
True(default), all segments for a (detector, run) pair are concatenated into a single HDF5; otherwise one file per chunk.save_bin (bool) – If
True, write raw binary (float32 LE) instead of HDF5, with a companion JSON segment index (defaultFalse).sample_rate (float) – Target sample rate after downsampling (default
2048.0Hz).proxy_reset_every (int)
proxy_reset_sleep (float)
release_dirname (str)
- retry_and_append(bin_path, seg_json_path, segments_to_retry, detector, run)[source]
Download missing/failed segments and append them to an existing .bin file.
- Parameters:
bin_path (Path or str) – Path to the existing monolithic
.binfile.seg_json_path (Path or str) – Path to the existing
*_segments.jsonsidecar.segments_to_retry (array-like of shape (N, 2)) – Pre-trim GPS start/end times for each segment to retry.
detector (str) – Detector name (e.g.
"H1").run (str) – Observing run label (e.g.
"O3b").appended (After this call seg_json_path is updated with new entries)
still (and a *_retry_failed.json is written with any segments that)
downloaded. (could not be)
- download()[source]
Download all segments from GWOSC and save to disk.
Iterates over every (detector, observing-run, segments) record in
full_metadata, calling_fetcher()for each. Records withNonevalue are skipped silently. Output is written to thedata_release/sub-directory undersave_parent_dir.