Skip to main content
An ArrayDataFit runs the same fit independently at each value of an independent variable, and returns the fitted parameter as a 2xN array — one row holding the independent-variable values and the other holding the corresponding fitted values. This is the right tool when the parameter you are fitting is expected to depend on a state variable, and you want a sampled function rather than a single scalar. Common examples:
  • Diffusivity vs. stoichiometry from a GITT or pulse experiment — one fit per pulse, keyed by the midpoint stoichiometry of that pulse.
  • Exchange-current density or diffusivity vs. temperature — one fit per chamber temperature.
  • OCP-derived parameters vs. SOC — one fit per SOC setpoint.

How it differs from a regular DataFit

A regular DataFit runs one optimization against all of its objectives together, producing a single best-fit value per parameter. An ArrayDataFit runs one optimization per key of objectives, producing a fitted value per key. The keys themselves are the independent-variable values.
DataFitArrayDataFit
Number of optimizationsOneOne per objectives key
Result shape per parameterScalar2xN array ([independent_var_values, fitted_values])
Use whenParameter is a single numberParameter is a sampled function of an independent variable

Python usage

import ionworkspipeline as iwp

# objectives keyed by the independent-variable value (here: midpoint
# stoichiometry of each pulse)
objectives = {
    0.25: iwp.objectives.Pulse(data_pulse_25, options={"model": model}),
    0.50: iwp.objectives.Pulse(data_pulse_50, options={"model": model}),
    0.75: iwp.objectives.Pulse(data_pulse_75, options={"model": model}),
}

array_fit = iwp.ArrayDataFit(
    objectives,
    parameters={
        "Positive particle diffusivity [m2.s-1]": iwp.Parameter(
            "D_p", initial_value=1e-14, bounds=(1e-15, 1e-13)
        ),
    },
)

result = array_fit.run(parameter_values)

# result.parameter_values["Positive particle diffusivity [m2.s-1]"]
# is a 2x3 array: row 0 = [0.25, 0.50, 0.75], row 1 = fitted D_p values

API usage

The pipeline API accepts an array_data_fit element with the same top-level fields as data_fit. The keys of objectives are the independent-variable values:
pipeline_config = {
    "elements": {
        "known values": {"element_type": "entry", "values": parameter_values},
        "fit diffusivity vs sto": {
            "element_type": "array_data_fit",
            "objectives": {
                0.25: {"objective": "Pulse", "data": "db:meas-pulse-25", ...},
                0.50: {"objective": "Pulse", "data": "db:meas-pulse-50", ...},
                0.75: {"objective": "Pulse", "data": "db:meas-pulse-75", ...},
            },
            "parameters": {
                "Positive particle diffusivity [m2.s-1]": {
                    "bounds": [1e-15, 1e-13],
                    "initial_value": 1e-14,
                },
            },
        },
    },
}

pipeline = client.pipeline.create(pipeline_config)
See the SimplePipeline guide and the API reference for the full set of options shared with DataFit (cost, optimizer, multistarts, priors, etc.).

Introduction to Data Fitting

Background on objectives, parameters, and optimizers

Objective Functions

Choose the right objective for your data