開発版ドキュメント · 0.2.3 30c2f8ba · 入門例の検証対象 0.2.3 · 版情報 · 既知の制限

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).

メモ

The simpler gwexpy.noise.gwinc_.from_pygwinc helper (strain/DARM only) is preserved unchanged. This module adds the richer trace-expansion API.

Functions

from_gwinc_budget(cls, budget_or_model, *[, ...])

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.

パラメータ:
  • cls (type) -- FrequencySeries or FrequencySeriesDict class to instantiate.

  • budget_or_model (gwinc.Budget or str) -- Pre-loaded Budget object, or a model name string (e.g., "aLIGO", "Aplus") which is passed to gwinc.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:

    • FrequencySeries cls → total noise only.

    • FrequencySeriesDict cls → 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.

戻り値:

  • FrequencySeries -- When trace_name is given, or cls is FrequencySeries.

  • FrequencySeriesDict -- When trace_name is None and cls is FrequencySeriesDict. Keys: "Total", plus sub-trace names.

例外:
  • ValueError -- If trace_name does not exist in the budget trace hierarchy, or if quantity is not "asd" or "psd".

  • ImportError -- If pygwinc is not installed.

サンプル

Load a GWinc budget and convert its total noise PSD to an amplitude spectral density. GWinc's load_budget accepts 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_asd is the total aLIGO detector-noise ASD in 1 / sqrt(Hz) at the requested frequencies.

Passing FrequencySeriesDict instead 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_name to pull a single sub-trace out as one ~gwexpy.frequencyseries.FrequencySeries:

>>> quantum = from_gwinc_budget(
...     FrequencySeries, budget, frequencies=frequencies, trace_name="Quantum"
... )