Repository navigation
Fits merge - #495
Fits merge#495
Conversation
This merges up through r1927 from pyfits' trunk in SVN. Closes the following issues in Astropy: Closes astropy#339 astropy.io.fits.Header totextfile and Header.__init__ disagree on 'endcard' convention Closes astropy#318 Move io.fits external C dependencies into cextern Conflicts: README.txt astropy/io/fits/src/compress.c astropy/io/fits/src/crc32.h astropy/io/fits/src/deflate.h astropy/io/fits/src/fits_hcompress.c astropy/io/fits/src/fits_hdecompress.c astropy/io/fits/src/fitsio.c astropy/io/fits/src/fitsio.h astropy/io/fits/src/inffast.c astropy/io/fits/src/inffast.h astropy/io/fits/src/inffixed.h astropy/io/fits/src/inflate.h astropy/io/fits/src/inftrees.c astropy/io/fits/src/inftrees.h astropy/io/fits/src/pliocomp.c astropy/io/fits/src/quantize.c astropy/io/fits/src/ricecomp.c astropy/io/fits/src/ricecomp.h astropy/io/fits/src/trees.c astropy/io/fits/src/trees.h astropy/io/fits/src/zlib.c astropy/io/fits/src/zlib.h astropy/io/fits/src/zutil.h cextern/cfitsio/crc32.h cextern/cfitsio/deflate.h cextern/cfitsio/fits_hcompress.c cextern/cfitsio/fits_hdecompress.c cextern/cfitsio/inffast.c cextern/cfitsio/inffixed.h cextern/cfitsio/inftrees.c cextern/cfitsio/pliocomp.c cextern/cfitsio/quantize.c cextern/cfitsio/ricecomp.c cextern/cfitsio/trees.c cextern/cfitsio/trees.h cextern/cfitsio/zutil.h setup.cfg src/crc32.h src/deflate.h src/fits_hcompress.c src/fits_hdecompress.c src/inffast.c src/inffixed.h src/inftrees.c src/pliocomp.c src/quantize.c src/ricecomp.c src/trees.c src/trees.h src/zutil.h tox.ini Conflicts: astropy/io/fits/diff.py astropy/io/fits/hdu/base.py astropy/io/fits/hdu/compressed.py astropy/io/fits/hdu/image.py astropy/io/fits/src/compressionmodule.c astropy/io/fits/tests/cfitsio_verify.c astropy/io/fits/tests/test_core.py astropy/io/fits/tests/test_header.py astropy/io/fits/tests/test_image.py astropy/io/fits/tests/test_uint.py
…pression module with a system version of CFITSIO.
|
138k additions? seriously? ;-) This will make the linux package managers happy! I will try and review this broadly, and wil test out the |
|
@astrofrog Most of that is just CFITSIO and its cross product of source modules for getting/putting each data type supported by FITS. I tried to hack it down to a bare minimum required for the pyfits compression module, but that turned out to be too unmanageable from a maintenance perspective. |
…pport Python 2.5.
…ngelog. At this point the pyfits changes kind of dominate the changelog. I hope that's okay but if not we could think of a way of collapsing it (though I'd rather not; the 'What's New' page in the docs will provide a broader overview, I think.
|
Looks like there are some test failures related to the new compression module not building/working properly in Python 3. I'll look into this. |
|
.I got the following error when trying to compile with I presume this is an issue to do with the CFITSIO version? This makes me think, should we check the versions of system libraries and raise a proper error if they are too old? (the same point applies to expat and wcslib). Or is it basically up to the user to make sure the versions work out? I guess we should explicitly list the required versions in the documentation. |
|
There are some version checks, but it looks like I missed that. I can certainly fix it. |
|
Got it building in Python 3, but now I'm getting a segfault. The segfault itself doesn't occur in my compression code, but rather from Numpy. That doesn't necessarily mean there's not a bug in my code somewhere. It's just hard to see it as of yet. |
|
No, I think it is Numpy. I'm using Numpy 1.5.1 on my Python 3.2 installation, apparently. And this is a bug I've seen before where Numpy assumes that an array descriptor's shape will always be a tuple, and is inconsistent about making sure to convert scalar values (such as an int) to a tuple when constructing arrays and such. Should be easy enough to fix. |
This *should* fix all the issues that were causing the build to fail in Conflicts: astropy/io/fits/util.py
|
Oh, I still need to fix @astrofrog's issue with compiling with a <3.28 version of cfitsio. |
Conflicts: README.txt Conflicts: astropy/io/fits/src/compressionmodule.c
|
@astrofrog With the last set of commits I should have improved support for older versions of CFITSIO. Specifically, 3.09 and up should all work. YMMV with earlier versions. Could you give the |
|
Also, where do you think would be the best place to document CFITSIO version support? |
|
Works for me! This looks good to go once you've added a note in the docs about the version number. |
|
Any idea what these Travis failures are all about? It says it can't run |
|
I don't understand, it's been doing that with some other PRs too. I will look into it. |
|
Well, when I run the tests locally with Python 3.2 all the fits tests pass, but I get several errors in the logging tests due to, for some reason, 'asctime' being missing from LogRecords. |
|
Here's how to reproduce the error - it's actually to do with numpy, not astropy: I wonder what changed suddenly. Either numpy 1.6.2 was only recently added to pip, or maybe they did a hot swap? In any case, this is not something I think we can do anything about, so I would trust the staging branch in Jenkins over Travis. |
|
Yup, I'm baffled by that. I'll go ahead and try my staging branch. |
|
@iguananaut - did you try and start the MacOS X staging build from the jenkins interface? (https://jenkins.shiningpanda.com/astropy/job/astropy-staging-iguananaut-osx-10.7-multiconfig/NV=1.5.1,PV=3.1/12/console - it says 'started by user iguananaut'). |
|
Yeah, I did. Did I screw it up? Sorry if so. Edit: I went ahead and deleted the project. I didn't realize the OSX builds weren't hosted by Shining Panda--I'm now guilty of my own pet peeve with Jenkins--sorry about that. |
|
No worries! I forced a new build and it all passes: https://jenkins.shiningpanda.com/astropy/job/astropy-staging-iguananaut-osx-10.7-multiconfig/ |
|
I tried upgrading to this branch, and I am no longer able to read some files I have that are in Rice compressed format, for example http://www.mpia.de/~robitaille/astropy/w20050513_01570_sf_st.fit What has changed that is causing this to fail? |
Well the almost complete rewrite of the compression module would be a start :) What version of CFITSIO did you build/link with? You can double check this with For what it's worth the data in that file is loading for me using the built-in cfitsio and looks fine (assuming that it's supposed to have those dots in the middle of each star--I obviously have no idea what that's supposed to mean). |
|
The holes in the stars are normal (just saturation). I did a clean install and it still doesn't work here. I get: This is on MacOS 10.7. This is strange... |
|
Strange indeed--I realized that when I tested this yesterday I was testing with pyfits, not astropy. But even with this PR on astropy it's working for me. d3fc78c fixed a bug that looked just like that, but you should have that in your copy by now. |
|
I guess there's nothing to do but start knocking out other possibilities. OSX is a start--I'll try testing on there. Also, what Numpy version are you using? I have: |
|
Here's mine: I can try and downgrade numpy |
|
Ah, it works with Numpy 1.6.1 and 1.6.2, but not the latest developer version. Does this help identify the issue? |
|
I'm going to try and git bisect to find out when the breakage occurred |
|
Okay, I got the same error using the latest dev Numpy. So that at least partially explains that. I should try to fix it though. |
|
Don't bother with the bisect--I'm pretty sure it has to do with this: numpy/numpy#438 |
|
I did bisect anyway for fun (never had a chance before), and this is what I get: |
|
Interestingly, the commit I found was much earlier than the issue you pointed to. |
|
I guess it will also cause issues with Numpy 1.7.0 once it's out? |
|
Just confirming that I get the error with Numpy 1.7.0b2. |
|
numpy/numpy#2746 fixes the issue. So for now I'll assume it will get pulled. |
|
Awesome, thanks for following this up! |
|
I think this is going to cause some problems in pyfits' implementation where Numpy 1.8 is concerned. Specifically, it's dropping any references to the raw_data base array that holds the entire table data including the heap which is kind of bizarre. ^ Can you guys elaborate on this? I'm glad if this has been fixed for 1.7/current master, but the .base handling code may change again in the future and this statement is very worrisome. Even with the original pre-fixup code that was originally in 1.7, it shouldn't have been losing references to arrays that are actually holding data... |
|
@iguananaut - just to confirm, updating to the latest numpy dev version now makes this PR work properly. |
…m that it *does* pass when the test suite is run outside of Jenkins, even on the configurations where it was failing.
|
@njsmith Thanks for checking in on this. Let me try to clarify. FITS tables have a strange structure for supporting variable length fields by which it includes a "heap" section to the data after the data itself. Variable length columns then contain just offsets into the heap portion, for the value of that column for each row. So basically the data consists of a table, followed by some additional arbitrary-length data. What I'm doing, in order to keep all the data together, is to create a byte array of all the data, then taking a slice of that for the portion that contains the actual table and viewing it as a recarray with the appropriate columns. The details of retrieving the variable length data from the heap are handled elsewhere. The problem here is that I have some C code that, when passed one of these recarrays, needed to be able to traverse the bases to find the original byte array containing both the table and heap data. It was references to this array that were being lost. To complicate matters, that data is normally mmap'd. What was not lost was the reference to the original |
|
Going ahead and merging this. Travis is happy with it now, as is my Windows staging branch and the OSX staging branch. Linux should be fine. |
…mission#161) (astropy#495) Adding ZodiPy to Affiliated packages (in future "legacy" list) Co-authored-by: Derek Homeier <[email protected]>
This merges up through r1927 from pyfits' SVN repository. It's probably more than any one person can trawl through but I'd appreciate any comments nonetheless. It might be easier to go back to the pyfits repo itself and look through the individual commits.
Before merging this I do need to update the changelog with a list of all the issues closed. This is already added to the documentation in the "PyFITS History" page but the relevant fixes should also be copied over to the actual Astropy changelog.
This also adds support for using
--use-system-cfitsioto build the compression module with an already installed copy of CFITSIO rather than the one I'm including in Astropy. This will close #318.