lisa_noise.io.read¶
Read and process LISA TDI data from Mojito L1 HDF5 files.
Functions¶
|
Load, process, and crop a single segment ready for inference. |
|
The taper MojitoProcessor applied, e.g. |
|
The filter and decimation MojitoProcessor applied, with its defaults. |
|
Return the number of processed segments in a Mojito L1 HDF5 file. |
|
Read a single-segment pipeline output file into a |
|
Reconstruct the XYZ noise covariance from a pipeline output file. |
|
The covariance of conditioned data, from the fit of the segment at |
Module Contents¶
- lisa_noise.io.read.load_segment(data_file: str, segment_idx: int, science_band: tuple[float, float])¶
Load, process, and crop a single segment ready for inference.
- Parameters:
data_file (str) – Path to the Mojito L1 HDF5 file.
segment_idx (int) – Index of the segment to extract (
segment0,segment1, …).science_band ((f_min, f_max)) – Frequency band in Hz used to crop the FFT output.
- Returns:
Loaded and science-band-cropped segment ready for model setup.
- Return type:
- lisa_noise.io.read.read_window_kwargs(data_file: str) dict[str, Any] | None¶
The taper MojitoProcessor applied, e.g.
{"window": "tukey", "alpha": 0.025}.Nonewhen the file records no window (/pipeline_params/window).
- lisa_noise.io.read.read_processing_kwargs(data_file: str) dict[str, Any] | None¶
The filter and decimation MojitoProcessor applied, with its defaults.
Nonewhen the file has no/pipeline_paramsgroup. MojitoProcessor does not record the original sampling rate; it is taken from the spacing of the light travel times, which are stored at the Level-1 rate.- Returns:
fs_in,fs_out,filter(highpass_cutoff,lowpass_cutoff,order),downsample(target_fs,kaiser_window;Noneat the native rate) andzero_phase.- Return type:
dict
- lisa_noise.io.read.count_segments(data_file: str) int¶
Return the number of processed segments in a Mojito L1 HDF5 file.
Counts the
/processed/segment*groups directly without reconstructing any segment, so it is cheap enough to call at submit time.- Parameters:
data_file (str) – Path to the Mojito L1 HDF5 file.
- Returns:
Number of segments available in the file.
- Return type:
int
- lisa_noise.io.read.read_inference_result(path: str) lisa_noise.types.PipelineResult¶
Read a single-segment pipeline output file into a
PipelineResult.Inverse of
lisa_noise.io.write.write_inference_result().
- lisa_noise.io.read.get_XYZ_inst_cov(path: str, frequency: numpy.ndarray, time: float) numpy.ndarray¶
Reconstruct the XYZ noise covariance from a pipeline output file.
Reads a combined (collected) output file, selects the segment that contains
time(else the one with the nearest midpoint), and rebuilds the covariance from the best-fit parameters using whichever model was fit (recorded in the file).- Parameters:
path (str) – Path to a combined HDF5 file written by
lisa_noise.io.write.collect_segments()(one group per segment).frequency ((Nf,) ndarray) – Frequency grid in Hz at which to evaluate the covariance.
time (float) – Requested TCB epoch in seconds. The segment containing it is used, or, if none does, the one whose midpoint is nearest.
- Returns:
XYZ noise covariance: auto-PSDs on the diagonal, CSDs off-diagonal.
- Return type:
(Nf, 3, 3) complex ndarray
- lisa_noise.io.read.get_XYZ_cov(path: str, time: float, data_file: str | None = None, segment: int | None = None) tuple[numpy.ndarray, numpy.ndarray]¶
The covariance of conditioned data, from the fit of the segment at
time.Where
get_XYZ_inst_cov()returns the instrument covarianceC(f)on any frequency grid, this returns a data model,C_data = k * (R C + A): the filter response, the aliased power and the taper convolution of a conditioning, applied to the fitted spectra. Withoutdata_fileit is the model the segment was fitted with, i.e. the covariance of the tapered segment in the processed file the fit was made on, and it lives on that segment’s own DFT grid, which is returned with it. Withdata_fileandsegmentit is the covariance of that segment of another processed file, rebuilt from its own light travel times, conditioning record and window (lisa_noise.modelled.from_result.data_model_from_result()), which is how an analysis that conditions its own data obtains the covariance of what it analyses. In both cases the signal templates of the analysis must be passed through the same conditioning.- Parameters:
path (str) – Path to a combined HDF5 file written by
lisa_noise.io.write.collect_segments().time (float) – Requested TCB epoch in seconds. The fit of the segment containing it is used, or, if none does, of the one whose midpoint is nearest.
data_file (str, optional) – Another processed (MojitoProcessor) file to condition the fit for.
segment (int, optional) – The segment of
data_fileto use; required withdata_file.
- Returns:
freq ((Nf,) ndarray) – The science-band slice of
np.fft.rfftfreq(N, delta_t)of the segment.cov ((Nf, 3, 3) complex ndarray) –
C_dataat those frequencies, in the convention ofget_XYZ_inst_cov.