pyprobe.cyclers.column_maps#
A module of classes to map cycler columns to PyProBE columns.
Classes
|
A template mapping for calculating capacity from charge and discharge columns. |
|
A template mapping for calculating capacity from current and time columns. |
|
A template mapping for simple column renaming. |
|
A class to map cycler columns to PyProBE columns. |
|
A template mapping for converting temperature units. |
|
A template mapping for converting units. |
|
A template mapping for datetime columns. |
|
A template mapping for calculating step from categorical columns. |
|
A template mapping for extracting time from a date column. |
- class ColumnMap(pyprobe_name, required_cycler_cols)#
Bases:
ABCA class to map cycler columns to PyProBE columns.
- Parameters:
pyprobe_name (str)
required_cycler_cols (list[str])
- abstract property expr: Expr#
Get the polars expression for the column mapping.
- get(column)#
Get a column from a cycler DataFrame using the keys in required_cycler_cols.
- Parameters:
column (str) – The column name, as given in required_cycler_cols.
- Returns:
A polars expression for the column in the cycler data.
- Return type:
Expr
- property cycler_col: str#
Get the single cycler column name, if only one is required.
- match_columns(available_columns, required_patterns)#
Find columns that match the required patterns, handling wildcards.
- Parameters:
available_columns (list[str]) – List of actual column names in the data
required_patterns (list[str]) – List of required column patterns with * wildcards
- Returns:
- Nested mapping of pattern to column details:
- pattern -> {
“Cycler name”: full column name, “Cycler unit”: extracted unit (if pattern contains *)
}
- Return type:
dict[str, dict[str, str]]
- validate(columns)#
Validate the column mapping.
This method checks if the required columns are present in the cycler data. It fills the attribute
column_mapwith the name of the columns in the cycler data that match the required patterns and the extracted units. It also sets the attributecolumns_validatedto True if all required columns are present.- Parameters:
columns (list[str]) – The list of columns in the cycler data.
- Return type:
None
- class CastAndRenameMap(pyprobe_name, required_cycler_col, data_type)#
Bases:
ColumnMapA template mapping for simple column renaming.
- Parameters:
pyprobe_name (str) – The name of the PyProBE column.
required_cycler_col (str) – The name of the required cycler column.
data_type (DataType)
- property expr: Expr#
Get the polars expression for the column mapping.
- class DateTimeMap(required_cycler_col, datetime_format)#
Bases:
ColumnMapA template mapping for datetime columns.
- Parameters:
required_cycler_col (str) – The name of the required cycler column.
datetime_format (str) – The format of the datetime string.
- property expr: Expr#
Get the polars expression for the column mapping.
- class TimeFromDateMap(required_cycler_col, datetime_format)#
Bases:
ColumnMapA template mapping for extracting time from a date column.
- Parameters:
required_cycler_col (str) – The name of the required cycler column.
datetime_format (str)
- property expr: Expr#
Get the polars expression for the column mapping.
- class ConvertUnitsMap(pyprobe_name, required_cycler_col)#
Bases:
ColumnMapA template mapping for converting units.
- Parameters:
pyprobe_name (str) – The name of the PyProBE column.
required_cycler_col (str) – The name of the required cycler column.
- property expr: Expr#
Get the polars expression for the column mapping.
- class ConvertTemperatureMap(required_cycler_col)#
Bases:
ColumnMapA template mapping for converting temperature units.
- Parameters:
required_cycler_col (str) – The name of the required cycler column.
- property expr: Expr#
Get the polars expression for the column mapping.
- class CapacityFromChDchMap(charge_capacity_col, discharge_capacity_col)#
Bases:
ColumnMapA template mapping for calculating capacity from charge and discharge columns.
- Parameters:
charge_capacity_col (str) – The name of the charge capacity column.
discharge_capacity_col (str) – The name of the discharge capacity column.
- property expr: Expr#
Get the polars expression for the column mapping.
- class CapacityFromCurrentSignMap(capacity_col, current_col)#
Bases:
ColumnMapA template mapping for calculating capacity from current and time columns.
- Parameters:
capacity_col (str) – The name of the capacity column.
current_col (str) – The name of the current column.
- property capacity: Expr#
Get the capacity column.
- property current: Expr#
Get the current column.
- property expr: Expr#
Get the polars expression for the column mapping.
- class StepFromCategoricalMap(categorical_col)#
Bases:
ColumnMapA template mapping for calculating step from categorical columns.
An example of a categorical column is one that describes the type of step, e.g. “CC-CV”, “CV”, “OCV”, etc. This method will fill the step column with an incrementing count each time the categorical column changes.
- Parameters:
categorical_col (str) – The name of the categorical column.
- property expr: Expr#
Get the polars expression for the column mapping.