FrequencySeriesDict๏ƒ

Stability: Stable

What it is๏ƒ

Use FrequencySeriesDict to manage multiple FrequencySeries objects as a labeled collection with batch operations and conversion helpers.

Representative Signatures๏ƒ

FrequencySeriesDict(data: dict[str, FrequencySeries])
FrequencySeriesDict.to_matrix()

Minimal Example๏ƒ

from gwexpy.frequencyseries import FrequencySeries, FrequencySeriesDict
import numpy as np

dct = FrequencySeriesDict({
    "A": FrequencySeries(np.ones(64), df=1.0),
    "B": FrequencySeries(np.ones(64), df=1.0),
})
mat = dct.to_matrix()

API Reference๏ƒ

The detailed generated API continues below on this page.

Inherits from: FrequencySeriesBaseDict

Ordered mapping of FrequencySeries objects keyed by label.

Physical Context๏ƒ

Use FrequencySeriesDict when the label itself matters physically: channel name, sensor location, configuration tag, or processing branch.

  • unlike a list, the key is part of the analysis record

  • this is useful for multi-sensor comparisons where losing the label would make the spectrum hard to interpret

Common Misreadings๏ƒ

  1. assuming dictionary keys imply identical calibration or alignment

  2. using sanitized file-output keys as though they were the original physical channel names

  3. comparing spectra by key only, without checking units and frequency spacing

Where to go next๏ƒ

Methods๏ƒ

__init__๏ƒ

__init__(self, *args: 'Any', **kwargs: 'Any')

Initialize self. See help(type(self)) for accurate signature.

(Inherited from OrderedDict)

EntryClass๏ƒ

EntryClass(data, unit=None, f0=None, df=None, frequencies=None, name=None, epoch=None, channel=None, **kwargs)

Light wrapper of gwpyโ€™s FrequencySeries for compatibility and future extension.

angle๏ƒ

angle(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Alias for phase(). Returns a new FrequencySeriesDict.

append๏ƒ

append(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Append to each FrequencySeries in the dict (in-place). Returns self.

apply_response๏ƒ

apply_response(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Apply response to each FrequencySeries. Returns a new FrequencySeriesDict.

copy๏ƒ

copy(self) -> "'FrequencySeriesBaseDict[_FS]'"

od.copy() -> a shallow copy of od

(Inherited from OrderedDict)

crop๏ƒ

crop(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Crop each FrequencySeries in the dict. In-place operation (GWpy-compatible). Returns self.

degree๏ƒ

degree(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Compute phase (in degrees) of each FrequencySeries. Returns a new FrequencySeriesDict.

differentiate_time๏ƒ

differentiate_time(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Apply time differentiation to each item. Returns a new FrequencySeriesDict.

filter๏ƒ

filter(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Apply filter to each FrequencySeries. Returns a new FrequencySeriesDict.

group_delay๏ƒ

group_delay(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Compute group delay of each item. Returns a new FrequencySeriesDict.

ifft๏ƒ

ifft(self, *args, **kwargs)

Compute IFFT of each FrequencySeries. Returns a TimeSeriesDict.

integrate_time๏ƒ

integrate_time(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Apply time integration to each item. Returns a new FrequencySeriesDict.

interpolate๏ƒ

interpolate(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Interpolate each FrequencySeries in the dict. Returns a new FrequencySeriesDict.

pad๏ƒ

pad(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Pad each FrequencySeries in the dict. Returns a new FrequencySeriesDict.

phase๏ƒ

phase(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Compute phase of each FrequencySeries. Returns a new FrequencySeriesDict.

plot๏ƒ

plot(self, label: 'str' = 'key', method: 'str' = 'plot', figsize: 'Optional[Any]' = None, **kwargs: 'Any')

Plot data.

Parameters๏ƒ

label : str, optional labelling method, one of

- ``'key'``: use dictionary key (default)
- ``'name'``: use ``name`` attribute of each item

method : str, optional method of :class:~gwpy.plot.Plot to call, default: 'plot' figsize : tuple, optional (width, height) tuple in inches **kwargs other keyword arguments passed to the plot method

plot_all๏ƒ

plot_all(self, *args: 'Any', **kwargs: 'Any')

Alias for plot(). Plots all series in the dict.

prepend๏ƒ

prepend(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Prepend to each FrequencySeries in the dict (in-place). Returns self.

read๏ƒ

read(source, *args, **kwargs)

No documentation available.

setdefault๏ƒ

setdefault(self, key: 'str', default: 'Optional[_FS]' = None) -> '_FS'

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

(Inherited from OrderedDict)

smooth๏ƒ

smooth(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Smooth each FrequencySeries. Returns a new FrequencySeriesDict.

span๏ƒ

Frequency extent across all elements (based on xspan).

to_control_frd๏ƒ

to_control_frd(self, *args, **kwargs) -> 'dict'

Convert each item to control.FRD. Returns a dict of FRD objects.

to_cupy๏ƒ

to_cupy(self, *args, **kwargs) -> 'dict'

Convert each item to cupy.ndarray. Returns a dict of Arrays.

to_db๏ƒ

to_db(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Convert each FrequencySeries to dB. Returns a new FrequencySeriesDict.

to_jax๏ƒ

to_jax(self, *args, **kwargs) -> 'dict'

Convert each item to jax.Array. Returns a dict of Arrays.

to_matrix๏ƒ

to_matrix(self)

Convert this FrequencySeriesDict to a FrequencySeriesMatrix (Nx1).

to_pandas๏ƒ

to_pandas(self, **kwargs)

Convert to pandas.DataFrame. Keys become columns.

to_tensorflow๏ƒ

to_tensorflow(self, *args, **kwargs) -> 'dict'

Convert each item to tensorflow.Tensor. Returns a dict of Tensors.

to_tmultigraph๏ƒ

to_tmultigraph(self, name: 'Optional[str]' = None) -> 'Any'

Convert to ROOT TMultiGraph.

to_torch๏ƒ

to_torch(self, *args, **kwargs) -> 'dict'

Convert each item to torch.Tensor. Returns a dict of Tensors.

to_xarray๏ƒ

to_xarray(self)

Convert to xarray.Dataset. Keys become data variables.

write๏ƒ

write(self, target: 'str', *args: 'Any', **kwargs: 'Any') -> 'Any'

Write dict to file (HDF5, ROOT, etc.).

For HDF5 output you can choose a layout (default is GWpy-compatible dataset-per-entry).

fsd.write("out.h5", format="hdf5")               # GWpy-compatible (default)
fsd.write("out.h5", format="hdf5", layout="group")  # legacy group-per-entry

HDF5 dataset names (for GWpy path=):

  • Keys are sanitized to be HDF5-friendly (e.g. H1:ASD -> H1_ASD).

  • If multiple keys sanitize to the same name, a suffix like __1 is added.

  • The original keys are stored in file attributes, and gwexpy restores them on read.

Warning

Never unpickle data from untrusted sources. pickle/shelve can execute arbitrary code on load.

Pickle portability note: pickled gwexpy FrequencySeriesDict unpickles as a built-in dict of GWpy FrequencySeries (gwexpy not required on the loading side).

zpk๏ƒ

zpk(self, *args, **kwargs) -> "'FrequencySeriesDict'"

Apply ZPK filter to each FrequencySeries. Returns a new FrequencySeriesDict.