pyprobe.filters#
A module for the filtering classes.
Functions
|
Adds a cycle column to the data. |
Classes
|
A class for a cycle in a battery experimental procedure. |
|
A class for an experiment in a battery experimental procedure. |
|
A class for a procedure in a battery experiment. |
|
A class for a step in a battery experimental procedure. |
- get_cycle_column(filtered_object)#
Adds a cycle column to the data.
If cycle details have been provided in the README, the cycle column will be created by checking for the last step of the cycle. For nested cycles, the “outer” cycle will be created first. Subsequent filtering with the cycle method will then allow for filtering on the “inner” cycles.
If no cycle details have been provided, the cycle column will be created by identifying the last step of the cycle by checking for a decrease in the step number.
- Parameters:
filtered_object (FilterToCycleType) – The experiment or cycle object.
- Returns:
The data with a cycle column.
- Return type:
pl.DataFrame | pl.LazyFrame
- class Procedure(*, lf, info, column_definitions=<factory>, step_descriptions={}, readme_dict, cycle_info=[])#
Bases:
RawDataA class for a procedure in a battery experiment.
- Parameters:
lf (LazyFrame)
info (dict[str, Any | None])
column_definitions (dict[str, str])
step_descriptions (dict[str, list[str | int | None]])
readme_dict (dict[str, dict[str, list[str | int | tuple[int, int, int]]]])
cycle_info (list[tuple[int, int, int]])
- readme_dict: dict[str, dict[str, list[str | int | tuple[int, int, int]]]]#
A dictionary representing the data contained in the README yaml file.
- cycle_info: list[tuple[int, int, int]]#
A list of tuples representing the cycle information from the README yaml file.
The tuple format is
(start step (inclusive), end step (inclusive), cycle count).
- step(*step_numbers, condition=None)#
Return a step object. Filters to a numerical condition on the Event column.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
step_numbers (int | range) – Variable-length argument list of step indices or a range object.
condition (pl.Expr, optional) – A polars expression to filter the step before applying the numerical filter. Defaults to None.
- Returns:
A step object.
- Return type:
- cycle(*cycle_numbers)#
Return a cycle object. Filters on the Cycle column.
- Parameters:
filtered_object (FilterToExperimentType) – A filter object that this method is called on.
cycle_numbers (int | range) – Variable-length argument list of cycle indices or a range object.
- Returns:
A cycle object.
- Return type:
- charge(*charge_numbers)#
Return a charge step.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
charge_numbers (int | range) – Variable-length argument list of charge indices or a range object.
- Returns:
A charge step object.
- Return type:
- discharge(*discharge_numbers)#
Return a discharge step.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
discharge_numbers (int | range) – Variable-length argument list of discharge indices or a range object.
- Returns:
A discharge step object.
- Return type:
- chargeordischarge(*chargeordischarge_numbers)#
Return a charge or discharge step.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
chargeordischarge_numbers (int | range) – Variable-length argument list of charge or discharge indices or a range object.
- Returns:
A charge or discharge step object.
- Return type:
- rest(*rest_numbers)#
Return a rest step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
rest_numbers (int | range) – Variable-length argument list of rest indices or a range object.
- Returns:
A rest step object.
- Return type:
- constant_current(*constant_current_numbers)#
Return a constant current step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
constant_current_numbers (int | range) – Variable-length argument list of constant current indices or a range object.
- Returns:
A constant current step object.
- Return type:
- constant_voltage(*constant_voltage_numbers)#
Return a constant voltage step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
*constant_voltage_numbers (int | range) – Variable-length argument list of constant voltage indices or a range object.
- Returns:
A constant voltage step object.
- Return type:
- experiment(*experiment_names)#
Return an experiment object from the procedure.
- Parameters:
experiment_names (str) – Variable-length argument list of experiment names.
- Returns:
An experiment object from the procedure.
- Return type:
- remove_experiment(*experiment_names)#
Remove an experiment from the procedure.
- Parameters:
experiment_names (str) – Variable-length argument list of experiment names.
- Return type:
None
- property experiment_names: list[str]#
Return the names of the experiments in the procedure.
- Returns:
The names of the experiments in the procedure.
- Return type:
List[str]
- add_external_data(filepath, importing_columns, date_column_name='Date')#
Deprecated since version 2.3.1: Use add_data instead.
- Parameters:
filepath (str)
importing_columns (list[str] | dict[str, str])
date_column_name (str)
- Return type:
None
- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Experiment(*, lf, info, column_definitions=<factory>, step_descriptions={}, cycle_info=[])#
Bases:
RawDataA class for an experiment in a battery experimental procedure.
- Parameters:
lf (LazyFrame)
info (dict[str, Any | None])
column_definitions (dict[str, str])
step_descriptions (dict[str, list[str | int | None]])
cycle_info (list[tuple[int, int, int]])
- cycle_info: list[tuple[int, int, int]]#
A list of tuples representing the cycle information from the README yaml file.
The tuple format is
(start step (inclusive), end step (inclusive), cycle count).
- step(*step_numbers, condition=None)#
Return a step object. Filters to a numerical condition on the Event column.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
step_numbers (int | range) – Variable-length argument list of step indices or a range object.
condition (pl.Expr, optional) – A polars expression to filter the step before applying the numerical filter. Defaults to None.
- Returns:
A step object.
- Return type:
- cycle(*cycle_numbers)#
Return a cycle object. Filters on the Cycle column.
- Parameters:
filtered_object (FilterToExperimentType) – A filter object that this method is called on.
cycle_numbers (int | range) – Variable-length argument list of cycle indices or a range object.
- Returns:
A cycle object.
- Return type:
- charge(*charge_numbers)#
Return a charge step.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
charge_numbers (int | range) – Variable-length argument list of charge indices or a range object.
- Returns:
A charge step object.
- Return type:
- discharge(*discharge_numbers)#
Return a discharge step.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
discharge_numbers (int | range) – Variable-length argument list of discharge indices or a range object.
- Returns:
A discharge step object.
- Return type:
- chargeordischarge(*chargeordischarge_numbers)#
Return a charge or discharge step.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
chargeordischarge_numbers (int | range) – Variable-length argument list of charge or discharge indices or a range object.
- Returns:
A charge or discharge step object.
- Return type:
- rest(*rest_numbers)#
Return a rest step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
rest_numbers (int | range) – Variable-length argument list of rest indices or a range object.
- Returns:
A rest step object.
- Return type:
- constant_current(*constant_current_numbers)#
Return a constant current step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
constant_current_numbers (int | range) – Variable-length argument list of constant current indices or a range object.
- Returns:
A constant current step object.
- Return type:
- constant_voltage(*constant_voltage_numbers)#
Return a constant voltage step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
*constant_voltage_numbers (int | range) – Variable-length argument list of constant voltage indices or a range object.
- Returns:
A constant voltage step object.
- Return type:
- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Cycle(*, lf, info, column_definitions=<factory>, step_descriptions={}, cycle_info=[])#
Bases:
RawDataA class for a cycle in a battery experimental procedure.
- Parameters:
lf (LazyFrame)
info (dict[str, Any | None])
column_definitions (dict[str, str])
step_descriptions (dict[str, list[str | int | None]])
cycle_info (list[tuple[int, int, int]])
- cycle_info: list[tuple[int, int, int]]#
A list of tuples representing the cycle information from the README yaml file.
The tuple format is
(start step (inclusive), end step (inclusive), cycle count).
- step(*step_numbers, condition=None)#
Return a step object. Filters to a numerical condition on the Event column.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
step_numbers (int | range) – Variable-length argument list of step indices or a range object.
condition (pl.Expr, optional) – A polars expression to filter the step before applying the numerical filter. Defaults to None.
- Returns:
A step object.
- Return type:
- charge(*charge_numbers)#
Return a charge step.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
charge_numbers (int | range) – Variable-length argument list of charge indices or a range object.
- Returns:
A charge step object.
- Return type:
- discharge(*discharge_numbers)#
Return a discharge step.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
discharge_numbers (int | range) – Variable-length argument list of discharge indices or a range object.
- Returns:
A discharge step object.
- Return type:
- chargeordischarge(*chargeordischarge_numbers)#
Return a charge or discharge step.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
chargeordischarge_numbers (int | range) – Variable-length argument list of charge or discharge indices or a range object.
- Returns:
A charge or discharge step object.
- Return type:
- rest(*rest_numbers)#
Return a rest step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
rest_numbers (int | range) – Variable-length argument list of rest indices or a range object.
- Returns:
A rest step object.
- Return type:
- constant_current(*constant_current_numbers)#
Return a constant current step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
constant_current_numbers (int | range) – Variable-length argument list of constant current indices or a range object.
- Returns:
A constant current step object.
- Return type:
- constant_voltage(*constant_voltage_numbers)#
Return a constant voltage step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
*constant_voltage_numbers (int | range) – Variable-length argument list of constant voltage indices or a range object.
- Returns:
A constant voltage step object.
- Return type:
- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Step(*, lf, info, column_definitions=<factory>, step_descriptions={})#
Bases:
RawDataA class for a step in a battery experimental procedure.
- Parameters:
lf (LazyFrame)
info (dict[str, Any | None])
column_definitions (dict[str, str])
step_descriptions (dict[str, list[str | int | None]])
- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- step(*step_numbers, condition=None)#
Return a step object. Filters to a numerical condition on the Event column.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
step_numbers (int | range) – Variable-length argument list of step indices or a range object.
condition (pl.Expr, optional) – A polars expression to filter the step before applying the numerical filter. Defaults to None.
- Returns:
A step object.
- Return type:
- constant_current(*constant_current_numbers)#
Return a constant current step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
constant_current_numbers (int | range) – Variable-length argument list of constant current indices or a range object.
- Returns:
A constant current step object.
- Return type:
- constant_voltage(*constant_voltage_numbers)#
Return a constant voltage step object.
- Parameters:
filtered_object (FilterToCycleType) – A filter object that this method is called on.
*constant_voltage_numbers (int | range) – Variable-length argument list of constant voltage indices or a range object.
- Returns:
A constant voltage step object.
- Return type: