Current-driven objective¶
Objectives for fitting the data generated by a current-driven experiment.
- class ionworkspipeline.objectives.CurrentDriven(data_input, options=None, callbacks=None, custom_parameters=None, constraints=None, penalties=None, parameters=None)¶
Objective for generic current-driven experiment.
Parameters¶
- data_inputstr or dict
The data to use for the fit, see
FittingObjective.- optionsdict, optional
A dictionary of options to pass to the objective.
- model: :class:
pybamm.BaseModel The model to fit. No default is provided, but this option is required (a model must be passed in).
- model: :class:
- independent variable: string
Whether to use voltage or time as the independent variable. Default is “time”. In some cases, it may be more appropriate to use voltage as the independent variable, and the objective variables will be interpolated to match the voltage data.
- simulation_kwargs: dict
Keyword arguments to pass to the simulation (
iwp.Simulation). If no experiment is provided, the default is {“output_variables”: [“Voltage [V]”, “Current [A]”]}. Otherwise, the default is None.
- objective variables: list of strings
The variables to fit to. If independent variable is “time”, this defaults to [“Voltage [V]”] and can be a list of any variables except “Time [s]”. If independent variable is “voltage”, this defaults to [“Time [s]”] and cannot be changed.
- interpolant_atol: float
Absolute tolerance for the current interpolant. Default is the solver atol if a solver is provided in simulation_kwargs, otherwise 1e-6.
- interpolant_rtol: float
Relative tolerance for the current interpolant. Default is the solver rtol if a solver is provided in simulation_kwargs, otherwise 1e-4.
- interactive_preprocessing: bool
Whether to use interactive preprocessing to adjust interpolant_atol and interpolant_rtol based on the current data. Default is False.
- solver_max_save_points: int, optional
Maximum number of points to save in the solver. Disabled by default.
- callbackslist of callable, optional
A class with methods that get called at various points during the datafit process
- custom_parametersdict, optional
A dictionary of custom parameters to use for the objective. Deprecated, use parameters instead.
- constraintslist[Constraint], optional
A list of equality and inequality constraints to apply to the objective.
- penaltieslist[Penalty], optional
A list of penalties to apply to the objective.
- parametersdict or
pybamm.ParameterValues, optional Objective-specific parameter values merged into the global parameter values before fitting. Default is None.
Extends:
ionworkspipeline.data_fits.objectives.fitting_objective.SimulationObjective- build(parameter_values)¶
Build the objective.
Parameters¶
- parameter_valuespybamm.ParameterValues
The parameter values to use for the objective.
- complete(parameter_values: ParameterValues)¶
Complete the objective by evaluating custom parameters, merging objective-specific parameter values, building the objective, and applying regularization postfix.
Parameters¶
- parameter_valuespybamm.ParameterValues
The parameter values to use for the objective.
- classmethod default_options() dict[str, Any]¶
Return the default options for the CurrentDriven objective.
- default_validation_plot_types: list[str] | None = ['model data', 'error']¶
Default list of validation plot type names for this objective.
Subclasses that support validation should override. Return
Noneto use the pipeline fallback (e.g.["model data", "error"]); return[]for no plots.
- prepare_validation_results(results: dict, summary_stats: list) tuple[list[dict[str, float]], dict[str, float]]¶
Prepare validation results for CurrentDriven objective.
Parameters¶
- resultsdict
The raw results from running the objective.
- summary_statslist
List of summary statistic cost functions to compute.
Returns¶
- tuple[list[dict[str, float]], dict[str, float]]
A tuple of (computed_statistics, validation_result) where: - computed_statistics is a list of dictionaries with computed metric names and values - validation_result is a dictionary of validation data
- property remove_model_events: bool¶
Whether to remove the model events during simulation. Default is True only if the independent variable is time, False otherwise.