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

Deprecate use of chararray in io.fits #3862

Open
embray opened this issue Jun 18, 2015 · 4 comments
Open

Deprecate use of chararray in io.fits #3862

embray opened this issue Jun 18, 2015 · 4 comments

Comments

@embray
Copy link
Member

embray commented Jun 18, 2015

As raised in #3854 and earlier issues, Numpy is gradually trying to deprecate and eventually kill off the old Numarray chararray class. This is fine, but io.fits still uses it for FITS tables. This is especially important in supporting FITS ASCII tables, for its ability to automatically rstrip() individual strings returned from the array.

However, for FITS data we can just use our own class that has this capability (we don't need any of the other chararray methods). It might be nice to go ahead and use some version of my encoded_text_array class for FITS string columns (and possible string columns in other Astropy tables), and to add optional rstrip support to that class (it already has automatic rstripping, but that should probably be optional).

I think for backwards compat the new class should inherit chararray methods, but they would all raise deprecation warnings. Similarly isinstance(..., chararray) checks should raise a deprecation warning (that the class will no longer be a chararray subclass after long).

@astrofrog
Copy link
Member

Don't think this will happen for 1.1 so removing milestone

@pllim
Copy link
Member

pllim commented Feb 14, 2024

Hmm did numpy 2.0 already forced our hands in this issue (maybe #15363 ) or not?

@neutrinoceros
Copy link
Contributor

@pllim I don't think so. In fact, numpy 2.0 has received some attention in that area. For instance:

Besides, np.chararray is still very much used in io.fits, so when the time comes, I'm sure we'll know 😅

@mhvk
Copy link
Contributor

mhvk commented Feb 14, 2024

I think the idea is still that we'd slowly stop using np.char and instead directly use functions from the new np.strings. But there is no specific deprecation planned for 2.0 (and the ufuncs are now used inside chararray so we'll benefit from the speed-up).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants