pyprobe.cyclers.column_maps#

A module of classes to map cycler columns to PyProBE columns.

Classes

CapacityFromChDchMap(charge_capacity_col, ...)

A template mapping for calculating capacity from charge and discharge columns.

CapacityFromCurrentSignMap(capacity_col, ...)

A template mapping for calculating capacity from current and time columns.

CastAndRenameMap(pyprobe_name, ...)

A template mapping for simple column renaming.

ColumnMap(pyprobe_name, required_cycler_cols)

A class to map cycler columns to PyProBE columns.

ConvertTemperatureMap(required_cycler_col)

A template mapping for converting temperature units.

ConvertUnitsMap(pyprobe_name, ...)

A template mapping for converting units.

DateTimeMap(required_cycler_col, datetime_format)

A template mapping for datetime columns.

StepFromCategoricalMap(categorical_col)

A template mapping for calculating step from categorical columns.

TimeFromDateMap(required_cycler_col, ...)

A template mapping for extracting time from a date column.

class ColumnMap(pyprobe_name, required_cycler_cols)#

Bases: ABC

A 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_map with the name of the columns in the cycler data that match the required patterns and the extracted units. It also sets the attribute columns_validated to 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: ColumnMap

A 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: ColumnMap

A 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: ColumnMap

A 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: ColumnMap

A 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: ColumnMap

A 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: ColumnMap

A 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: ColumnMap

A 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: ColumnMap

A 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.