fermi-lat / Likelihood

BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

BinnedAnalysis does not accept certain source names #69

Closed eacharles closed 4 years ago

eacharles commented 4 years ago

https://jira.slac.stanford.edu/projects/LK/issues/LK-161

eacharles commented 4 years ago

Ok, this is a really weird issue.

The problem is that the function:

tip::IFileSvc::instance().readExtension(filename,extension)

Is working in the case that extenstion is "JB1909" even though no such extension exists. This is way in the guts of the tip interface. I think it comes down to the fact that it is using:

fits_open_file(&fp, const_cast<char *>(file_name.c_str()), READWRITE, &status);

where file_name is something like "ccube_00.fits[JB1909]" at it is treating the JB1909 as a filter.

I've fixed this by requiring that images have at least 2 axes. This might break stuff elsewhere, so some testing will be required.

eacharles commented 4 years ago

Ok, the test I mentioned above failed because exactly the same problem occurs when trying to write the JB1909 head.
This is really an issue with cfitsio and with the way it totally permeates the design of TIP. Rather than try to fix it we should just avoid source names that will be interpreted as filters, see here: https://heasarc.gsfc.nasa.gov/docs/software/fitsio/quick/node15.html