GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Dealing with deprecation of setting dtype in record arrays, and unitless times by mhvk · Pull Request #19584 · astropy/astropy Conversation
|
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Coming over from NumPy, curious:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@seberg - unfortunately, older astropy with new numpy will get real failures, since this subclass of recarray tries to set the dtype but that is circumvented by its inherited _set_dtype = None. If we want to solve that on the numpy side (still not clear to me we need to), I think we cannot yet introduce _set_dtype = None in recarray...
As for views, as commented in-line, for one case a view makes sense, but the other may be less so, as all the bytes are swapped in-place too (i.e., that whole _binary_table_byte_swap routine should be replaced, which is a bit trickier...)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| else: | ||
| # TODO: see if a a view is possible still; initial trial gives | ||
| # error in test_table.py::TestVLATables::test_empty_vla_raw_data. | ||
| np.ndarray._set_dtype(data, data.dtype.newbyteorder(">")) |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This _set_dtype could fairly easily be changed into a .view(). See #19585 for that effort.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| else: | ||
| # TODO: ensure self.data is never used with this context manager, so that | ||
| # a view here would work (and the second _set_dtype can be removed). | ||
| np.ndarray._set_dtype(data, new_dtype) |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
A view here is possible, but not necessarily all that logical, since the array has also been byteswapped inplace. See #19595 for a rewrite that doesn't byteswap either.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Arggggg... So this is generally borked, sure these are crazy subclasses, but :(... In theory, I suppose we would have to walk the subclasses: if Unless we make up some API so that (Maybe this is all too super crazy, but...) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot for picking this up, I'm barely managing my task list these days
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if NUMPY_LT_2_5: | ||
| data.dtype = data.dtype.newbyteorder(">") | ||
| else: | ||
| # TODO: see if a a view is possible still; initial trial gives |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
to be clear, is the intention to handle this TODO before this is merged ? (if not, I'd rather have an open issue and no comment there)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
See #19585...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@neutrinoceros, @saimn - yes, I'd like to get rid of any dtype setting, and, after basically spending the day on it, came up with #19585. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
f89b7e3 to
15b2c2c
Compare
There was an error while loading. Please reload this page.
|
Just as a note: I have not quite given up hope that we might find a slightly safer approach in NumPy. But, I think this solution will be fine either way, of course. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@seberg we're in this together ! thank you for your patience and continued support ! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…rd arrays, and unitless times
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
BUG: incoming incompatibility between masked and numpy 2.5 (dev)
There was an error while loading. Please reload this page.