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 17 forks source link

Getting "TypeError: Object of type int64 is not JSON serializable" when generating light curve #124

Closed Pfesi closed 2 years ago

Pfesi commented 2 years ago

I've been trying to generate longterm lightcurves using fermipy 1.1.4 and have been getting the TypeError: Object of type int64 is not JSON serializable error. I'm running the analysis on a linux server using fermitools 2.2.0. The following output is part of the output I get at the end

2022-08-16 13:41:22 INFO lightcurve_544376617_546795817 GTBinnedAnalysis.write_xml(): Writing /data/pfesi_software/fermi/fermipy-13-07-2022_monthly/1424-418/results/4FGL_results/monthly_lightcur ed_all_spectral_indeces/lightcurve_544376617_546795817/fit_model_final_00.xml... 2022-08-16 13:41:22 INFO lightcurve_549215017_551634217 GTAnalysis._process_lc_bin(): Finished time range 549215017 551634217 2022-08-16 13:41:22 INFO lightcurve_551634217_554053417 GTAnalysis._process_lc_bin(): Finished time range 551634217 554053417 2022-08-16 13:41:22 INFO lightcurve_544376617_546795817 GTAnalysis._process_lc_bin(): Finished time range 544376617 546795817 2022-08-16 13:41:27 INFO lightcurve_529861417_532280617 GTAnalysis._process_lc_bin(): Finished time range 529861417 532280617 2022-08-16 13:41:27 INFO lightcurve_534699817_537119017 GTAnalysis._process_lc_bin(): Finished time range 534699817 537119017

Traceback (most recent call last): File "/data/pfesi_software/fermi/fermipy-13-07-2022_monthly/run_like_analysis.py", line 180, in gen_lc(sys.argv[1]) File "/data/pfesi_software/fermi/fermipy-13-07-2022_monthly/run_like_analysis.py", line 157, in gen_lc monthlyLC = gta2.lightcurve(src, time_bins=monthly, outdir='monthly_lightcurves_fixed_all_spectral_indeces', make_plots=False, nthread=50, multithread=True) File "/data/pfesi_software/fermi/mambaforge/envs/fermipy2/lib/python3.9/site-packages/fermipy/lightcurve.py", line 298, in lightcurve self._make_lc_fits(o, filename + '.fits', **config) File "/data/pfesi_software/fermi/mambaforge/envs/fermipy2/lib/python3.9/site-packages/fermipy/lightcurve.py", line 335, in _make_lc_fits 'CONFIG': json.dumps(lc['config'])} File "/data/pfesi_software/fermi/mambaforge/envs/fermipy2/lib/python3.9/json/init.py", line 231, in dumps return _default_encoder.encode(obj) File "/data/pfesi_software/fermi/mambaforge/envs/fermipy2/lib/python3.9/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/data/pfesi_software/fermi/mambaforge/envs/fermipy2/lib/python3.9/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/data/pfesi_software/fermi/mambaforge/envs/fermipy2/lib/python3.9/json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.class.name} ' TypeError: Object of type int64 is not JSON serializable

The following is the output of lc['config']

: {'outdir': 'monthly_lightcurves_fixed_all_spectral_indeces', 'use_local_ltcube': True, 'use_scaled_srcmap': False, 'save_bin_data': True, 'binsz': 86400.0, 'shape_ts_threshold': 16.0, 'nbin e, 'time_bins': [239557417, 241976617, 244395817, 246815017, 249234217, 251653417, 254072617, 256491817, 258911017, 261330217, 263749417, 266168617, 268587817, 271007017, 273426217, 275845417, 2782 280683817, 283103017, 285522217, 287941417, 290360617, 292779817, 295199017, 297618217, 300037417, 302456617, 304875817, 307295017, 309714217, 312133417, 314552617, 316971817, 319391017, 321810217, 417, 326648617, 329067817, 331487017, 333906217, 336325417, 338744617, 341163817, 343583017, 346002217, 348421417, 350840617, 353259817, 355679017, 358098217, 360517417, 362936617, 365355817, 36777 70194217, 372613417, 375032617, 377451817, 379871017, 382290217, 384709417, 387128617, 389547817, 391967017, 394386217, 396805417, 399224617, 401643817, 404063017, 406482217, 408901417, 411320617, 17, 416159017, 418578217, 420997417, 423416617, 425835817, 428255017, 430674217, 433093417, 435512617, 437931817, 440351017, 442770217, 445189417, 447608617, 450027817, 452447017, 454866217, 457285 9704617, 462123817, 464543017, 466962217, 469381417, 471800617, 474219817, 476639017, 479058217, 481477417, 483896617, 486315817, 488735017, 491154217, 493573417, 495992617, 498411817, 500831017, 5 7, 505669417, 508088617, 510507817, 512927017, 515346217, 517765417, 520184617, 522603817, 525023017, 527442217, 529861417, 532280617, 534699817, 537119017, 539538217, 541957417, 544376617, 5467958 215017, 551634217, 554053417], 'free_background': False, 'free_radius': None, 'free_sources': [], 'free_params': [], 'max_free_sources': 5, 'make_plots': False, 'write_fits': True, 'write_npy': Tru tithread': True, 'nthread': 50, 'systematic': 0.02, 'optimizer': {'optimizer': 'MINUIT', 'tol': 0.001, 'max_iter': 100, 'init_lambda': 0.0001, 'retries': 3, 'min_fit_quality': 2, 'verbosity': 0}, ' : ''}