Postprocessing (batdata.postprocess)#

Methods that compute new data based on existing columns in a cycling data file

Base (b.postprocess.base)#

Base class and utilities related to post-processing on battery data

class batdata.postprocess.base.BaseFeatureComputer#

Bases: object

Base class for methods that produce new features given battery data

Features can be anything but are often collected statistics about a certain cycle.

compute_features(data: BatteryDataset) DataFrame#

Compute

Parameters:

data – Battery data object

Returns:

A dataframe of features where rows are different cycles or steps, columns are different features

class batdata.postprocess.base.CycleSummarizer#

Bases: BaseFeatureComputer

Classes which produce a summary of certain cycles given the raw data from a cycle

add_summaries(data: BatteryDataset)#

Add cycle-level summaries to a battery dataset

Parameters:

data – Dataset to be modified

column_names: List[str] = Ellipsis#
compute_features(data: BatteryDataset) DataFrame#

Compute

Parameters:

data – Battery data object

Returns:

A dataframe of features where rows are different cycles or steps, columns are different features

class batdata.postprocess.base.RawDataEnhancer#

Bases: BaseFeatureComputer

Base class for methods derives new data from the existing columns in raw data

column_names: List[str] = Ellipsis#
compute_features(data: BatteryDataset) DataFrame#

Compute

Parameters:

data – Battery data object

Returns:

A dataframe of features where rows are different cycles or steps, columns are different features

enhance(data: DataFrame)#

Add additional columns to the raw data

Parameters:

data – Raw data to be modified

Integral (b.postprocess.integral)#

Features related to integral quantities (e.g., energy, capacity)

class batdata.postprocess.integral.CapacityPerCycle(reuse_integrals: bool = True)#

Bases: CycleSummarizer

Compute the observed capacity and energy during both charge and discharge of each cycle

Determines capacities based on the integral of current over each cycle:

  1. Compute the change in state of charge from the start of the cycle by computing the integral of the capacity over time. We refer to this integral as the dSOC.

  2. Determine whether the battery started from a charged state by determining if the largest capacity change is positive (i.e., if the point most different state of charge from the start is more discharged than the starting point). The code will raise a warning if the quantities are similar.

  3. If starting from a charged state, the discharge capacity is the maximum change in state of charge (dSOC.max()). The charge capacity is the amount of charge transferred to the battery between this maximally-discharged state and the end the of the cycle (dSOC.max() - dSOC[-1])

  4. If starting from a discharged state, the charge capacity is the maximum change in state of charge and the discharge capacity is the amount transferred from the battery into the end of the cycle.

The energy is computed using a similar procedure, but by integrating the product of current and voltage instead of only current.

Note

Measurements of capacity and energy assume a cycle returns the battery to the same state as it started the cycle.

Output dataframe has 4 new columns.

  • capacity_discharge: Discharge capacity per cycle in A-hr

  • capacity_charge: Charge capacity per the cycle in A-hr

  • energy_charge: Discharge energy per cycle in J

  • energy_discharge: Charge energy per the cycle in J

The full definitions are provided in the CycleLevelData schema

Parameters:

reuse_integrals – Whether to reuse the cycle_capacity and cycle_energy if they are available

property column_names: List[str]#
class batdata.postprocess.integral.StateOfCharge#

Bases: RawDataEnhancer

Compute the change in capacity and system energy over each cycle

The capacity change for a cycle is determined by integrating the current as a function of time between the start of the cycle and the first of the next cycle. The energy change is determined by integrating the product of current and voltage.

Output dataframe has 4 new columns:
  • cycle_capacity: Amount of charge dispersed from the battery over the cycle, in A-hr

  • cycle_energy: Amount of energy dispersed from the battery over the cycle, in J

column_names: List[str] = ['cycle_capacity', 'cycle_energy']#
enhance(data: DataFrame)#

Add additional columns to the raw data

Parameters:

data – Raw data to be modified

Tagging (b.postprocess.tagging)#

Methods which assign labels that are present in some testing machines yet absent in others.

For example, add_method() determines whether the battery is being held at a constant voltage or current.

class batdata.postprocess.tagging.AddMethod#

Bases: RawDataEnhancer

Determine how the battery was being controlled

Determines whether a charging step is composed of constant-current, constant-voltage, or mixed steps by first partitioning it into substeps based on the maximum curvature of these points then assigning regions to constant voltage or current if one varied more than twice the other.

column_names: List[str] = ['method']#
enhance(df: DataFrame)#

Add additional columns to the raw data

Parameters:

data – Raw data to be modified

class batdata.postprocess.tagging.AddSteps#

Bases: RawDataEnhancer

Mark points at which the battery changed state: charging, discharging, rest

column_names: List[str] = ['state']#
enhance(data: DataFrame)#

Add additional columns to the raw data

Parameters:

data – Raw data to be modified

class batdata.postprocess.tagging.AddSubSteps#

Bases: RawDataEnhancer

Mark points at which the battery control method changed state

See AddMethod for how control methods are determined.

enhance(data: DataFrame)#

Add additional columns to the raw data

Parameters:

data – Raw data to be modified

Timing (b.postprocess.tagging)#

Features related to the relative to the start of cycles or the test, etc

class batdata.postprocess.timing.CycleTimesSummarizer#

Bases: CycleSummarizer

Capture the start time and duration of a cycle

The start of a cycle is the minimum test time for any point in the raw data.

The duration of a cycle is the difference between the start of the next cycle and the start of the cycle. If the start time of the next cycle is unavailable, it is the difference between the test time of the last test time in the raw data and the start of the cycle.

column_names: List[str] = ['cycle_start', 'cycle_duration']#
class batdata.postprocess.timing.TimeEnhancer#

Bases: RawDataEnhancer

Compute additional columns describing the time a measurement was taken

column_names: List[str] = ['test_time', 'cycle_time']#
enhance(data: DataFrame)#

Add additional columns to the raw data

Parameters:

data – Raw data to be modified