Data / Residual / Signal Container
- class lisatools.datacontainer.DataResidualArray(data_res_in: List[ndarray] | ndarray | DataResidualArray, dt: float | None = None, f_arr: ndarray | None = None, df: float | None = None, **kwargs: dict)
Bases:
object
Container to hold Data, residual, or template information.
This class abstracts the connection with the sensitivity matrices to make this analysis as generic as possible for the user frontend, while handling special computations in the backend.
- Parameters:
data_res_in – Data, residual, or template input information. Can be a list, numpy array or another
DataResidualArray
.dt – Timestep in seconds.
f_arr – Frequency array.
df – Delta f in frequency domain.
**kwargs – For future compatibility.
- property init_kwargs: dict
Initial dt, df, f_arr
- property fmax
Maximum frequency.
- property f_arr
Frequency array.
- property dt
Time step in seconds.
- property Tobs
Observation time in seconds
- property df
Delta f in the frequency domain.
- property frequency_arr: ndarray
Frequency array
- property data_res_arr: ndarray
Actual data residual array
- property ndim: int
Number of dimensions in the data_res_arr.
- flatten() ndarray
Flatten the
data_res_arr
.
- property shape: tuple
Shape of
data_res_arr
.
- loglog(ax: List[Axes] | Axes | None = None, fig: Figure | None = None, inds: List[int] | int | None = None, char_strain: bool | None = False, **kwargs: dict) Tuple[Figure, Axes]
Produce a log-log plot of the data.
- Parameters:
ax – Matplotlib Axes objects to add plots. Either a list of Axes objects or a single Axes object.
fig – Matplotlib figure object.
inds – Integer index to select out which data to add to a single access. A list can be provided if ax is a list. They must be the same length.
char_strain – If
True
return plot in characteristic strain representation.**kwargs – Keyword arguments to be passed to
loglog
function in matplotlib.
- Returns:
Matplotlib figure and axes objects in a 2-tuple.
- property char_strain: ndarray
Characteristic strain representation of the data.
Analysis Container
- class lisatools.analysiscontainer.AnalysisContainer(data_res_arr: DataResidualArray, sens_mat: SensitivityMatrix, signal_gen: callable | None = None)
Bases:
object
Combinatorial container that combines sensitivity and data information.
- Parameters:
data_res_arr – Data / Residual / Signal array.
sens_mat – Sensitivity information.
signal_gen – Callable object that takes information through
*args
and**kwargs
and generates a signal in the proper channel setup employed indata_res_arr
andsens_mat
.
- property data_res_arr: DataResidualArray
Data information.
- property sens_mat: SensitivityMatrix
Sensitivity information.
- property signal_gen: callable
Signal generator.
- loglog() Tuple[Figure, Axes]
Produce loglog plot of both source and sensitivity information.
- Returns:
Matplotlib figure and axes object in a 2-tuple.
- inner_product(**kwargs: dict) float | complex
Return the inner product of the current set of information
- Parameters:
**kwargs – Inner product keyword arguments.
- Returns:
Inner product value.
- snr(**kwargs: dict) float
Return the SNR of the current set of information
- Parameters:
**kwargs – Inner product keyword arguments.
- Returns:
SNR value.
- template_inner_product(template: DataResidualArray, **kwargs: dict) float | complex
Calculate the inner product of a template with the data.
- Parameters:
template – Template signal.
**kwargs – Keyword arguments to pass to
lisatools.diagnostic.inner_product()
.
- Returns:
Inner product value.
- template_snr(template: DataResidualArray, phase_maximize: bool = False, **kwargs: dict) Tuple[float, float]
Calculate the SNR of a template, both optimal and detected.
- Parameters:
template – Template signal.
phase_maximize – If
True
, maximize over an overall phase.**kwargs – Keyword arguments to pass to
lisatools.diagnostic.inner_product()
.
- Returns:
(optimal snr, detected snr)
.
- template_likelihood(template: DataResidualArray, include_psd_info: bool = False, phase_maximize: bool = False, **kwargs: dict) float
Calculate the Likelihood of a template against the data.
- Parameters:
template – Template signal.
include_psd_info – If
True
, add the PSD term to the Likelihood value.phase_maximize – If
True
, maximize over an overall phase.**kwargs – Keyword arguments to pass to
lisatools.diagnostic.inner_product()
.
- Returns:
Likelihood value.
- likelihood(source_only: bool = False, noise_only: bool = False, **kwargs: dict) float | complex
Return the likelihood of the current arangement.
- Parameters:
source_only – If
True
return the source-only Likelihood.noise_only – If
True
, return the noise part of the Likelihood alone.**kwargs – Keyword arguments to pass to
lisatools.diagnostic.inner_product()
.
- Returns:
Likelihood value.
- calculate_signal_likelihood(*args: Any, source_only: bool = False, waveform_kwargs: dict | None = {}, data_res_arr_kwargs: dict | None = {}, **kwargs: dict) float | complex
Return the likelihood of a generated signal with the data.
- Parameters:
params – Arguments to waveform generating function. Must include parameters.
source_only – If
True
return the source-only Likelihood (leave out noise part).waveform_kwargs – Keyword arguments to pass to waveform generator.
data_res_arr_kwargs – Keyword arguments for instantiation of
DataResidualArray
. This can be used if any transforms are desired prior to the Likelihood computation.**kwargs – Keyword arguments to pass to
lisatools.diagnostic.inner_product()
- Returns:
Likelihood value.
- calculate_signal_inner_product(*args: Any, source_only: bool = False, waveform_kwargs: dict | None = {}, data_res_arr_kwargs: dict | None = {}, **kwargs: dict) float | complex
Return the inner product of a generated signal with the data.
- Parameters:
*args – Arguments to waveform generating function. Must include parameters.
source_only – If
True
return the source-only Likelihood (leave out noise part).waveform_kwargs – Keyword arguments to pass to waveform generator.
data_res_arr_kwargs – Keyword arguments for instantiation of
DataResidualArray
. This can be used if any transforms are desired prior to the Likelihood computation.**kwargs – Keyword arguments to pass to
lisatools.diagnostic.inner_product()
- Returns:
Inner product value.
- calculate_signal_snr(*args: Any, source_only: bool = False, waveform_kwargs: dict | None = {}, data_res_arr_kwargs: dict | None = {}, **kwargs: dict) Tuple[float, float]
Return the SNR of a generated signal with the data.
- Parameters:
*args – Arguments to waveform generating function. Must include parameters.
source_only – If
True
return the source-only Likelihood (leave out noise part).waveform_kwargs – Keyword arguments to pass to waveform generator.
data_res_arr_kwargs – Keyword arguments for instantiation of
DataResidualArray
. This can be used if any transforms are desired prior to the Likelihood computation.**kwargs – Keyword arguments to pass to
lisatools.diagnostic.inner_product()
- Returns:
Snr values (optimal, detected).
- eryn_likelihood_function(x: ndarray | list | tuple, *args: Any, **kwargs: Any) ndarray | float
Likelihood function for Eryn sampler.
This function is not vectorized.
signal_gen
must be set to use this function.- Parameters:
x – Parameters. Can be 1D list, tuple, array or 2D array. If a 2D array is input, the computation is done serially.
*args – Likelihood args.
**kwargs – Likelihood kwargs.
- Returns:
Likelihood value(s).