-
Notifications
You must be signed in to change notification settings - Fork 5
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
Allow SolutionArray to append more than one state at a time #57
Comments
I was going to write that there was no way to make the return value immutable, but it turns out that you actually can (more or less) - https://stackoverflow.com/questions/5541324/immutable-numpy-array. It would probably make sense to set this flag on arrays returned by I don't think there are any cases where making properties mutable in this direction makes sense -- we don't normally allow single properties like
This seems like an ordinary bug, so maybe it would be better to track that as an Issue on the main repository.
By analogy with the methods on the |
I agree. I'll make a new enhancements issue for this since it is broader than just
I wasn't sure, since someone could hypothetically want a sequence of some sort embedded in the array. But since it raises a
On the other hand, I've focused this enhancement issue on just this last point. |
The syntax for |
That makes sense, especially the part about reducing the amount of guessing about shape that has to be done 👍 |
Abstract
In the course of working on Cantera/cantera#838, I found a few edge cases where the
SolutionArray
interface might be able to be improved.Problem Descriptions
When Fixes Indexed assignment of extra columns in SolutionArray cantera#838 is merged, it will be possible to assign to slices of extra items. However, it is not possible to assign to slices of properties of the underlying
Solution
. This is inconsistent, and should either be possible or raise a useful error message. Right now, it just fails silently:Moved to Make arrays of computed properties on Solution and SolutionArray immutable #58.
When appending a state, an item of length greater than 1 can be passed for any extra items. This raises a DeprecationWarning from NumPy, and gives a... less than useful result:
Yes, that's a list as an item in a NumPy array. Note the first three elements (
101325.000...
) are garbage data that was available at the memory address thatnp.empty()
used to create the array forprop
. Moved to Sequences can be appended as extra items on a SolutionArray cantera#895.It would useful to be able to append more than one state at a time, but this isn't possible:
References
Cantera/cantera#838
The text was updated successfully, but these errors were encountered: