Command-line interface¶
The distribution installs a console script gwmock-signal (defined in
pyproject.toml). Import name for the library remains gwmock_signal
(underscore).
Global options¶
gwmock-signal --help
gwmock-signal -v DEBUG # or: --verbose DEBUG
-v / --verbose sets the log level for the gwmock_signal logger (Rich
handler on stderr). Subcommands inherit this after the callback runs.
inject cbc — CBC into zero-noise segments¶
End-to-end helper: load CBC parameters from JSON, build a zero-noise background
centred on coa_time, run the same pipeline as
inject_cbc_signal, then either write HDF5 or print a short
per-detector RMS summary.
gwmock-signal inject cbc --help
Parameters file (--params)¶
The JSON object must include every required CBC key understood by
CBCSimulator (gwmock-pop canonical names). At minimum:
| Key | Meaning |
|---|---|
detector_frame_mass_1 |
Primary mass in the detector frame (solar masses) |
detector_frame_mass_2 |
Secondary mass in the detector frame (solar masses) |
coa_time |
Coalescence GPS time (seconds) — also used to centre the background segment |
distance |
Luminosity distance (Megaparsec) |
inclination |
Inclination angle (radians) |
right_ascension |
Right ascension (radians) |
declination |
Declination (radians) |
polarization_angle |
Polarization angle ψ (radians) |
Additional keys (for example spin_1z, spin_2z, coa_phase) are passed to
the waveform backend. The default backend is --backend lal where lalsuite
is installed; where it is not it is --backend ripple if the jax extra is
installed, and otherwise the command stops with an error saying how to install
either; the LAL implementation accepts only the parameters documented for LAL
time-domain generation (unknown keys error). --backend pycbc forwards
extras like PyCBC’s get_td_waveform. --backend ripple (JAX; requires
gwmock-signal[jax]) supports a fixed set of approximants and converts ripple’s
frequency-domain output to the time domain on CPU — see
Waveforms.
Minimal example file cbc.json:
{
"detector_frame_mass_1": 36.0,
"detector_frame_mass_2": 29.0,
"coa_time": 1126259462.4,
"distance": 410.0,
"inclination": 0.0,
"right_ascension": 1.375,
"declination": -1.211,
"polarization_angle": 0.0
}
Network (--network)¶
The value is resolved in order:
- If it is an existing path, or ends with
.yaml,.yml, or.json, it is passed toNetwork.from_file(detector network definition file). - Otherwise it is treated as a named preset (for example
H1L1V1) viaNetwork.from_name. - If that fails, it is split on commas and interpreted as PyCBC detector codes
(for example
H1,L1,V1).
Bundled named presets include:
| Preset | Detectors |
|---|---|
H1L1, H1L1V1, HLVK |
Built-in LAL detector-code groups |
ET-triangle, ET-L |
Built-in LAL detector-code groups |
ET-Triangle-Sardinia |
ET1_SARD, ET2_SARD, ET3_SARD |
ET-Sardinia (alias) |
Same as ET-Triangle-Sardinia |
ET-Triangle-EMR |
ET1_EMR, ET2_EMR, ET3_EMR |
ET-EMR (alias) |
Same as ET-Triangle-EMR |
ET-2L-Aligned |
ET1_2L_ALIGNED_SARD, ET2_2L_ALIGNED_EMR |
ET-2L-Misaligned |
ET1_2L_MISALIGNED_SARD, ET2_2L_MISALIGNED_EMR |
Output (--output)¶
- If
--outputis set: strains are written as HDF5 in GWpy'sTimeSeriesDictlayout (one dataset per detector), soTimeSeriesDict.readandgwmock_signal.io.read_hdf5load them. No extra is needed; withh5pyinstalled (the[hdf5]extra) it is used and compresses. - If omitted: one line per detector is printed to stdout showing RMS strain and duration. Example output:
H1 rms=1.2345e-21 duration=16.0s
L1 rms=1.1132e-21 duration=16.0s
V1 rms=8.7621e-22 duration=16.0s
Other flags¶
| Flag | Default | Role |
|---|---|---|
--sample-rate |
4096 | Sample rate (Hz) of the synthetic background (integer) |
--f-min |
20 | Low-frequency cutoff (Hz) for waveform generation |
--duration |
16 | Length (seconds) of zero background; centred on coa_time |
--approximant |
IMRPhenomD | Time-domain approximant string for the active --backend |
--backend |
(auto) | Waveform engine: lal, gwsignal, pycbc or ripple; by default lal where lalsuite is installed, otherwise ripple if the jax extra is installed, otherwise an error naming both |
--seed |
(none) | Optional integer seed passed to numpy.random.seed |
--earth-rotation / --no-earth-rotation |
true | Time-dependent antenna patterns and delays (disable for short waveforms) |
--finite-arm-length / --no-finite-arm-length |
true | Each arm responds to the strain averaged along the light's round trip, not at the vertex |
--source-precession / --no-source-precession |
true | Precess the J2000 source direction to the epoch of date; off is LAL's, Bilby's and PyCBC's convention for transients |
--roemer-delay / --no-roemer-delay |
true | The Earth's orbital light-travel delay, beyond its value and rate at coalescence |
--einstein-delay / --no-einstein-delay |
true | TDB minus TT, beyond its value and rate at coalescence |
--shapiro-delay / --no-shapiro-delay |
true | The Sun's gravitational delay, beyond its value and rate at coalescence |
--interpolate-if-offset / --no-interpolate-if-offset |
true | Enable sinc resampling when injection is off-grid |
Example¶
gwmock-signal inject cbc --params cbc.json --network H1L1V1 --output injected.h5
Python vs CLI¶
Use the CLI for quick checks and scripted runs from the shell. Use the
Python API when you already have time series data, custom backgrounds, or
need inject_cbc_signal / CBCSimulator options such as a custom ephemeris or
interpolate_if_offset tuning beyond the boolean CLI flags (see
Pipeline API and
Simulator API).
See also¶
- Installation — environment and
uvusage - Strain injection examples — library-first injection patterns
- API overview