Workflows

Collections of pre-defined workflows for common tasks. All of the workflows implement a fit_plot_save function which typically takes in the data, initial guesses for parameters, and other optional arguments, and saves the fitted parameters and plots of the fit.

ionworkspipeline.workflows.half_cell_ocp.fit_plot_save(electrode, data, params_to_fit, known_params, save_dir=None, filename=None, objective=<class 'ionworkspipeline.data_fits.objectives.ocp_msmr.MSMRHalfCell'>, objective_kwargs=None, datafit_kwargs=None, show_plot=False)

A workflow to fit the MSMR model to OCP data and plot and save the results. The function uses sets up the objective and data fit and runs the fit. The fitted parameters are saved to a JSON file and the OCP data is saved to a CSV file.

Parameters

electrodestr

The electrode to fit the MSMR model to. Must be either “positive” or “negative”.

datapd.DataFrame

The OCP data to fit the MSMR model to.

params_to_fitdict

The parameters to fit. Should be a dictionary of the form {parameter_name: ionworkspipeline.Parameter}.

known_paramsdict

The known parameters. Should be a dictionary of the form {parameter_name: value} and contain “Ambient temperature [K]” (the temperature at which the data was collected).

save_dirstr, optional

The directory to save the fit results and plots to. If not provided, the results are not saved.

filenamestr, optional

The filename to save the fit results and plots to. If not provided, the filename is “ocp_msmr_{electrode}”.

objectiveionworkspipeline.objectives.Objective, optional

The objective to use for the fit. Default is ionworkspipeline.objectives.MSMRHalfCell.

objective_kwargsdict, optional

Additional keyword arguments to pass to the objective function.

datafit_kwargsdict, optional

Additional keyword arguments to pass to the data fit object.

show_plotbool, optional

Whether to show the plot. Default is False.

Returns

resionworkspipeline.Result

The results of the fit.

all_fig_axesdict

A dictionary with keys “fit” and “trace” containing the figure and axes objects for the fit and parameter trace plots.

ionworkspipeline.workflows.full_cell_ocv.fit_plot_save(data, params_to_fit, known_params, save_dir=None, filename=None, objective=<class 'ionworkspipeline.data_fits.objectives.ocp_msmr.MSMRFullCell'>, objective_kwargs=None, datafit_kwargs=None, show_plot=False)

A workflow to fit the MSMR model to full-cell OCV data and plot and save the results. The function sets up the objective and data fit and runs the fit. The fitted parameters are saved to a JSON file.

Parameters

datapd.DataFrame

The full-cell OCV data to fit the MSMR model to.

params_to_fitdict

The parameters to fit. Should be a dictionary of the form {parameter_name: ionworkspipeline.Parameter}.

known_paramsdict

The known parameters. Should be a dictionary of the form {parameter_name: value} and contain the MSMR parameters for each half-cell and “Ambient temperature [K]” (the temperature at which the data was collected).

save_dirstr, optional

The directory to save the fit results and plots to. If not provided, the results are not saved.

filenamestr, optional

The filename to save the fit results and plots to. If not provided, the filename is “ocv_msmr_full_cell”.

objectiveionworkspipeline.objectives.Objective, optional

The objective to use for the fit. Default is ionworkspipeline.objectives.MSMRFullCell.

objective_kwargsdict, optional

Additional keyword arguments to pass to the objective function.

datafit_kwargsdict, optional

Additional keyword arguments to pass to the data fit object.

show_plotbool, optional

Whether to show the plot. Default is False.

Returns

resionworkspipeline.Result

The results of the fit.

all_fig_axesdict

A dictionary with keys “fit” and “trace” containing the figure and axes objects for the fit and parameter trace plots.