pydpeet.convert#
- pydpeet.convert(config=None, input_path=None, output_path=None, keep_all_additional_data=False, custom_folder_path=None)[source]#
Convert battery test data into the unified PyDPEET format.
This is the main high-level import function of PyDPEET. The function automatically detects whether the provided input path points to a file, a directory, or a list of files/directories and converts the contained battery test data into the unified PyDPEET dataframe format.
Depending on the provided input, the function either returns a single dataframe or a list of dataframes.
The conversion itself is performed using the selected device configuration.
- Parameters:
config (ConfigLike, optional) –
Device configuration used for parsing and mapping the raw battery test data into the unified PyDPEET format.
This can either be:
a predefined PyDPEET configuration
a custom configuration object
a configuration dictionary
If
None(default), the filetype is auto-detected from the file extension and each matching configuration is tried until one succeeds.input_path (str | list[str]) –
Path to the input data.
Supported inputs are:
path to a single raw data file
path to a directory containing raw data files
list of file and/or directory paths
output_path (str, optional) – If provided, the converted data is written to this directory. When
None(default), the converted DataFrames are returned.keep_all_additional_data (bool, default=False) –
If
True, all additional columns that are not part of the unified PyDPEET format are preserved in the returned dataframe.If
False, only standardized PyDPEET columns are kept.custom_folder_path (str | None, default=None) –
Optional custom folder path used by specific device configurations that require additional external metadata or lookup files.
If provided, the builtin filetype blacklist and unknown filetype checks are bypassed (a warning is logged), so custom reader/mapper/formatter implementations can be used without being rejected.
- Returns:
Converted dataframe(s) in the unified PyDPEET format.
If a single file is provided, a single dataframe is returned.
If a directory or list of paths is provided, a list of dataframes is returned.
If
output_pathis provided,Noneis returned after writing.
- Return type:
- Raises:
ValueError – Raised if: - the provided input path does not exist - an input path has an invalid type - a list contains unsupported entries - an explicitly provided file has a blacklisted filetype - an explicitly provided file has a filetype that is neither blacklisted nor supported yet
Notes
The returned dataframe follows the standardized PyDPEET format contains following columns, when available in the raw data and depending on the selected device configuration:
Date_TimeTest_Time[s]Voltage[V]Current[A]Step_CountTemperature[°C]EIS_f[Hz]EIS_Z_Real[Ohm]EIS_Z_Imag[Ohm]
depending on the available raw data and the selected device configuration.
Examples
- More Usage Examples can be found in following tutorial notebooks:
Tutorial 01: Convert and Import
Read a single file:
>>> import pydpeet as eet >>> df = eet.read( ... config="neware_8_0_0_516", ... input_path="measurement.csv", ... )
Read all files in a directory:
>>> df = eet.read( ... config="neware_8_0_0_516", ... input_path="data/", ... )
Read multiple files and directories:
>>> dfs = eet.read( ... config="neware_8_0_0_516", ... input_path=[ ... "measurement_01.csv", ... "measurement_02.csv", ... "folder_with_measurements/", ... ], ... )
Keep additional raw columns:
>>> df = eet.read( ... config="neware_8_0_0_516", ... input_path="measurement.csv", ... keep_all_additional_data=True, ... )
See also
convertLower-level conversion interface.
writeExport unified PyDPEET dataframes.
merge_into_seriesMerge multiple datasets into a continuous series.