fermiPy / fermipy

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

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

Closed pooja1984 closed 3 months ago

pooja1984 commented 6 months 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

''''

ktzhao commented 4 months ago

try pip install fermipy --upgrade --no-deps

omodei commented 3 months ago

Did this fix work? Can this be closed?

pooja1984 commented 3 months ago

Dear Nicola,

Yes, it is solved. Please close the Issue.

Regards, Pooja Bhattacharjee Post Doctoral Fellow Laboratoire d'Annecy de physique des particules (LAPP) Annecy, France *Alternate Mail id: @. @.>*

On Mon, Aug 12, 2024 at 11:12 PM Nicola Omodei @.***> wrote:

Did this fix work? Can this be closed?

— Reply to this email directly, view it on GitHub https://github.com/fermiPy/fermipy/issues/595#issuecomment-2284915072, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGULVA6OX4YCCLCZDTG6TTZREQK3AVCNFSM6AAAAABIWODW36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBUHEYTKMBXGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>