gwexpy.interop.gwinc_#
Interoperate with pygwinc noise budgets.
Interoperability with pygwinc (gravitational wave interferometer noise budget).
Provides conversion from a gwinc Budget trace hierarchy to GWexpy
FrequencySeries (total noise) or FrequencySeriesDict (all sub-traces).
Notes
The simpler gwexpy.noise.gwinc_.from_pygwinc helper (strain/DARM only) is
preserved unchanged. This module adds the richer trace-expansion API.
Functions
|
Create FrequencySeries or FrequencySeriesDict from a gwinc Budget. |
- gwexpy.interop.gwinc_.from_gwinc_budget(cls: type, budget_or_model: Any, *, frequencies: ndarray | None = None, quantity: Literal['asd', 'psd'] = 'asd', trace_name: str | None = None, fmin: float = 10.0, fmax: float = 4000.0, df: float = 1.0) Any#
Create FrequencySeries or FrequencySeriesDict from a gwinc Budget.
- Parameters:
cls (type) –
FrequencySeriesorFrequencySeriesDictclass to instantiate.budget_or_model (gwinc.Budget or str) – Pre-loaded
Budgetobject, or a model name string (e.g.,"aLIGO","Aplus") which is passed togwinc.load_budget.frequencies (array-like, optional) – Frequency array in Hz. If None, generated from
fmin/fmax/df.quantity ({"asd", "psd"}, default "asd") – Whether to return amplitude or power spectral density.
trace_name (str, optional) –
Name of a specific sub-trace to extract (e.g.,
"Quantum"). If None:FrequencySeriescls → total noise only.FrequencySeriesDictcls → total + all sub-traces.
fmin (float, default 10.0) – Minimum frequency [Hz] when frequencies is not provided.
fmax (float, default 4000.0) – Maximum frequency [Hz] when frequencies is not provided.
df (float, default 1.0) – Frequency step [Hz] when frequencies is not provided.
- Returns:
FrequencySeries – When
trace_nameis given, orclsisFrequencySeries.FrequencySeriesDict – When
trace_nameis None andclsisFrequencySeriesDict. Keys:"Total", plus sub-trace names.
- Raises:
ValueError – If
trace_namedoes not exist in the budget trace hierarchy, or ifquantityis not"asd"or"psd".ImportError – If pygwinc is not installed.
Examples
Load a GWinc budget and convert its total noise PSD to an amplitude spectral density. GWinc’s
load_budgetaccepts a frequency array, and the module-level converter accepts the GWexpy target class explicitly:>>> import gwinc >>> import numpy as np >>> from gwexpy.frequencyseries import FrequencySeries >>> from gwexpy.interop import from_gwinc_budget >>> frequencies = np.array([10.0, 100.0, 1000.0]) >>> budget = gwinc.load_budget("aLIGO", freq=frequencies) >>> total_asd = from_gwinc_budget( ... FrequencySeries, budget, frequencies=frequencies, quantity="asd" ... )
total_asdis the total aLIGO detector-noise ASD in 1 / sqrt(Hz) at the requested frequencies.Passing
FrequencySeriesDictinstead returns the total together with every sub-trace, keyed by"Total"and the gwinc trace names:>>> from gwexpy.frequencyseries import FrequencySeriesDict >>> noise_budget = from_gwinc_budget( ... FrequencySeriesDict, budget, frequencies=frequencies ... )
Use
trace_nameto pull a single sub-trace out as one ~gwexpy.frequencyseries.FrequencySeries:>>> quantum = from_gwinc_budget( ... FrequencySeries, budget, frequencies=frequencies, trace_name="Quantum" ... )