SpectroFile#
- class osekit.core_api.spectro_file.SpectroFile(path: PathLike | str, begin: Timestamp | None = None, strptime_format: str | list[str] | None = None, timezone: str | pytz.timezone | None = None)#
Spectro file associated with timestamps.
Spectro files are
npzfiles withTimeandSxxarrays. Metadata (time_resolution) are stored as separate arrays.Initialize a
SpectroFileobject from apathand begin timestamp.The begin timestamp can either be provided as a parameter or parsed from the filename according to the provided
strptime_format.Parameters#
- path: PathLike | str
Full path to the file.
- begin: pandas.Timestamp | None
Timestamp corresponding to the first data bin in the file. If it is not provided,
strptime_formatis mandatory. If bothbeginandstrptime_formatare provided,beginwill overrule the timestamp embedded in the filename.- strptime_format: str | None
The strptime format used in the text. It should use valid strftime codes (https://strftime.org/). Example:
'%y%m%d_%H:%M:%S'.- timezone: str | pytz.timezone | None
The timezone in which the file should be localized. If
None, the file begin/end will be tz-naive. If different from a timezone parsed from the filename, the timestamps’ timezone will be converted from the parsed timezone to the specified timezone.
- get_fft() ShortTimeFFT#
Return the
ShortTimeFFTused for computing the spectrogram.Returns#
- ShortTimeFFT:
The
ShortTimeFFTused for computing the spectrogram. It is instantiated back from the parameters stored in thenpzfile.
- read(start: Timestamp, stop: Timestamp) ndarray#
Return the spectro data between
startandstopfrom the file.The data is a 2D array representing the
sxxvalues of the spectrogram.Parameters#
- start: pandas.Timestamp
Timestamp corresponding to the first time bin to read.
- stop: pandas.Timestamp
Timestamp after the last time bin to read.
Returns#
- numpy.ndarray:
The spectrogram data between
startandstop.