BifrequencyMapο
Stability: Stable
What it isο
Use BifrequencyMap to represent couplings between an input frequency axis and an output frequency axis.
Representative Signaturesο
BifrequencyMap.from_points(data, f2, f1, **kwargs)
BifrequencyMap.propagate(input_spectrum, interpolate=True)
Minimal Exampleο
from gwexpy.types import BifrequencyMap
import numpy as np
map2d = BifrequencyMap.from_points(np.ones((8, 8)), f2=np.arange(8), f1=np.arange(8))
out = map2d.diagonal()
API Referenceο
The detailed generated API continues below on this page.
Inherits from: FrequencySeriesMatrix
Map representing the relationship between two frequency axes (Frequency 1 -> Frequency 2).
Typically used to represent transfer functions, coupling functions, or scattering matrices where energy is transferred from an input frequency (frequency1) to an output frequency (frequency2).
Componentsο
Frequency 1 (
frequency1): The input or source frequency axis (columns).Frequency 2 (
frequency2): The output or target frequency axis (rows).Value: The coupling strength or transfer function scalar at each (f2, f1) point.
Methodsο
from_pointsο
from_points(cls, data, f2, f1, **kwargs)
Create a BifrequencyMap from a 2D array and two frequency axes.
Parametersο
data : array-like 2D array of shape (len(f2), len(f1)). f2 : array-like Frequency axis 2 (rows, output). f1 : array-like Frequency axis 1 (columns, input). **kwargs Additional arguments passed to the constructor (name, unit, etc.).
Returnsο
BifrequencyMap
propagateο
propagate(self, input_spectrum, interpolate=True, fill_value=0)
Propagate an input spectrum through the map to calculate the output spectrum. Performs a matrix multiplication: \(S_{\text{out}} = M \cdot S_{\text{in}}\).
Parametersο
input_spectrum : FrequencySeries
The input spectrum \(S_{\text{in}}(f_1)\).
interpolate : bool, optional
If True, interpolates the input spectrum to match the mapβs frequency1 axis.
fill_value : float, optional
Value to use for interpolation outside the range.
Returnsο
FrequencySeries
The projected output spectrum \(S_{\text{out}}(f_2)\).
convoluteο
convolute(self, input_spectrum, interpolate=True, fill_value=0)
Convolutes the map with an input spectrum (integration along f1). Calculates: \(S_{\text{out}}(f_2) = \int M(f_2, f_1) S_{\text{in}}(f_1) df_1\)
Parametersο
input_spectrum : FrequencySeries
Input spectrum.
interpolate : bool, optional
If True, interpolates input spectrum.
Returnsο
FrequencySeries
Output spectrum with units adjusted by frequency integration.
diagonalο
diagonal(self, method='mean', bins=None, absolute=False, **kwargs)
Calculates statistics along the diagonal axis (\(f_2 - f_1\)).
Parametersο
method : str, optional
Statistical method: βmeanβ, βmedianβ, βmaxβ, βminβ, βstdβ, βrmsβ, βpercentileβ.
Ignores NaNs by default.
bins : int or array-like, optional
Number of bins. If None, automatically determined from resolution.
absolute : bool, optional
If True, calculates statistics along \(|f_2 - f_1|\).
**kwargs
Additional arguments (e.g., percentile value).
Returnsο
FrequencySeries
The statistic as a function of frequency difference.
get_sliceο
get_slice(self, at, axis='f1', xaxis='remaining')
Extracts a slice of the map at a specific frequency.
Parametersο
at : float Frequency value to extract. axis : str, optional Axis to fix: βf1β or βf2β. xaxis : str, optional Definition of the x-axis for the result: βremainingβ, βdiffβ, βabs_diffβ, etc.
Returnsο
FrequencySeries
The extracted 1D slice.
plotο
plot(self, **kwargs)
Plot the map as a 2D image (spectrogram-like).
plot_linesο
plot_lines(self, xaxis='f1', color='f2', num_lines=None, ax=None, cmap=None, **kwargs)
Plot the map as a set of 1D lines.
Parametersο
xaxis : str, optional X-axis for lines: βf1β, βf2β, βdiffβ, etc. color : str, optional Parameter for coloring/slicing: βf1β, βf2β. num_lines : int, optional Max number of lines to plot. ax : matplotlib Axes, optional Axes to plot on. cmap : colormap, optional Colormap for lines.
Returnsο
matplotlib Axes