Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looping over a SolutionArray does not include extra items #1203

Closed
bryanwweber opened this issue Feb 20, 2022 · 2 comments · Fixed by #1204
Closed

Looping over a SolutionArray does not include extra items #1203

bryanwweber opened this issue Feb 20, 2022 · 2 comments · Fixed by #1204
Assignees

Comments

@bryanwweber
Copy link
Member

Problem description

Accessing extra items from a SolutionArray in a loop gives an AttributeError.

Steps to reproduce

import cantera as ct
import numpy as np
gas = ct.Solution("gri30.yaml")

T = np.arange(900, 1000, 50)
estimated_ignition_delay_times = np.ones_like(T) * 0.005
ignition_delays = ct.SolutionArray(gas, shape=T.shape, extra={"tau": estimated_ignition_delay_times})
ignition_delays.TP = T, 40.0 * 101325.0
for state in ignition_delays:
    print(state._extra)

Output:

OrderedDict()
...

Behavior

Looping should include the extra information.

System information

@bryanwweber
Copy link
Member Author

Hmm, similarly, accessing a single row of the SolutionArray also does not include the extra information:

>>> ignition_delays[0]._extra
Ordered_Dict()

@ischoegl
Copy link
Member

ischoegl commented Feb 20, 2022

@bryanwweber ... I can reproduce this. As ignition_delays[0] returns a SolutionArray, the _extra property should be propagated.

@ischoegl ischoegl self-assigned this Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants