Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of ROSAT RMF file with AstroPy
This commit adds tests and fixes the code handling the ROSAT RMF with the AstroPy I/O backend. There is a known issue with the CIAO Crates library in CIAO 4.9 which means that the ROSAT RMF can not be read in using the Crates I/O backend with Python 3.5 (it works okay with Python 2.7). The tests are therefore setup to skip certain combinations of Python and backend. The test values used as the "truth" here were calculated using CIAO 4.9/Python 2.7 and validated against XSPEC 12.9.1p. It leverages a fixture for cleaning the Sherpa ui state from changeset 0d44a3e An explanation of the fix for handling non-variable-length RMF files with the AstroPy backend: PR sherpa#358 added AstroPy support for RMF files where the data was not encoded using FITS variable-length arrays for the matrix. This means that the data can not just be concatenated together. Instead each row in the matrix (which, in this case, is a regular nchannels by nbins array) has to be subset (maybe multiple times). The commit I added to do this - cfad850 worked in the Swift case, where the F_CHAN/N_CHAN values were set up to effectively remove the "space saving" mechanism they provide (that is, all elements of each row in the MATRIX column are used). It does not work for cases where F_CHAN/N_CHAN are not set to 0/nbins for each row. The code was embarassingly-confused over what it was meant to be doing, and only worked for the Swift case because of the data's simplified structure.
- Loading branch information