nilspodlib.dataset.parse_binary#

nilspodlib.dataset.parse_binary(path: path_t, legacy_support: str = 'error', force_version: Optional[Version] = None, tz: Optional[str] = None) Tuple[Dict[str, ndarray], ndarray, Header][source]#

Parse a binary NilsPod session file and read the header and the data.

Parameters:
path

Path to the file

legacy_support

This indicates how to deal with old firmware versions. If error, An error is raised, if an unsupported version is detected. If warn, A warning is raised, but the file is parsed without modification If resolve, A legacy conversion is performed to load old files. If no suitable conversion is found, an error is raised. See the legacy package and the README to learn more about available conversions.

force_version

Instead of relying on the version provided in the session header, the legacy support will be determined based on the version provided here. This is only used, if legacy_support="resolve". This option can be helpful, when testing with development firmware images that don’t have official version numbers.

tz

Optional timezone str of the recording. This can be used to localize the start and end time. Note, this should not be the timezone of your current PC, but the timezone relevant for the specific recording.

Returns:
sensor_data

The sensor data as dictionary

counter

The counter values

session_header

The session header

Raises:
VersionError

If unsupported FirmwareVersion is detected and legacy_error is error

VersionError

If legacy_error is resolve, but no suitable conversion is found.