pyprobe.cell module#

Module for the Cell class.

pydantic model Cell(*, info, procedure=None)#

Bases: BaseModel

A class for a cell in a battery experiment.

Validators:
Parameters:
  • info (Dict[str, str | int | float | Dict[Any, Any] | None])

  • procedure (Dict[str, Procedure])

Return type:

None

field info: Dict[str, str | int | float | Dict[Any, Any] | None] [Required]#

Dictionary containing information about the cell. The dictionary must contain a ‘Name’ field, other information may include channel number or other rig information.

Validated by:
field procedure: Dict[str, Procedure] [Optional]#

Dictionary containing the procedures that have been run on the cell.

validator check_and_set_name  »  info#

Validate the info field.

Checks that a Name field is present in the info dictionary, if not it is set to ‘Default Name’. If the color field is not present, a color is generated.

Parameters:

info (Dict[str, str | int | float | Dict[Any, Any] | None])

Return type:

Dict[str, str | int | float | Dict[Any, Any] | None]

process_cycler_file(cycler, folder_path, input_filename, output_filename, filename_inputs=None)#

Convert cycler file into PyProBE format.

Parameters:
  • cycler (str) – The cycler used to produce the data. Available cyclers are: - ‘neware’ - ‘biologic’ - ‘biologic_MB’ (for Modulo Bat Biologic data)

  • folder_path (str) – The path to the folder containing the data file.

  • input_filename (str | function) – A filename string or a function to generate the file name for cycler data.

  • output_filename (str | function) – A filename string or a function to generate the file name for PyProBE data.

  • filename_inputs (list) – The list of inputs to input_filename and output_filename, if they are functions. These must be keys of the cell info.

Return type:

None

process_generic_file(folder_path, input_filename, output_filename, column_dict, filename_inputs=None)#

Convert generic file into PyProBE format.

Parameters:
  • folder_path (str) – The path to the folder containing the data file.

  • input_filename (str | function) – A filename string or a function to generate the file name for the generic data.

  • output_filename (str | function) – A filename string or a function to generate the file name for PyProBE data.

  • column_dict (dict) – A dictionary mapping the column names in the generic file to the PyProBE column names. The keys of the dictionary are the cycler column names and the values are the PyProBE column names. You must use asterisks to indicate the units of the columns. E.g. {"V (*)": "Voltage [*]"}.

  • filename_inputs (list) – The list of inputs to input_filename and output_filename. These must be keys of the cell info.

Return type:

None

add_procedure(procedure_name, folder_path, filename, filename_inputs=None, readme_name='README.yaml')#

Add data in a PyProBE-format parquet file to the procedure dict of the cell.

Parameters:
  • procedure_name (str) – A name to give the procedure. This will be used when calling cell.procedure[procedure_name].

  • folder_path (str) – The path to the folder containing the data file.

  • filename (str | function) – A filename string or a function to generate the file name for PyProBE data.

  • filename_inputs (Optional[list]) – The list of inputs to filename_function. These must be keys of the cell info.

  • readme_name (str, optional) – The name of the readme file. Defaults to “README.yaml”. It is assumed that the readme file is in the same folder as the data file.

Return type:

None

import_pybamm_solution(procedure_name, experiment_names, pybamm_solutions, output_data_path=None, optional_variables=None)#

Import a PyBaMM solution object into a procedure of the cell.

Filtering a PyBaMM solution object by cycle and step reflects the behaviour of the cycles and steps dictionaries of the PyBaMM solution object.

Multiple experiments can be imported into the same procedure. This is achieved by providing multiple solution objects and experiment names.

This method optionally writes the data to a parquet file, if a data path is provided.

Parameters:
  • procedure_name (str) – A name to give the procedure. This will be used when calling cell.procedure[procedure_name].

  • pybamm_solutions (list or pybamm_solution) – A list of PyBaMM solution objects or a single PyBaMM solution object.

  • experiment_names (list or str) – A list of experiment names or a single experiment name to assign to the PyBaMM solution object.

  • output_data_path (str, optional) – The path to write the parquet file. Defaults to None.

  • optional_variables (list, optional) – A list of variables to import from the PyBaMM solution object in addition to the PyProBE required variables. Defaults to None.

Return type:

None

archive(path)#

Archive the cell object.

Parameters:

path (str) – The path to the archive directory or zip file.

Return type:

None

load_archive(path)#

Load a cell object from an archive.

Parameters:

path (str) – The path to the archive directory.

Returns:

The cell object.

Return type:

Cell

make_cell_list(record_filepath, worksheet_name)#

Function to make a list of cell objects from a record of tests in Excel format.

Parameters:
  • record_filepath (str) – The path to the experiment record .xlsx file.

  • worksheet_name (str) – The worksheet name to read from the record.

Returns:

The list of cell objects.

Return type:

list