You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After getting the initial and estimated parameters using optim = pybop.XNES( cost, sigma0=[1e-3, 1e-3, 1e-3, 20, 20], max_unchanged_iterations=30, max_iterations=100, ) x, final_cost = optim.run() print("Initial parameters:", optim.x0) print("Estimated parameters:", x),
I used: pybop.quick_plot(problem, problem_inputs=x, title="Optimised Comparison");
and it gives an error:
`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[54], line 1
----> 1 pybop.quick_plot(problem, problem_inputs=x, title="Optimised Comparison")
File ~\anaconda3\Lib\site-packages\pybop\plotting\plot_problem.py:77, in quick_plot(problem, problem_inputs, show, **layout_kwargs)
73 plot_dict.traces.append(target_trace)
75 if isinstance(problem, FittingProblem):
76 # Compute the standard deviation as proxy for uncertainty
---> 77 plot_dict.sigma = np.std(model_output[i] - target_output[i])
79 # Convert x and upper and lower limits into lists to create a filled trace
80 x = xaxis_data.tolist()
ValueError: operands could not be broadcast together with shapes (471,) (436603,)`
Which I am thinking is the size of my experimental dataset that is different from the created model.
In this case the identified parameters are causing the predicted model to hit an event in the PyBaMM solver. I suspect that a voltage limit is triggered and as such the simulation is stopped before completion. Given the length of the data you are trying to fit, this is somewhat to be expected. Thevenin identification works best with shorter time series data, both for robustness and performance. I would recommend splitting the dataset you have into smaller sections and trying to identify from each. In addition, you can adjust the max_unchange_iterations to avoid stopping the process prematurely. Finally, adjusting the upper and lower voltage limits can help with convergence when identifying parameters close to the limits.
Thanks for exposing this sharp point in the codebase, the error is not very descriptive and should be updated.
Python Version
3.12.4
Describe the bug
After getting the initial and estimated parameters using
optim = pybop.XNES( cost, sigma0=[1e-3, 1e-3, 1e-3, 20, 20], max_unchanged_iterations=30, max_iterations=100, ) x, final_cost = optim.run() print("Initial parameters:", optim.x0) print("Estimated parameters:", x)
,I used:
pybop.quick_plot(problem, problem_inputs=x, title="Optimised Comparison");
and it gives an error:
`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[54], line 1
----> 1 pybop.quick_plot(problem, problem_inputs=x, title="Optimised Comparison")
File ~\anaconda3\Lib\site-packages\pybop\plotting\plot_problem.py:77, in quick_plot(problem, problem_inputs, show, **layout_kwargs)
73 plot_dict.traces.append(target_trace)
75 if isinstance(problem, FittingProblem):
76 # Compute the standard deviation as proxy for uncertainty
---> 77 plot_dict.sigma = np.std(model_output[i] - target_output[i])
79 # Convert x and upper and lower limits into lists to create a filled trace
80 x = xaxis_data.tolist()
ValueError: operands could not be broadcast together with shapes (471,) (436603,)`
Which I am thinking is the size of my experimental dataset that is different from the created model.
Steps to reproduce the behaviour
Using experimental dataset:
`file_loc = "15Ah_Rectangular_7A5_10cycles.csv"
df = pd.read_csv(file_loc, index_col=None, na_values=["NA"])
df = df.drop_duplicates(subset=["Time"], keep="first")
dataset = pybop.Dataset(
{
"Time [s]": df["Time"].to_numpy(),
"Current function [A]": df["Current"].to_numpy(),
"Voltage [V]": df["Voltage"].to_numpy(),
}
)`
In the ECM HPPC example.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: