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

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices while running fermipy #164

Closed pooja1984 closed 1 month ago

pooja1984 commented 1 month ago

I have encountered a new issue while running fermipy in my new MAC OS. I have been running fermipy for the last 5 years but I have never encountered such errors before. It would be really great if anyone could suggest how to solve this bug.

Here is my fermipy command and associated errors: '''' import os import numpy as np from fermipy.gtanalysis import GTAnalysis from fermipy.plotting import ROIPlotter, SEDPlotter import matplotlib gta = GTAnalysis('test.yaml') matplotlib.interactive(True) gta.setup() gta.write_roi('fit0') gta.print_roi() '''' Error: After gtltcube: '''' 2024-06-03 10:27:27 INFO GTBinnedAnalysis.run_gtapp(): .....................! 2024-06-03 10:27:27 INFO GTBinnedAnalysis.run_gtapp(): Finished gtltcube. Execution time: 33851.88 s Traceback (most recent call last): File "/Users/poojabhattacharjee/Desktop/plot_data/white_dwarf/fermi_data/source_1/fp.py", line 9, in gta.setup() File "/Users/poojabhattacharjee/anaconda3/envs/fermi/lib/python3.9/site-packages/fermipy/gtanalysis.py", line 1085, in setup c.setup(overwrite=overwrite) File "/Users/poojabhattacharjee/anaconda3/envs/fermi/lib/python3.9/site-packages/fermipy/gtanalysis.py", line 5131, in setup self._psf = irfs.PSFModel.create(self.roi.skydir, self._ltc, File "/Users/poojabhattacharjee/anaconda3/envs/fermi/lib/python3.9/site-packages/fermipy/irfs.py", line 563, in create wts = calc_counts(skydir, ltc, event_class, event_types, File "/Users/poojabhattacharjee/anaconda3/envs/fermi/lib/python3.9/site-packages/fermipy/irfs.py", line 872, in calc_counts cnts = loglog_quad(egy_bins, exp * dnde[:, None], 0) File "/Users/poojabhattacharjee/anaconda3/envs/fermi/lib/python3.9/site-packages/fermipy/irfs.py", line 51, in loglog_quad log_ratio = np.log(x[xs1] / x[xs0]) IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

'''' This is my test.yaml file:

'''' logging :

verbosity : 3

data:

evfile: 'binned_events.txt' scfile: '/Users/poojabhattacharjee/Desktop/plot_data/white_dwarf/fermi_data/source_1/spacecraft.fits'

binning:

Binning

roiwidth : 15.0 npix : null binsz : 0.1 # spatial bin size in deg binsperdec : 8 # nb energy bins per decade coordsys : 'GAL'

selection:

Data selections

emin : 100 emax : 500000 zmax : 90 evclass : 128 evtype : 3 tmin : 239557418 tmax : 739023849 # 15 years filter : DATA_QUAL>0 && LAT_CONFIG==1 roicut : no target : 'test'

Set the ROI center to these coordinates

ra: 327.875 dec: 59.2917

gtlike:

IRFs

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

Settings for ROI model

model:

Include catalog sources within a box of width roisrc.

src_roiwidth : 20.0

galdiff : '/Users/poojabhattacharjee/Desktop/plot_data/white_dwarf/fermi_data/source_1/gll_iem_v07.fits' isodiff : '/Users/poojabhattacharjee/Desktop/plot_data/white_dwarf/fermi_data/source_1/iso_P8R3_SOURCE_V3_v1.txt'

List of catalogs to be used in the model.

catalogs : ['4FGL']

sources :

fileio: outdir : data

''''

nmirabal commented 1 month ago

This has been posted in fermipy issues. Closing here https://github.com/fermiPy/fermipy/issues/595