API Documentation¶
Working With Cycler Data¶
-
class
primed_data_processing.arbin_cycler.ArbinBatch(name: str = '', cells: list[primed_data_processing.arbin_cycler.ArbinCell] = [])[source]¶ -
Represents a batch of cells that are tested together.
The cells in the batch can have different testing parameters and chemistries, the only requirement is that they are tested in the chamber at the same time.
-
class
primed_data_processing.arbin_cycler.ArbinCell(cell_number: int, channel_number: int, cycles: list[primed_data_processing.arbin_cycler.ArbinCycle] = [], headers: list[str] = [])[source]¶ -
Represents a cell (battery) in a given test where any number of
ArbinCycleoccur.Attributes¶
cell_number:intNumber assigned to the cell for the test.
channel_number:intChannel assigned to the cell for the test.
cycles:list[ArbinCycle]List of
ArbinCycle.headers:list[str]Name of column headers in the data. For example, Voltage(V).
Methods¶
-
class
primed_data_processing.arbin_cycler.ArbinCycle(cycle_index: int, steps: list[primed_data_processing.arbin_cycler.ArbinStep] = [], name: str = '', test_number: int | None = None)[source]¶ -
Represents a cycle in a given test where any number of
ArbinStepoccur.Attributes¶
cycle_index:intThe cycle number.
steps:list[ArbinStep]List of
ArbinStepin the cycle.name:stringName of the cycle. Default is
''.test_number:intThe test number for the test that this cycle belongs too. Default is
None.
Methods¶
-
add_step(step: ArbinStep) None[source]¶ -
Add a step to the list of steps in the cycle.
Parameters¶
step:ArbinStepstepto be added to the cycle.
-
get_eis_step(step_number: int) list[primed_data_processing.gamry_eis.EisSweep][source]¶ -
Gets gamry EIS steps matching the chosen step number in the cycle.
Parameters¶
step_number:intStep index to be found.
Returns¶
list[EisSweep]List of EIS steps within the cycle matching step_number. Returns an empty list if there is no matches.
-
get_step(step_number: int) list[primed_data_processing.arbin_cycler.ArbinStep | primed_data_processing.gamry_eis.EisSweep][source]¶ -
Gets arbin cycler steps matching the chosen step number in the cycle.
Parameters¶
step_number:intStep index to be found.
Returns¶
list[ArbinStep]List of steps within the cycle matching
step_number. Returns an empty list if there is no matches.
-
class
primed_data_processing.arbin_cycler.ArbinStep(step_index: int, step_type: str, name: str | None = None)[source]¶ -
Represents a step in an Arbin MITS PRO test schedule.
An example of a step would be a constant current discharge from some beginning SOC to some ending SOC or voltage.
Attributes¶
name:strName of the step.
step_index:intThe step number.
step_type:strThe type of the step can be any of ‘initialization’, ‘characterization’, ‘degradation’.
data_dict:dict[str: any]Dictionary of data that mimics the input file format. Keys are the column headers from an Arbin data csv and the values are the column data associated with the headers.
Methods¶
-
get_data_as_array() array[source]¶ -
Returns¶
numpy.ndarrayAn array of the object attributes so that they form a table of step data.
Working With EIS Data¶
-
class
primed_data_processing.gamry_eis.EisCell(cell_number, channel_number, name='', eis_cycles=[])[source]¶ -
Represents a cell (battery) in a given test where any number of
EisCyclecan occur.Attributes¶
name:strName of the cell. Default is
''.eis_cycles:list[EisCycle]List of
EisCycleobjects representing all of the sweeps measured in a given cycle.cell_number:intThe cell number from the test.
channel_number:intThe channel number from the test.
Methods¶
-
class
primed_data_processing.gamry_eis.EisCycle(cycle_number: int, sweeps: list[primed_data_processing.gamry_eis.EisSweep] = [], name='')[source]¶ -
Represents a cycle in a given test where any number of
EisSweepcan occur.Attributes¶
cycle_number:intThe cycle number in the test.
sweeps:list[EisSweep]List of
EisSweepobjects that occur in this cycle.name:stroptional, default is''Name of the object.
Methods¶
-
class
primed_data_processing.gamry_eis.EisSweep(name: str, soc: float, step_index: int = 0)[source]¶ -
Represents a single EIS sweep.
An EIS sweep is a sweep from some start frequency to some end frequency with a specified number of data points within each frequency decade. The sweep occurs at a specified SOC.
Attributes¶
name:strName of the eis sweep.
soc:floatState-of-charge of battery when eis measurement was taken. 0 <= soc <=1.
step_index:intIndex of the EIS step in the arbin test schedule. Default is 0.
date_time:strDate and time of the measurement.
data_dict:dict[str: list[float]]Dictionary containing the EIS measurement data.
Methods¶
-
get_data_as_array() array[source]¶ -
Returns¶
numpy.ndarrayNx11 array where the columns are pt, time, freq, zreal, zimag, zsig, zmod, zphase, idc, vdc, ierange
-
get_data_as_dataframe() DataFrame[source]¶ -
Returns¶
pandas.DataFrameNx11 table where column headers are pt, time, freq, zreal, zimag, zsig, zmod, zphase, idc, vdc, ierange
Data Downloader¶
-
class
primed_data_processing.cellbuilder.CellBuilder[source]¶ -
This object builds the cell data structure from the raw Arbin data files.
Attributes¶
None
Methods¶
-
merge_B6_eis_data(eis_cells: list[primed_data_processing.gamry_eis.EisCell], arbin_cells: list[primed_data_processing.arbin_cycler.ArbinCell]) None[source]¶ -
Merge eis cells into the arbin cells. Ensures that eis steps are input into the correct ArbinCyles.
Eis steps will only be merged into the Arbin objects if their is a correspoinding ArbinCell with a matching channel number and cycle number.
Parameters¶
eis_cells:list[EisCell]List of EisCell to have steps added to the ArbinCells.
arbin_cells:list[ArbinCell]List of ArbinCell to have eis steps added to.
-
read_B6_csv_data(cell: ArbinCell, file_path: str, steps: dict[str, list[int]], verbose: bool = False) None[source]¶ -
Read raw Arbin test data from a csv file such that only the data according to the steps in steps is read and stored.
This method supports looping over multiple files, however it requires that the files are sorted into chronological order.
Parameters¶
cell:ArbinCellCell that the data is to be loaded to.
file_path:strPath to an Arbin raw data file according to batch B6. Must be a .csv file.
steps:dictKeys are the step type (see ArbinStep.__init__) and values are lists of step numbers to be read and stored.
verbose:boolOptional bool for controlling how much info is printed during data processing. Default is
False.
-
read_leaf_characterization_excel_data(file_path: str, steps: dict[str, list[int]], verbose: bool = False) list[primed_data_processing.arbin_cycler.ArbinCell][source]¶ -
Load Nissan Leaf initial characterization data from the init_gen1_packX excel files.
Parameters¶
cell:ArbinCellCell that the data is to be loaded to.
file_path:strPath to an Arbin raw data file according to batch B6. Must be a .csv file.
steps:dictKeys are the step type (see ArbinStep.__init__) and values are lists of step numbers to be read and stored.
verbose:boolOptional bool for controlling how much info is printed during data processing. Default is
False.
-
Utility Functions¶
Author: Sean Buchanan
This module contains useful functions for processing Arbin and Gamry battery data.
These functions come up continuously in practice from users so they have been added to a useful common location.
-
primed_data_processing.primed_utils.assign_cell_cycle_numbers(batch: ArbinBatch, step_idx: int | None = None)[source]¶ -
Assign cell and cycle numbers to the steps for ease of access when working with data.
Parameters¶
batch:ArbinBatchArbinBatchobject containing the test data.step_idx:intStep number to assign cell and cycle numbers too.
-
primed_data_processing.primed_utils.assign_soe(step: int, soe_step: int, nom_e_cap: float, batch: ArbinBatch) None[source]¶ -
Calculate and assign the SOE to step
stepin an attribute namedsoefor all cells inbatch.Parameters¶
step:intStep number to have soe added to
soe_step:intStep containing the full discharge data used to calculate the soe.
nom_e_cap:floatNominal energy capacity of the battery used for the test in Wh.
batch:ArbinBatchBatch of cells containing the desired data.
-
primed_data_processing.primed_utils.assign_soh(step: int, soh_step: int, nom_cap: float, batch: ArbinBatch) None[source]¶ -
Calculate and assign the SOH to step
stepin an attribute namedsohfor all cells inbatch.Parameters¶
step:intStep number to have soh added to
soh_step:intStep containing the full discharge data used to calculate the soh.
nom_cap:floatNominal capacity of the battery used for the test in Ah.
batch:ArbinBatchBatch of cells containing the desired data.
-
primed_data_processing.primed_utils.assign_temp(eis_step: int, temp_step: int, batch: ArbinBatch, default_step_idx: int = -1, default_temp_idx: int = -1) None[source]¶ -
Assign cell temperature to the eis step from the temperature of
temp_step.Parameters¶
eis_step:intStep number of the eis step
temp_step:intStep number of the step with temperature data.
batch:ArbinBatchArbinBatchobject with the test data.default_step_idx:int, optionalIndex of the list of steps within the cycle. Default is -1.
default_temp_idx:int, optionalIndex of the list of temperatures within the step. Default is -1.
-
primed_data_processing.primed_utils.filter_by_soh(steps: list[primed_data_processing.arbin_cycler.ArbinStep] | dict[slice(<class 'int'>, list[primed_data_processing.arbin_cycler.ArbinStep], None)], soh_range: float, soh_lower: int = 77, soh_upper: int = 101) dict[slice(<class 'int'>, list[primed_data_processing.arbin_cycler.ArbinStep], None)][source]¶ -
Filter steps in
stepssuch that only the steps with a SOH within the bounds of lower and upper are retained.This function requires that all steps in
stepshave a soh attribute; seeassign_soh.Parameters¶
steps:list[ArbinStep] | dict[int: list[ArbinStep]]ArbinSteps containing soh attributes to be sorted
soh_range:floatWidth of SOH bins to sort
stepsinto. Ifsoh_range= 1 thenstepswill be sorted into bins from 77-78,78-79….,100-101 etc.soh_lower:int, optionalLower SOH bound for sorting.
soh_upper:intUpper SOH bound for sorting.
Returns¶
dict[int: list[ArbinStep]]Dictionary with key of the lower bound for each range and values of all the steps that match that soh range.
-
primed_data_processing.primed_utils.filter_by_temp(step: int, temp_range: tuple | list, batch: ArbinBatch) dict[slice(<class 'int'>, list[primed_data_processing.arbin_cycler.ArbinStep], None)][source]¶ -
Filter steps in
batchsuch that only the steps with a temperature within the bounds oftemp_rangeare retained.This function requires that all steps in
stepshave a temperature attribute; seeassign_temp.Parameters¶
step:intStep number in batch object that has the temperature attribute.
temp_range:tuple | listElement zero is the lower temperature bound and element 1 is the upper temperature bound.
batch:ArbinBatchArbinBatch that contains the test data. See
primed_data_processingpackage.
Returns¶
dict[int: list[ArbinStep]]Dictionary with key of the cell channel number and values of list of step data within the temperature range.
-
primed_data_processing.primed_utils.get_first_quadrant_data(step: int, batch: ArbinBatch) None[source]¶ -
Make a dictionary containing only the first quadrant eis data. See
ArbinStep.make_first_quadrant_dict().Parameters¶
step:intStep number to get first quadrant data from.
batch:ArbinBatchArbinBatchobject containing the test data.
-
primed_data_processing.primed_utils.load_B6T10(cell_builder: ~primed_data_processing.cellbuilder.CellBuilder, prepath: str, channel_numbers: list | tuple, cell_numbers: list | tuple, steps: dict[slice(<class 'str'>, list[int], None)]) ArbinBatch[source]¶ -
Load the entire B6T10/B6T15 dataset.
Parameters¶
cell_builder:CellBuilderCellBuilderused to access data reading methods.prepath:strpath to the folder containing all battery data.
channel_numbers:list | tupleChannel numbers to be loaded.
cell_numbers:list | tupleCell number of channels to be loaded. Required to be in order correspondin to the channel numbers.
steps:dict[str: list[int]]Steps to be loaded.
-
primed_data_processing.primed_utils.load_B6T10_eis(T10_eis_folder: str, T15_eis_folder: str, channel_numbers: list | tuple, cell_numbers: list | tuple) list[primed_data_processing.gamry_eis.EisCell][source]¶ -
Load eis data from batch B6 and test 10 and 15 into a data object.
Parameters¶
T10_eis_folder:strAbsolute path to the folder containing test 10 eis data.
T15_eis_folder:strAbsolute path to the folder containing test 15 eis data.
channel_numbers:list | tupleIterable containing the channel numbers to be read into the data object.
cell_numbers:list | tupleIterable containing the cell numbers to be read into the data object.
Returns¶
list[EisCell]List of
EisCellobjects for each cell in the folder directories.
-
primed_data_processing.primed_utils.load_B6T11(cell_builder: ~primed_data_processing.cellbuilder.CellBuilder, prepath: str, channel_numbers: list | tuple, cell_numbers: list | tuple, steps: dict[slice(<class 'str'>, list[int], None)]) ArbinBatch[source]¶ -
Load the entire B6T11/B6T16 dataset.
Parameters¶
cell_builder:CellBuilderCellBuilderused to access data reading methods.prepath:strpath to the folder containing all battery data.
channel_numbers:list | tupleChannel numbers to be loaded.
cell_numbers:list | tupleCell number of channels to be loaded. Required to be in order correspondin to the channel numbers.
steps:dict[str: list[int]]Steps to be loaded.
-
primed_data_processing.primed_utils.load_files_from_dir(cell_builder: ~primed_data_processing.cellbuilder.CellBuilder, arbin_cells: list[primed_data_processing.arbin_cycler.ArbinCell], sorted_dir: list[bytes], prepath: str, folder_name: str, steps: dict[slice(<class 'str'>, list[int], None)], channel_idx: int) None[source]¶ -
Load all csv files in a directory.
Parameters¶
cell_builder:CellBuilderCellBuilderused to access data reading methods.arbin_cells:list[ArbinCell]list of arbin cells to add data to.
sorted_dir:list[bytes]list of files in the directory sorted by chronological order.
prepath:strpath to the folder containing all battery data.
folder_name:strname of the folder to be read.
steps:dict[str: list[int]]dictionary of steps to be read.
channel_idx:intWhich channel to load data from.