pyprobe.cell#

Module for the Cell class.

Functions

load_archive(path)

Load a cell object from an archive.

make_cell_list(record_filepath, worksheet_name)

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

process_cycler_data(cycler, input_data_path)

Process battery cycler data into PyProBE format.

Classes

Cell(*, info[, procedure])

A class for a cell in a battery experiment.

process_cycler_data(cycler, input_data_path, output_data_path=None, column_importers=[], extra_column_importers=[], compression_priority='performance', overwrite_existing=False)#

Process battery cycler data into PyProBE format.

Parameters:
  • cycler (Literal['neware', 'biologic', 'biologic_MB', 'arbin', 'basytec', 'maccor', 'novonix', 'generic']) – Type of battery cycler used.

  • input_data_path (str) – Path to input data file(s). Supports glob patterns.

  • output_data_path (str | None) – Path for output parquet file. If None, the output file will have the same name as the input file with a .parquet extension.

  • column_importers (list[ColumnMap]) – List of column importers to apply to the input data. Required for generic cycler type. Overrides default column importers for other cycler types.

  • extra_column_importers (list[ColumnMap]) – List of additional column importers to apply to the input data. These column importers will be applied after the default column importers.

  • compression_priority (Literal['performance', 'file size', 'uncompressed']) – Compression method for output file.

  • overwrite_existing (bool) – Whether to overwrite existing output file.

Returns:

The path to the output parquet file.

Return type:

str

class Cell(*, info, procedure=<factory>)#

Bases: BaseModel

A class for a cell in a battery experiment.

Parameters:
  • info (dict[str, Any | None])

  • procedure (dict[str, Procedure])

info: dict[str, Any | None]#

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

procedure: dict[str, Procedure]#

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

import_data(procedure_name, data_path, readme_path=None)#

Import a procedure from a PyProBE-format parquet file.

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

  • data_path (str) – The path to the parquet file.

  • readme_path (str, optional) – The path to the readme file. If None, the function will look for a file named README.yaml in the same folder as the data file. If none is found, the data will be imported without a readme file, which will limit the ability to filter the data by experiment. Defaults to None.

Return type:

None

import_from_cycler(procedure_name, cycler, input_data_path, output_data_path=None, readme_path=None, compression_priority='performance', column_importers=[], extra_column_importers=[], overwrite_existing=False)#

Import a procedure into the cell object.

This method converts a cycler file into PyProBE format, writes the data to a parquet file and adds the procedure to the cell object.

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

  • cycler (Literal['neware', 'biologic', 'biologic_MB', 'arbin', 'basytec', 'maccor', 'novonix', 'generic']) – The cycler used to produce the data.

  • input_data_path (str) – The path to the cycler data file.

  • output_data_path (str, optional) – The path to write the parquet file. When None, the data is written to a file with the same name as the input file but with a .parquet extension. Defaults to None.

  • readme_path (str, optional) – The path to the readme file. If None, the function will look for a file named README.yaml in the same folder as the input data file. If none is found, the data will be imported without a readme file, which will limit the ability to filter the data by experiment. Defaults to None.

  • compression_priority (Literal['performance', 'file size', 'uncompressed']) – The priority of the compression algorithm to use on the resulting parquet file. Available options are: - ‘performance’: Use the ‘lz4’ compression algorithm (default). - ‘file size’: Use the ‘zstd’ compression algorithm. - ‘uncompressed’: Do not use compression.

  • column_importers (list[ColumnMap]) – A list of column importers to apply to the input data. Required for generic cycler type. Overrides default column importers for other cycler types.

  • extra_column_importers (list[ColumnMap]) – A list of additional column importers to apply to the input data. These column importers will be applied after the default column importers.

  • overwrite_existing (bool) – If True, any existing parquet file with the output_filename will be overwritten. If False, the function will skip the conversion if the parquet file already exists.

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

process_cycler_file(cycler, folder_path, input_filename, output_filename, filename_inputs=None, compression_priority='performance', overwrite_existing=False)#

Deprecated since version 2.0.1: For integrated cycler file processing and data import, use the import_from_cycler() method. To only process cycler files into the PyProBE format, use the process_cycler_data() function.

Parameters:
  • cycler (Literal['neware', 'biologic', 'biologic_MB', 'arbin', 'basytec', 'maccor', 'generic'])

  • folder_path (str)

  • input_filename (str | Callable[[str], str])

  • output_filename (str | Callable[[str], str])

  • filename_inputs (list[str] | None)

  • compression_priority (Literal['performance', 'file size', 'uncompressed'])

  • overwrite_existing (bool)

Return type:

None

process_generic_file(folder_path, input_filename, output_filename, column_importers, header_row_index=0, filename_inputs=None, compression_priority='performance', overwrite_existing=False)#

Deprecated since version 2.0.1: For integrated cycler file processing and data import, use the import_from_cycler() method using the ‘generic’ cycler. To only process cycler files into the PyProBE format, use the process_cycler_data() function.

Parameters:
  • folder_path (str)

  • input_filename (str | Callable[[str], str])

  • output_filename (str | Callable[[str], str])

  • column_importers (list[ColumnMap])

  • header_row_index (int)

  • filename_inputs (list[str] | None)

  • compression_priority (Literal['performance', 'file size', 'uncompressed'])

  • overwrite_existing (bool)

Return type:

None

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

Deprecated since version 2.0.1: For integrated cycler file processing and data import, use the import_from_cycler() method. To only process cycler files into the PyProBE format, use the import_data() function.

Parameters:
  • procedure_name (str)

  • folder_path (str)

  • filename (str | Callable[[str], str])

  • filename_inputs (list[str] | None)

  • readme_name (str)

Return type:

None

quick_add_procedure(procedure_name, folder_path, filename, filename_inputs=None)#

Deprecated since version 2.0.1: For integrated cycler file processing and data import, use the import_from_cycler() method. To only process cycler files into the PyProBE format, use the import_data() function.

Parameters:
  • procedure_name (str)

  • folder_path (str)

  • filename (str | Callable[[str], str])

  • filename_inputs (list[str] | None)

Return type:

None

model_config = {'arbitrary_types_allowed': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

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, header_row=0)#

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.

  • header_row (int, optional) – The row number containing the column headers. Defaults to 0.

Returns:

The list of cell objects.

Return type:

list