-
Notifications
You must be signed in to change notification settings - Fork 27
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
support for structured data #40
Comments
Thank for the input @esheldon. In this particular example the number of parameters to pass is of course reduced but on the other hand the equation becomes more difficult to read. Anyway I do see cases where this could be convenient. However, introducing structured arrays is a bit tricky:
I’m personally not a big fan of structured arrays (I don’t like the synthax |
(sorry the formatting didn't go through in the email) structured arrays map directly to an array of C structures with the same dt=[('ra','f8'),('dec','f8'),('index','i4')]
# maps to packed C structures, no alignment
a = zeros(n, dtype=dt)
# maps to normal, unpacked C structures
dtype=numpy.dtype(dt, align=True)
a = zeros(n, dtype=dtype) For the packed version you would need to make sure the struct in C is also In C the python notation: structured arrays are built into numpy, so they are in a sense fundamental. Also the sarray.a notation conflicts with python attributes. For example, you |
It is convenient to have data packed into structures. For example, if a
calculation requires a large number of pieces of information, it is preferable
to have the following ( I realize this is a bit of a contrived example)
as opposed to
This could be solved by accepting structured arrays for input
(edited for bugs)
The text was updated successfully, but these errors were encountered: