BaseFile#
- class osekit.core_api.base_file.BaseFile(path: PathLike | str, begin: Timestamp | None = None, end: Timestamp | None = None, strptime_format: str | list[str] | None = None, timezone: str | pytz.timezone | None = None)#
Base class for the File objects.
A File object associates file-written data to timestamps.
Initialize a File object with a path and timestamps.
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 point in the file. If it is not provided,
strptime_formatis mandatory. If bothbeginandstrptime_formatare provided,beginwill overrule the timestamp embedded in the filename.- end: pandas.Timestamp | None
(Optional) timestamp after the last data point in the file.
- 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.
- classmethod from_dict(serialized: dict) type[Self]#
Return a File object from a dictionary.
Parameters#
- serialized: dict
The serialized dictionary representing the File.
Returns#
- BaseFile:
The deserialized File object.
- move(folder: Path) None#
Move the file to the target folder.
Parameters#
- folder: Path
destination folder where the file will be moved.
- abstractmethod read(start: Timestamp, stop: Timestamp) np.ndarray#
Return the data that is between
startandstopfrom the file.This is an abstract method and should be overridden with actual implementations.
Parameters#
- start: pandas.Timestamp
Timestamp corresponding to the first data point to read.
- stop: pandas.Timestamp
Timestamp after the last data point to read.
Returns#
The data between
startandstop.