fermi-lat / Fermitools-conda

Conda recipe files for the Fermi Sciencetools software analysis package: Fermitools
https://fermi.gsfc.nasa.gov/ssc/data/analysis/
BSD 3-Clause "New" or "Revised" License
34 stars 16 forks source link

Core dump from gtsrcmaps on fermitools 2.0.8 #120

Closed Knuffles closed 2 years ago

Knuffles commented 2 years ago

Hello, I encounter a problem on the gtsrcmap part of the setup, with fermitools 2.0.8 and Fermipy 1.0.1

I get the error message :

(fermipyib) -bash-4.2$ gtsrcmaps scfile=../lat_spacecraft_merged.fits sctable="SC_DATA" expcube=/home/ibrossard/analysis/4FGL_J2330.5-2445/4FGL_J2330.5-2445_ltcube_105.fits cmap=/home/ibrossard/analysis/4FGL_J2330.5-2445/ccube_07.fits srcmdl=/home/ibrossard/analysis/4FGL_J2330.5-2445/srcmdl_07.xml bexpmap=/home/ibrossard/analysis/4FGL_J2330.5-2445/bexpmap_07.fits wmap=none outfile=/home/ibrossard/analysis/4FGL_J2330.5-2445/srcmap_07.fits irfs="P8R3_SOURCE_V3" evtype=32 convol=yes resample=yes rfactor=2 minbinsz=0.05 ptsrc=yes psfcorr=yes emapbnds=no edisp_bins=-1 copyall=no chatter=3 clobber=yes debug=no gui=no mode="ql" This is gtsrcmaps version HEAD ResponseFunctions::load: IRF used: P8R3_SOURCE_V3 (PSF) event_types: 5 difference in gti interval found

WARNING: AppHelpers::checkTimeCuts: Time range cuts and GTI extensions in files /home/ibrossard/analysis/4FGL_J2330.5-2445/ccube_07.fitsand /home/ibrossard/analysis/4FGL_J2330.5-2445/4FGL_J2330.5-2445_ltcube_105.fits[Exposure] do not agree. Aggregate absolute differences in GTI start times (s): 4.0898e+11 Aggregate absolute differences in GTI stop times (s): 4.08995e+11

Creating source named 4FGL J2330.5-2445 Creating source named SOURCE_ANN Floating point exception (core dumped)

I saw that others had this problem already and that it is supposedly fixed as of 2.0.5, so I don't see where the problem is coming from.

The files I use are pretty big, as they take into account the full 12-year catalog. The time difference comes from the lifetime cubes which are generated before, on their own.

Thank you for your help.

nmirabal commented 2 years ago

Can you remove SOURCE_ANN from the xml file and rerun gtsrcmaps again?. It might be a XML formatting issue.

Knuffles commented 2 years ago

I will try this, but won't that remove SOURCE_ANN from the analysis ? I generate this source which has a different spectrum to compare with another (here 4FGL J2330.5-2445) and see if the likelihood of the model improves.

Knuffles commented 2 years ago

By the way, I introduce this theoretical source in the config.yaml file, like so:

model: src_roiwidth : 28.28 galdiff : "$FERMI_DIFFUSE/gll_iem_v07.fits" catalogs : ["4FGL-DR3"] sources :

just in case, here is the full config file

config.txt

Knuffles commented 2 years ago

The srcmap does generate when removing SOURCE_ANN, but then how can I implement this source in a way that doesn't cause an error ?

nmirabal commented 2 years ago

I suspect this might have to do with the format of backenstossSpectrum.txt . Check that the file is properly formatted. Maybe start with one or two lines in the file to try to trace the error. Also you might want to change to name: 'SOURCE_ANN' SpectrumType : 'FileFunction' Spectrum_Filename : '../backenstossSpectrum.txt' SpatialModel : 'PointSource'

Knuffles commented 2 years ago

Hello again, sorry for the delay. I checked the format of the file, and tried to change the description of the source in the config file, but I still got the same problem. I was wondering, since this source is used to check if the likelihood of the model would be better with it instead of the original source (with a power law spectrum), can't I just generate the source maps with the original source for the setup, and then re-launching the analysis with the normalisation of the original source at 0 to replace it with the new one ?

nmirabal commented 2 years ago

You can certainly introduce any source that follows one of supported Fermitools spectral models https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/source_models.html

There is a notebook (slightly outdated in diffuse models) using Draco that might be a useful guide https://nbviewer.org/github/fermiPy/fermipy-extra/blob/master/notebooks/draco.ipynb

Knuffles commented 2 years ago

Yes, but the source I want to introduce has a spectral model which is not included in the fermitools. Is there a guide regarding the inclusion of a source with spectral type FileFunction ?

nmirabal commented 2 years ago

Can you try the following files in your system (you have to modify according to your local system)?. These seem to work for me while including a test source. File inputspectrum.txt should have the proper input file configuration (energy (MeV) and differential flux columns).

config.txt

inputspectrum.txt