Preprocessing functions

ionworkspipeline.data_fits.preprocess.pulse_data_to_ocp(pulse_data_in, ocp_file_out=None, method='explicit', include_first_point=True)

Extract the open-circuit potential (OCP) from data from a pulse test (e.g. GITT or HPPC test)

Parameters

pulse_data_instr or pd.DataFrame

The pulse test data to use. Can be a string giving the path to the data, or a DataFrame containing the data.

ocp_file_outstr, optional

The file to write the OCP data to. If not provided, the data is not written.

methodstr, optional

The method to use to extract the OCP. Can be “explicit” (default) or “extrapolation”. If “explicit”, the OCP is taken to be the voltage at the last data point of each cycle. If “extrapolation”, the OCP is calculated by extrapolating the voltage to its asymptote, to account for the relaxation being incomplete at the end of the cycle. Only “explicit” is currently implemented.

include_first_pointbool, optional

Whether to include the first point of the data. Shouuld be True if the first point is after a sufficiently long rest period (i.e. the voltage of the first point is the open-circuit voltage), and False otherwise.

Returns

pd.DataFrame

A dataframe containing the OCP data.

ionworkspipeline.data_fits.preprocess.sort_capacity_and_ocp(data)

For OCP data, make sure that the capacity is always increasing and the voltage is always decreasing

Parameters

data: pd.DataFrame

Pandas dataframe containing the data, should include one column with the voltage and one column with the capacity

ionworkspipeline.data_fits.preprocess.remove_duplicate_ocp(data, capacity_column_name='Capacity [A.h]')

Remove any duplicate capacity and voltage values

ionworkspipeline.data_fits.preprocess.remove_ocp_extremes(data)

Remove any data points at the start and end of the OCP curve where the second derivative of the voltage with respect to capacity is zero. This is to remove any data points where the voltage is not changing smoothly, which can have an outsized effect on the fit. For example, in some datasets, the OCP at the extremes is linearly extrapolated from the first and last few data points (zero second derivative), which can cause a bad fit in the MSMR model.

Parameters

data: pd.DataFrame

Pandas dataframe containing the data, should include one column with the voltage in Volts (“Voltage [V]”) and one column with the capacity in Amp-hours (“Capacity [A.h]”)

Returns

pd.DataFrame

Pandas dataframe containing the trimmed data