gammapy/enrico

error related to scfile

Closed this issue · 1 comments

I got an error

************************************************************

*** 8 gtsrcmap --- Make a source map

************************************************************

Traceback (most recent call last):
File "/Users/ajaysharma/enrico_old/bin/enrico_sed", line 48, in
liste = np.genfromtxt(sys.argv[1],dtype="str",unpack=True)
File "/opt/anaconda3/envs/fermi2/lib/python3.7/site-packages/numpy/lib/npyio.py", line 2124, in genfromtxt
raise ValueError(errmsg)
ValueError: Some errors were detected !
Line #9 (got 1 columns instead of 3)
Line #20 (got 1 columns instead of 3)
Line #29 (got 1 columns instead of 3)
Line #30 (got 4 columns instead of 3)
Line #31 (got 4 columns instead of 3)
Line #37 (got 1 columns instead of 3)
Line #43 (got 1 columns instead of 3)
Line #49 (got 1 columns instead of 3)
Line #54 (got 1 columns instead of 3)
Line #70 (got 1 columns instead of 3)
Line #79 (got 1 columns instead of 3)
Line #85 (got 1 columns instead of 3)
Line #101 (got 1 columns instead of 3)
Line #115 (got 1 columns instead of 3)
Line #127 (got 1 columns instead of 3)
Line #146 (got 1 columns instead of 3)
Line #162 (got 1 columns instead of 3)
Line #170 (got 1 columns instead of 3)
Line #185 (got 1 columns instead of 3)
Line #199 (got 1 columns instead of 3)
Line #210 (got 1 columns instead of 3)
Line #216 (got 1 columns instead of 3)
Line #226 (got 1 columns instead of 3)
Line #230 (got 1 columns instead of 3)
Line #244 (got 1 columns instead of 3)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/ajaysharma/enrico_old/bin/enrico_sed", line 55, in
sed(config,infile)
File "/Users/ajaysharma/enrico_old/bin/enrico_sed", line 13, in sed
run(infile)
File "/Users/ajaysharma/enrico_old/enrico/RunGTlike.py", line 200, in run
FitRunner,Fit,ListOfAnalysisObjects = GenAnalysisObjects(config)
File "/Users/ajaysharma/enrico_old/enrico/RunGTlike.py", line 173, in GenAnalysisObjects
tag=typeirfs[evt], verbose = verbose)
File "/Users/ajaysharma/enrico_old/enrico/RunGTlike.py", line 32, in Analysis
FitRunner.GenerateFits() #Generates fits files for the rest of the products
File "/Users/ajaysharma/enrico_old/enrico/fitmaker.py", line 88, in GenerateFits
self.obs.SrcMap()
File "/Users/ajaysharma/enrico_old/enrico/gtfunction.py", line 542, in SrcMap
srcMaps['scfile'] = self.ft2
File "/opt/anaconda3/envs/fermi2/lib/python3.7/site-packages/fermitools/GtApp.py", line 43, in setitem
self.pars[key] = value
File "/opt/anaconda3/envs/fermi2/lib/python3.7/site-packages/fermitools/pil.py", line 74, in setitem
raise KeyError(name)
KeyError: 'scfile'

Hi, this problem has been resolved. If someone encounters a similar issue, need to follow the commands that I have mentioned below.

You can find the "RunGTlike.py" file within enrico/enrico/ directory and edit it following way to overcome the problem.
In line 268, 269 of "RunGTlike.py", the lines are probably-
"""
for AnalysisComponent in ListOfAnalysisObjects:
AnalysisComponent.obs.ModelMap(outXml)
"""
Just insert one line with 'if' statement in the following way (be careful about the proper indentations)-

"""
if config['analysis']['likelihood'] == 'binned' :
for AnalysisComponent in ListOfAnalysisObjects:
AnalysisComponent.obs.ModelMap(outXml)
"""

That’s it. It will work just like it did for me.