question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error with too many children when processing parameter with tabular data

See original GitHub issue

Describe the bug When updating the positive or negative electrode OCP entropic change with tabular data like in:

params.update({"Negative electrode OCP entropic change [V.K-1]": "[data]my_data"}, path="")

There is an error when creating the interpolant in here. The traceback is enourmous, but the last bit is:

~/Documents/Projects/PyBaMM-GEM/PyBaMM/pybamm/parameters/parameter_values.py in _process_symbol(self, symbol)
    512                     print(i, v)
    513                 name, data = function_name
--> 514                 function = pybamm.Interpolant(data, *new_children, name=name)
    515             elif isinstance(function_name, numbers.Number):
    516                 # If the "function" is provided is actually a scalar, return a Scalar

TypeError: __init__() got multiple values for argument 'name'

I’ve identified that, apparently, when procesing these parameters, new_children has actually two elements, but pybamm.Interpolate only expect one child. The second child is assigned to the argument name and therefore the actual keyword argument name is redundant, hence the error.

To Reproduce Run the following script. Attached is the input file. my_data.csv.zip

The error is the same when using the default chemistry or the SPMe and DFN models.

import pybamm

exp = pybamm.Experiment(["Discharge at 1C until 2.5V", 
                         "Rest for 1 hour", 
                         "Charge at 1C until 4.2V",
                         "Hold at 4.2V until 50mA",])

model = pybamm.lithium_ion.SPM(options={"thermal": "x-full"}  )

params = pybamm.ParameterValues(chemistry=pybamm.parameter_sets.Chen2020)
params.update({"Negative current collector surface heat transfer coefficient [W.m-2.K-1]": 0, 
               "Positive current collector surface heat transfer coefficient [W.m-2.K-1]": 0}, 
              check_already_exists=False)
params.update({"Negative electrode OCP entropic change [V.K-1]": "[data]my_data"}, path="")

sim = pybamm.Simulation(model=model, parameter_values=params, experiment=exp)
sim.solve()

Expected behaviour The parameter should be processed without error.

Screenshots None

Additional context

The two children that appear to be causing the problem are:

broadcast(boundary value(X-averaged positive particle concentration))
Maximum concentration in positive electrode [mol.m-3]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dalonsoacommented, Jul 15, 2020

To NOT close this issue. I can’t spell 🤦

1reaction
tinosulzercommented, Jul 14, 2020

You can either do that or create the function in your main file and reference it directly (pass the function object). If you do the first option, you need to set the path to point to where the function is defined. Did you mean do close or don’t close?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
SQLSTATE values and common error codes - Db2 - IBM
A non-atomic statement attempted to process multiple rows of data, but no row was inserted and one or more errors occurred. 22531, The...
Read more >
GraphQL query best practices
When creating queries and mutations, follow these best practices to get the most out of both GraphQL and Apollo tooling. Name all operations....
Read more >
Web.Contents(), M Functions And Dataset Refresh Errors In ...
Adding a custom column to the table returned by the first step, and calling ... Data source error Unable to refresh the model...
Read more >
Ten Common Database Design Mistakes - Simple Talk
In a database, the process of normalization, as a means of breaking down and isolating data, takes every table to the point where...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found