fermi-lat / Likelihood

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

ERROR: Caught N3tip12TipExceptionE at the top level: Could not open FITS extension #116

Closed 87Steven-Hsu closed 1 year ago

87Steven-Hsu commented 1 year ago

Hi,

I am working on the Fermi gamma-ray observation on AGN. I am following the "AGN Analysis with Binned Likelihood" tutorial on Fermi website. But i occured a problem when i am processing "Source Map" by using "gtsrcmaps". Please lead me to find the problem i occured. Thank you.

=================================

Here is my code

data_path = '/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551'

urllib.request.urlretrieve('https://fermi.gsfc.nasa.gov/ssc/data/analysis/user/make4FGLxml.py', 'make4FGLxml.py') urllib.request.urlretrieve('https://fermi.gsfc.nasa.gov/ssc/data/access/lat/10yr_catalog/gll_psc_v26.xml', data_path+'/gll_psc_v26.xml')

!ln -s $FERMI_DIR/refdata/fermi/galdiffuse/iso_P8R3_SOURCE_V3_v1.txt '/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/iso_P8R3_SOURCE_V3_v1.txt' !ln -s $FERMI_DIR/refdata/fermi/galdiffuse/gll_iem_v07.fits '/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/gll_iem_v07.fits'

from make4FGLxml import *

mymodel = srcList(data_path+'/gll_psc_v26.xml', data_path+'/binned_gti.fits', data_path+'/model.xml')

mymodel.makeModel(data_path+'/gll_iem_v07.fits', data_path+'/gll_iem_v07', # .fits data_path+'/iso_P8R3_SOURCE_V3_v1.txt', data_path+'/iso_P8R3_SOURCE_V3_v1')

expcube = " '" + data_path + "/ltcube.fits' " # here cmap = " '" + data_path + "/binned_ccube.fits' " srcmdl = " '" + data_path + "/model.xml' " # new gene bexpmap = " '" + data_path + "/binned_exp_map.fits' " # new gene outfile = " '" + data_path + "/binned_srcmaps.fits' " # new gene

my_apps.srcMaps['expcube'] = expcube my_apps.srcMaps['cmap'] = cmap my_apps.srcMaps['srcmdl'] = srcmdl my_apps.srcMaps['outfile'] = outfile my_apps.srcMaps['bexpmap'] = bexpmap my_apps.srcMaps['irfs'] = 'CALDB'

my_apps.srcMaps.run()

=================================

Here is my output and error message

time -p gtsrcmaps scfile= sctable="SC_DATA" expcube= '/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/ltcube.fits' cmap= '/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/binned_ccube.fits' srcmdl= '/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/model.xml' bexpmap= '/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/binned_exp_map.fits' wmap=none outfile= '/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/binned_srcmaps.fits' irfs="CALDB" evtype="INDEF" convol=yes resample=yes rfactor=2 minbinsz=0.1 ptsrc=yes psfcorr=yes emapbnds=yes edisp_bins=0 copyall=no chatter=2 clobber=yes debug=no gui=no mode="ql" Generating SourceMap for /Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/gll_iem_v07.fits 38....................! Generating SourceMap for /Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/iso_P8R3_SOURCE_V3_v1 38....................! Generating SourceMap for 4FGL J0001.2-0747 38....................! Generating SourceMap for 4FGL J0002.3-0815 38....................! Generating SourceMap for 4FGL J0003.3-1928 38....................! Generating SourceMap for 4FGL J0003.9-1149 38....................! Generating SourceMap for 4FGL J0006.3-0620 38....................! Generating SourceMap for 4FGL J0008.4-2339 38....................! Generating SourceMap for 4FGL J0009.7-1418 38....................! Generating SourceMap for 4FGL J0010.2-2431 38....................! Generating SourceMap for 4FGL J0010.8-2154 38....................! Generating SourceMap for 4FGL J0013.9-1854 38....................! Generating SourceMap for 4FGL J0017.0-0649 38....................! Generating SourceMap for 4FGL J0021.6-0855 38....................! Generating SourceMap for 4FGL J0022.1-1854 38....................! Generating SourceMap for 4FGL J0025.2-2231 38....................! Generating SourceMap for 4FGL J0026.1-0732 38....................! Generating SourceMap for 4FGL J0030.2-1647 38....................! Generating SourceMap for 4FGL J0031.0-2327 38....................! Generating SourceMap for 4FGL J0033.3-2040 38....................! Generating SourceMap for 4FGL J0033.5-1921 38....................! Generating SourceMap for 4FGL J0035.2-1739 38....................! Generating SourceMap for 4FGL J0041.7-1607 38....................! Generating SourceMap for 4FGL J2321.5-1619 38....................! Generating SourceMap for 4FGL J2325.2-2010 38....................! Generating SourceMap for 4FGL J2329.7-2118 38....................! Generating SourceMap for 4FGL J2330.3-2332 38....................! Generating SourceMap for 4FGL J2331.0-2147 38....................! Generating SourceMap for 4FGL J2331.1-1653 38....................! Generating SourceMap for 4FGL J2331.3-1558 38....................! Generating SourceMap for 4FGL J2334.9-2346 38....................! Generating SourceMap for 4FGL J2336.2-0715 38....................! Generating SourceMap for 4FGL J2345.2-1555 38....................! Generating SourceMap for 4FGL J2348.0-1630 38....................! Generating SourceMap for 4FGL J2350.9-1416 38....................! Generating SourceMap for 4FGL J2353.5-1457 38....................! Generating SourceMap for 4FGL J2354.1-0958 38....................! Generating SourceMap for 4FGL J2357.4-1718 38....................! Generating SourceMap for 4FGL J2358.3-1021 38....................! Generating SourceMap for 4FGL J2358.5-1808 38....................! Generating SourceMap for 4FGL J2359.3-2049 38....................!

Caught N3tip12TipExceptionE at the top level: Could not open FITS extension "/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/binned_srcmaps.fits[/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/iso_P8R3_SOURCE_V3_v1]" (CFITSIO ERROR 125: parse error in input file URL)

donhorner commented 1 year ago

I don't have an answer for you offhand. It looks like it's trying to reference an extension in the binned_srcmaps.fits file called "/Users/87steven/Documents/ASIAA/Fermi_test/J0001-1551/iso_P8R3_SOURCE_V3_v1". There should be one just called "iso_P8R3_SOURCE_V3_v1" without the path info. The notebook seems to be using relative paths while you are using absolute paths. I suspects there's something in that. You might want to switch to relative paths.

Also, I noticed that your makeModel statement has the line "data_path+'/gll_iem_v07', # .fits" with the file extension effectively commented out. That doesn't seem right to me.

I'm assign this to @joeastro for any followup since he's the one who created the notebook and video tutorial.

87Steven-Hsu commented 1 year ago

Hello donhorner,

Thank you for your reply, and all the comments. I removed the "data_path" for the latetter file name in "makeModel" something like

mymodel.makeModel(data_path+'/gll_iem_v07.fits', 'gll_iem_v07.fits', # .fits data_path+'/iso_P8R3_SOURCE_V3_v1.txt', 'iso_P8R3_SOURCE_V3_v1')

then the "srcMaps" can be proceed successfully. Using absolute path is still work for me. Thank you again for the help. : )