FrequencySeriesMatrixο
Stability: Stable
What it isο
Use FrequencySeriesMatrix for aligned multi-channel spectra that should be processed together as one matrix.
Representative Signaturesο
FrequencySeriesMatrix(data, frequencies=None, df=None, f0=None, ...)
FrequencySeriesMatrix.to_dict()
Minimal Exampleο
from gwexpy.frequencyseries import FrequencySeriesMatrix
import numpy as np
mat = FrequencySeriesMatrix(np.ones((2, 2, 64)), df=1.0)
out = mat.to_dict()
API Referenceο
The detailed generated API continues below on this page.
Inherits from: FrequencySeriesMatrixCoreMixin, FrequencySeriesMatrixAnalysisMixin, SeriesMatrix
Matrix container for multiple FrequencySeries objects.
Inherits from SeriesMatrix and returns FrequencySeries instances when indexed.
Physical Contextο
Use FrequencySeriesMatrix when multiple spectra are already aligned on one frequency axis and should be processed as one object: sensor arrays, response matrices, coherence-like channel grids, or repeated spectra arranged by configuration.
matrix operations assume shared sampling on the frequency axis
this is the right container when relationships between channels matter as much as the spectra themselves
Common Misreadingsο
treating an unaligned stack of spectra as a valid matrix input
forgetting that matrix-level filtering or inversion is only meaningful when the entries share a common physical frequency grid
interpreting linear-algebra outputs without checking conditioning and units
Where to go nextο
per-element interpretation: FrequencySeries
container conversions: FrequencySeriesList, FrequencySeriesDict
aligned workflow: FrequencySeries Matrix Tutorial
Methodsο
MetaDataMatrixο
Metadata matrix containing per-element metadata.
N_samplesο
Number of samples along the x-axis.
Tο
Transpose of the matrix (rows and columns swapped).
appendο
append(self, other, inplace=True, pad=None, gap=None, resize=True)
Append another matrix along the sample axis.
append_exactο
append_exact(self, other, inplace=False, pad=None, gap=None, tol=3.814697265625e-06)
Append another matrix with strict contiguity checking.
apply_responseο
apply_response(self, response: 'Any', inplace: 'bool' = False) -> 'Any'
Apply a complex frequency response to the matrix.
Extension method (not in GWpy) to support complex filtering/calibration.
Parametersο
response : array-like or Quantity Complex frequency response array aligned with self.frequencies. inplace : bool, optional If True, modify in-place.
astypeο
astype(self, dtype, copy=True)
Cast matrix data to a specified type.
channel_namesο
Flattened list of all element names.
channelsο
2D array of channel identifiers for each matrix element.
col_indexο
col_index(self, key: 'Any') -> 'int'
Get the integer index for a column key.
col_keysο
col_keys(self) -> 'tuple[Any, ...]'
Get the keys (labels) for all columns.
conjο
conj(self)
Complex conjugate of the matrix.
copyο
copy(self, order='C')
Create a deep copy of this matrix.
cropο
crop(self, start=None, end=None, copy=False)
Crop the matrix to a specified range along the sample axis.
detο
det(self)
Compute the determinant of the matrix at each sample point.
dfο
Frequency spacing (dx).
diagonalο
diagonal(self, output: 'str' = 'list')
Extract diagonal elements from the matrix.
dict_classο
dict_class(*args: 'Any', **kwargs: 'Any')
Ordered mapping of FrequencySeries objects keyed by label.
diffο
diff(self, n=1, axis=None)
Calculate the n-th discrete difference along the sample axis.
durationο
Duration covered by the samples.
dxο
Step size between samples on the x-axis.
f0ο
Starting frequency (x0).
filterο
filter(self, *filt: 'Any', **kwargs: 'Any') -> 'Any'
Apply a filter to the FrequencySeriesMatrix.
Matches GWpy FrequencySeries.filter behavior (magnitude-only response) by delegating to gwpy.frequencyseries._fdcommon.fdfilter. Use apply_response() for complex response application.
Parametersο
*filt : filter arguments Filter definition. inplace : bool, optional If True, modify in-place. Default False. **kwargs : Additional arguments passed to fdfilter (e.g. analog=True).
Returnsο
FrequencySeriesMatrix Filtered matrix.
frequenciesο
Frequency array (xindex).
get_indexο
get_index(self, key_row: 'Any', key_col: 'Any') -> 'tuple[int, int]'
Get the (row, col) integer indices for given keys.
ifftο
ifft(self) -> 'Any'
Compute the inverse FFT of this frequency-domain matrix.
Matches GWpy FrequencySeries.ifft normalization.
Returnsο
TimeSeriesMatrix The time-domain matrix resulting from the inverse FFT.
imagο
imag(self)
Imaginary part of the matrix.
interpolateο
interpolate(self, xindex, **kwargs)
Interpolate the matrix to a new sample axis.
invο
inv(self, swap_rowcol: 'bool' = True)
Compute the matrix inverse at each sample point.
is_compatibleο
is_compatible(self, other: 'Any') -> 'bool'
Compatibility check.
is_compatible_exactο
is_compatible_exact(self, other: 'Any') -> 'bool'
Check strict compatibility with another matrix.
is_contiguousο
is_contiguous(self, other: 'Any', tol: 'float' = 3.814697265625e-06) -> 'int'
Check if this matrix is contiguous with another.
is_contiguous_exactο
is_contiguous_exact(self, other: 'Any', tol: 'float' = 3.814697265625e-06) -> 'int'
Check contiguity with strict shape matching.
is_regularο
Return True if this series has a regular grid (constant spacing).
keysο
keys(self) -> 'tuple[tuple[Any, ...], tuple[Any, ...]]'
Get both row and column keys.
list_classο
list_class(*items: 'Union[_FS, Iterable[_FS]]')
List of FrequencySeries objects.
locο
Label-based indexer for direct value access.
maxο
max(self, axis=None, out=None, keepdims=False, initial=None, where=True, ignore_nan=True)
a.max(axis=None, out=None, keepdims=False, initial=
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See Alsoο
numpy.amax : equivalent function
(Inherited from ndarray)
meanο
mean(self, axis=None, dtype=None, out=None, keepdims=False, *, where=True, ignore_nan=True)
a.mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See Alsoο
numpy.mean : equivalent function
(Inherited from ndarray)
medianο
median(self, axis=None, out=None, overwrite_input=False, keepdims=False, ignore_nan=True)
No documentation available.
minο
min(self, axis=None, out=None, keepdims=False, initial=None, where=True, ignore_nan=True)
a.min(axis=None, out=None, keepdims=False, initial=
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See Alsoο
numpy.amin : equivalent function
(Inherited from ndarray)
namesο
2D array of names for each matrix element. Alias for channel_names if 1D.
padο
pad(self, pad_width, **kwargs)
Pad the matrix along the sample axis.
plotο
plot(self, **kwargs: 'Any') -> 'Any'
Plot FrequencySeriesMatrix.
prependο
prepend(self, other, inplace=True, pad=None, gap=None, resize=True)
Prepend another matrix at the beginning along the sample axis.
prepend_exactο
prepend_exact(self, other, inplace=False, pad=None, gap=None, tol=3.814697265625e-06)
Prepend another matrix with strict contiguity checking.
readο
read(source, format=None, **kwargs)
Read a SeriesMatrix from file.
Parametersο
source : str or path-like Path to file to read. format : str, optional File format. If None, inferred from extension. **kwargs Additional arguments passed to the reader.
Returnsο
SeriesMatrix The loaded matrix.
The available built-in formats are:
======== ==== ===== ============= Format Read Write Auto-identify ======== ==== ===== ============= ats Yes No No dttxml Yes No No gbd Yes No No gse2 Yes No No knet Yes No No li Yes No No lsf Yes No No mem Yes No No miniseed Yes No No orf Yes No No sac Yes No No sdb Yes No No sqlite Yes No No sqlite3 Yes No No taffmat Yes No No tdms Yes No No wav Yes No No wdf Yes No No win Yes No No win32 Yes No No wvf Yes No No ======== ==== ===== =============
realο
real(self)
Real part of the matrix.
reshapeο
reshape(self, shape, order='C')
Reshape the matrix dimensions.
rmsο
rms(self, axis=None, keepdims=False, ignore_nan=True)
No documentation available.
row_indexο
row_index(self, key: 'Any') -> 'int'
Get the integer index for a row key.
row_keysο
row_keys(self) -> 'tuple[Any, ...]'
Get the keys (labels) for all rows.
schurο
schur(self, keep_rows, keep_cols=None, eliminate_rows=None, eliminate_cols=None)
Compute the Schur complement of a block matrix.
series_classο
series_class(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.
shape3Dο
Shape of the matrix as a 3-tuple (n_rows, n_cols, n_samples). For 4D matrices (spectrograms), the last dimension is likely frequency, so n_samples is determined by _x_axis_index.
shiftο
shift(self, delta)
Shift the sample axis by a constant offset.
smoothο
smooth(self, width: 'int', method: 'str' = 'amplitude', ignore_nan: 'bool' = True) -> 'Any'
Smooth the frequency series matrix along the frequency axis.
Parametersο
width : int Full width of the smoothing window in samples. method : str, optional Smoothing method: βamplitudeβ, βpowerβ, βcomplexβ, βdbβ. Default is βamplitudeβ. ignore_nan : bool, optional If True, ignore NaNs during smoothing. Default is True.
stdο
std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True, ignore_nan=True)
a.std(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See Alsoο
numpy.std : equivalent function
(Inherited from ndarray)
stepο
step(self, where: 'str' = 'post', **kwargs: 'Any') -> 'Any'
Plot the matrix as a step function.
submatrixο
submatrix(self, row_keys, col_keys)
Extract a submatrix by selecting specific rows and columns.
to_cupyο
to_cupy(self, dtype=None) -> Any
Convert to CuPy Array.
to_daskο
to_dask(self, chunks='auto') -> Any
Convert to Dask Array.
to_dictο
to_dict(self) -> 'Any'
Convert matrix to an appropriate collection dict (e.g. TimeSeriesDict). Follows the matrix structure (row, col) unless itβs a 1-column matrix.
to_dict_flatο
to_dict_flat(self) -> 'dict[str, Series]'
Convert matrix to a flat dictionary mapping name to Series.
to_hdf5ο
to_hdf5(self, filepath, **kwargs)
Write matrix to HDF5 file.
to_jaxο
to_jax(self) -> Any
Convert to JAX Array.
to_listο
to_list(self) -> 'Any'
Convert matrix to an appropriate collection list (e.g. TimeSeriesList).
to_pandasο
to_pandas(self, format='wide')
Convert matrix to a pandas DataFrame.
to_series_1Dlistο
to_series_1Dlist(self) -> 'list[Series]'
Convert matrix to a flat 1D list of Series objects.
to_series_2Dlistο
to_series_2Dlist(self) -> 'list[list[Series]]'
Convert matrix to a 2D nested list of Series objects.
to_tensorflowο
to_tensorflow(self, dtype: Any = None) -> Any
Convert to tensorflow.Tensor.
to_torchο
to_torch(self, device: Optional[str] = None, dtype: Any = None, requires_grad: bool = False, copy: bool = False) -> Any
Convert to torch.Tensor.
to_zarrο
to_zarr(self, store, path=None, **kwargs) -> Any
Save to Zarr storage.
traceο
trace(self)
Compute the trace of the matrix (sum of diagonal elements).
transposeο
transpose(self, *axes)
Transpose rows and columns, preserving sample axis as 2.
unitsο
2D array of units for each matrix element.
updateο
update(self, other, inplace=True, pad=None, gap=None)
Update matrix by appending without resizing (rolling buffer style).
valueο
Underlying numpy array of data values.
value_atο
value_at(self, x)
Get the matrix values at a specific x-axis location.
varο
var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True, ignore_nan=True)
a.var(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See Alsoο
numpy.var : equivalent function
(Inherited from ndarray)
writeο
write(self, target, format=None, **kwargs)
Write matrix to file.
x0ο
Starting value of the sample axis.
xarrayο
Return the sample axis values.
xindexο
Sample axis index array.
xspanο
Full extent of the sample axis as a tuple (start, end).
xunitο
No documentation available.