fermiPy / fermipy

Fermi-LAT Python Analysis Framework
http://fermipy.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
50 stars 51 forks source link

Cannot read keyword "NDSKEYS" in file "/home/cta/Federica/AHEAD/3C216/srcmap_00.fits" (CFITSIO ERROR 202: keyword not found in header) #546

Open fgiacchi86 opened 1 year ago

fgiacchi86 commented 1 year ago

Hello,

I am analysing a source with fermipy but it is stuck with an error that I am not able to solve it:

config.yaml

data: evfile : ft1.lst scfile : L2306060538523993017270_SC00.fits

binning: roiwidth : 10.0 binsz : 0.1 binsperdec : 8

selection : emin : 30 emax : 2000000 zmax : 90 evclass : 128 evtype : 3 tmin : 239557417 tmax : 707705278 filter : 'DATA_QUAL>0 && LAT_CONFIG==1' roicut : 'no' target : '4FGL J0910.0+4257'

gtlike: edisp : True irfs : 'P8R3_SOURCE_V3' edisp_disable : [‘isodiff‘,‘galdiff‘]

model: src_roiwidth : 15.0 galdiff : '$FERMI_DIFFUSE_DIR/gll_iem_v07.fits' isodiff : '$FERMI_DIFFUSE_DIR/iso_P8R3_SOURCE_V3_v1.txt' catalogs : ['4FGL-DR3']

I have the following error: 2023-06-12 16:14:30 INFO GTAnalysis.init():

fermipy version 1.2.0 ScienceTools version 2.2.0 2023-06-12 16:14:32 INFO GTAnalysis.setup(): Running setup. 2023-06-12 16:14:32 INFO GTBinnedAnalysis.setup(): Running setup for component 00 2023-06-12 16:14:32 INFO GTBinnedAnalysis._select_data(): Skipping data selection. 2023-06-12 16:14:32 INFO GTBinnedAnalysis._create_ltcube(): Skipping LT Cube. 2023-06-12 16:14:34 INFO GTBinnedAnalysis._create_expcube(): Skipping gtexpcube. WARNING: FITSFixedWarning: RADECSYS= 'FK5 ' the RADECSYS keyword is deprecated, use RADESYSa. [astropy.wcs.wcs] WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF. Set MJD-OBS to 54682.655283 from DATE-OBS. Set MJD-END to 60101.011193 from DATE-END'. [astropy.wcs.wcs] 2023-06-12 16:14:34 INFO GTBinnedAnalysis._create_srcmaps(): Skipping gtsrcmaps. 2023-06-12 16:14:34 INFO GTBinnedAnalysis.setup(): Finished setup for component 00 2023-06-12 16:14:34 INFO GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00.

RuntimeError Traceback (most recent call last) /tmp/ipykernel_441580/4286365442.py in ?() ----> 2 gta = GTAnalysis('config.yaml',logging={'verbosity' : 3}) 3 gta.setup()

~/mambaforge/envs/fermipy/lib/python3.9/site-packages/fermipy/gtanalysis.py in ?(self, init_sources, overwrite, **kwargs) 1086 for i, c in enumerate(self.components): 1087 c.setup(overwrite=overwrite) 1088 1089 # Create likelihood -> 1090 self._create_likelihood() 1091 1092 # Determine tmin, tmax 1093 for i, c in enumerate(self._components):

~/mambaforge/envs/fermipy/lib/python3.9/site-packages/fermipy/gtanalysis.py in ?(self, srcmdl) 1113 create a SummedLikelihood.""" 1114 1115 self._like = SummedLikelihood() 1116 for c in self.components: -> 1117 c._create_binned_analysis(srcmdl) 1118 self._like.addComponent(c.like) 1119 1120 self.like.model = self.like.components[0].model

~/mambaforge/envs/fermipy/lib/python3.9/site-packages/fermipy/gtanalysis.py in ?(self, xmlfile, kwargs) 5453 binnedExpMap=self.files['bexpmap'], 5454 irfs=self.config['gtlike']['irfs']) 5455 self.logger.debug(kw) 5456 -> 5457 self._obs = ba.BinnedObs(utils.unicode_to_str(kw)) 5458 5459 5460 # Create BinnedAnalysis

~/mambaforge/envs/fermipy/lib/python3.9/site-packages/fermitools/BinnedAnalysis.py in ?(self, srcMaps, expCube, binnedExpMap, irfs, phased_expmap) 67 68 pyLike.AppHelpers_checkExposureMap(srcMaps, binnedExpMap) 69 # EAC switch to using AppHelpers... 70 self.countsMap = pyLike.AppHelpers_readCountsMap(srcMaps) ---> 71 self._createObservation(srcMaps, expCube, self.irfs)

~/mambaforge/envs/fermipy/lib/python3.9/site-packages/fermitools/BinnedAnalysis.py in ?(self, srcMaps, expCube, irfs) 72 def _createObservation(self, srcMaps, expCube, irfs): 73 self._respFuncs = pyLike.ResponseFunctions() ---> 74 self._respFuncs.load_with_event_types(irfs, "", self.srcMaps, "") 75 self._expMap = pyLike.ExposureMap() 76 self._scData = pyLike.ScData() 77 self._roiCuts = pyLike.RoiCuts()

~/mambaforge/envs/fermipy/lib/python3.9/site-packages/fermitools/pyLikelihood.py in ?(self, respFuncs, respBase, filename, extname) 6592 def load_with_event_types(self, respFuncs, respBase, filename, extname): 6593 r"""load_with_event_types(ResponseFunctions self, std::string const & respFuncs, std::string const & respBase, std::string const & filename, std::string const & extname)""" -> 6594 return _pyLikelihood.ResponseFunctions_load_with_event_types(self, respFuncs, respBase, filename, extname)

RuntimeError: Cannot read keyword "NDSKEYS" in file "/home/cta/Federica/AHEAD/3C216/srcmap_00.fits" (CFITSIO ERROR 202: keyword not found in header)

Checking the response of a similar error, a solution could be later fermipy 1.1.5 version... and I use fermipy 1.2.0. So it is not the solution for me. I have checked also the energy range...but it is right. Any help?

omodei commented 3 months ago

Ciao Federica, this issue seems to be related to fermitools gtsrcmap, not to fermipy. Can you try to simply run the gtsrcmap command and see hat happens?