Fermipy tutorial
This tutorial shows how to perform Fermi-LAT analysis with the Fermipy Python package. Many parts of this tutorial are taken directly from the documentation page of Fermipy: fermipy.readthedocs. I suggest to visit the documentation page to find further informations.
Fermipy is a python package created by Mattew Wood and maintained by a wide community of people. Fermipy facilitates analysis of data from the Large Area Telescope (LAT) with the Fermi Science Tools. The Fermipy package is built on the pyLikelihood interface of the Fermi Science Tools and provides a set of high-level tools for performing common analysis tasks: * Data and model preparation with the gt-tools (gtselect, gtmktime, etc.). * Extracting a spectral energy distribution (SED) of a source. * Generating TS and residual maps for a region of interest. * Finding new source candidates. * Localizing a source or fitting its spatial extension. * Perfoming phase analysis * Calculating light curves * Deriving the sensitivity of gamma-ray sources with a specific SED and spatial morphology.
Installation
Instruction on how to install in SLAC machines or in your laptop Fermipy are available at this page: fermipy.installation. Fermipy is only compatible with Science Tools v10r0p5 or later. If you are using an earlier version, you will need to download and install the latest version from the FSSC. Note that it is recommended to use the non-ROOT binary distributions of the Science Tools. These instructions assume that you want to run Fermipy on the SLAC machines.
With these instructions you will create your own Conda installation and you will install all the packages needed to use FermiPy and Science Tools. Using your own Conda installation avoids conflicts with package versions because you build your own environment.
First grab the installation and setup scripts from the fermipy github repository:
[1]:
# ! curl -OL https://raw.githubusercontent.com/fermiPy/fermipy/master/condainstall.sh
# ! curl -OL https://raw.githubusercontent.com/fermiPy/fermipy/master/slacsetup.sh
Now choose an installation path. This should be a new directory (e.g. $HOME/anaconda) that has at least 2-4 GB available. We will assign this location to the CONDABASE environment variable which is used by the setup script to find the location of your python installation. To avoid setting this every time you log in it’s recommended to set CONDABASE into your .bashrc file.
Now run the following commands to install anaconda and fermipy. This will take about 5-10 minutes.
[2]:
# export CONDABASE=<path to install directory>
# bash condainstall.sh $CONDABASE
Once anaconda is installed you will initialize your python and ST environment by running the slacsetup function in slacsetup.sh. This function will set the appropriate environment variables needed to run the STs and python.
[3]:
# source slacsetup.sh
# slacsetup
For convenience you can also copy this function into your .bashrc file so that it will automatically be available when you launch a new shell session. By default the function will setup your environment to point to a recent version of the STs and the installation of python in CONDABASE. If CONDABASE is not defined then it will use the installation of python that is packaged with a given release of the STs. The slacsetup function takes two optional arguments which can be used to override the ST version or python installation path.
[4]:
# Use ST 10-00-05
# slacsetup 10-00-05
# Use ST 11-01-01 and python distribution located at <PATH>
# slacsetup 11-01-01 <PATH>
The installation script only installs packages that are required by fermipy and the STs. Once you’ve initialized your shell environment you are free to install additional python packages with the conda package manager tool with conda install . Packages that are not available on conda can also be installed with pip.
conda install fermipy
conda can also be used to upgrade packages. For instance you can upgrade fermipy to the newest version with the conda update command:
[5]:
# conda update fermipy
If you want to make development of Fermipy you should get the github version making:
[6]:
# git clone https://github.com/fermiPy/fermipy.git
Then you should create a branch using:
[7]:
# git checkout -b mattia-dev
In the branch you can make your development of Fermipy and then use the git commands to merge them to the master repository.
More informations on how to install Fermipy are available here: fermipy-install
Download the raw files
The files can be obtained from the Fermi SSC website. The following data selection choices were made:
Object name or coordinates: 302.25,-44.37
Coordinate system: GAL
Search radius (degrees): 12
Observation dates: 239557417,512994417
Time system: MET
Energy range (MeV): 100,500000
LAT data type: Photon
Spacecraft data: yes
The raw data with these selections can be downloaded using wget.
[8]:
# # Set up a subdirectory for the data
# !mkdir -p SMC_data/PH
# !mkdir -p SMC_data/SC
# # Download the data and place into the subdirectory
# !wget -P ./SMC_data/PH/ https://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L240613164330AE56FF4635_PH00.fits
# !wget -P ./SMC_data/PH/ https://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L240613164330AE56FF4635_PH01.fits
# !wget -P ./SMC_data/PH/ https://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L240613164330AE56FF4635_PH02.fits
# !wget -P ./SMC_data/PH/ https://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L240613164330AE56FF4635_PH03.fits
# !wget -P ./SMC_data/PH/ https://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L240613164330AE56FF4635_PH04.fits
# !wget -P ./SMC_data/PH/ https://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L240613164330AE56FF4635_PH05.fits
# !wget -P ./SMC_data/PH/ https://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L240613164330AE56FF4635_PH06.fits
# !wget -P ./SMC_data/SC/ https://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L240613164330AE56FF4635_SC00.fits
# # Make a file list
# !ls ./SMC_data/PH/*PH*.fits > ./SMC_data/PH.txt
Note that processing the raw photon and spacecraft files can take multiple hours. Alternatively, you can download the pre-processed data from github.
[9]:
import os
if os.path.isfile('./../data/SMC_data.tar.gz'):
!tar xzf ./../data/SMC_data.tar.gz
else:
!curl -OL --output-dir ./../data/ https://raw.githubusercontent.com/fermiPy/fermipy-extras/master/data/SMC_data.tar.gz
!tar xzf ./../data/SMC_data.tar.gz
Configuration file:
The first step is to compose a configuration file that defines the data selection and analysis parameters. Fermipy uses YAML files to read and write its configuration in a persistent format. The configuration file has a hierarchical structure that groups parameters into dictionaries that are keyed to a section name (data, binning, etc.). Below I report a sample of configuration applied for an analysis of the SMC:
[10]:
import os
import numpy as np
from fermipy.gtanalysis import GTAnalysis
from fermipy.plotting import ROIPlotter, SEDPlotter
import matplotlib.pyplot as plt
import matplotlib
[11]:
!cat ./SMC_data/config.yaml
data:
evfile : './SMC_data/PH.txt'
scfile : './SMC_data/SC/SC_copy.fits'
ltcube : 'ltcube_00.fits'
binning:
roiwidth : 12.0
binsz : 0.08
binsperdec : 8
coordsys : 'GAL'
selection :
emin : 1000
emax : 500000
tmin : 239557417
tmax : 512994417
zmax : 105
evclass : 128
evtype : 3
glon: 302.25
glat : -44.37
gtlike:
edisp : True
irfs : 'P8R2_SOURCE_V6'
edisp_disable : ['isodiff','galdiff']
model:
src_roiwidth : 12.0
galdiff : '$FERMI_DIFFUSE_DIR/gll_iem_v07.fits'
isodiff : '$FERMI_DIFFUSE_DIR/iso_P8R2_SOURCE_V6_v06.txt'
catalogs: gll_psc_v16.fit
fileio:
usescratch: False
outdir : SMC_data
The configuration file has the same structure as the configuration dictionary such that one can read/write configurations using the load/dump methods of the yaml module:
[12]:
import yaml
# Load a configuration
config = yaml.load(open('./SMC_data/config.yaml'), Loader=yaml.FullLoader)
# Update a parameter and write a new configuration
config['selection']['emin'] = 1000.
yaml.dump(config, open('new_config.yaml','w'))
The data section defines the input data set and spacecraft file for the analysis. Here evfile points to a list of FT1 files that encompass the chosen ROI, energy range, and time selection. The parameters in the binning section define the dimensions of the ROI and the spatial and energy bin size. The selection section defines parameters related to the data selection (energy range, zmax cut, and event class/type). The target parameter in this section defines the ROI center to have the same coordinates as the given source. The model section defines parameters related to the ROI model definition (diffuse templates, point sources). Fermipy gives the user the option to combine multiple data selections into a joint likelihood with the components section. For more informations on this visit: http://fermipy.readthedocs.io/en/latest/quickstart.html
Note that the setup for a joint analysis is identical to the above except for the modification to the components section. The following example shows the components configuration one would use to define a joint analysis with the four PSF event types:
components:
- { selection : { evtype : 4 } }
- { selection : { evtype : 8 } }
- { selection : { evtype : 16 } }
- { selection : { evtype : 32 } }
Start your run
First of all you need to load the configuration file, create the object gta and run the tool gta.setup that implements the ST gtselect, gtmktime, gtbin, gtexpcube, gtsrcmap tools
Begin the setup routine. As most of the files are included, only the source-map should be created. Will take ~5min.
[13]:
gta = GTAnalysis('new_config.yaml')
gta.setup()
2024-12-19 20:20:59 INFO GTAnalysis.__init__():
--------------------------------------------------------------------------------
fermipy version 1.3.1+6.g74aa
ScienceTools version 2.2.0
2024-12-19 20:20:59 INFO GTAnalysis.setup(): Running setup.
2024-12-19 20:20:59 INFO GTBinnedAnalysis.setup(): Running setup for component 00
2024-12-19 20:20:59 INFO GTBinnedAnalysis._select_data(): Skipping data selection.
2024-12-19 20:20:59 INFO GTBinnedAnalysis.setup(): Using external LT cube.
{'Prefactor': 0, 'Index1': 1, 'Scale': 2, 'Cutoff': 3, 'Index2': 4}
2024-12-19 20:21:00 INFO GTBinnedAnalysis._create_expcube(): Skipping gtexpcube.
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
2024-12-19 20:21:00 INFO GTBinnedAnalysis.run_gtapp(): Running gtsrcmaps.
2024-12-19 20:21:00 INFO GTBinnedAnalysis.run_gtapp(): time -p gtsrcmaps scfile=./SMC_data/SC/SC_copy.fits sctable="SC_DATA" expcube=/home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/ltcube_00.fits cmap=/home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/ccube_00.fits srcmdl=/home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/srcmdl_00.xml bexpmap=/home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/bexpmap_00.fits wmap=none outfile=/home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/srcmap_00.fits irfs="P8R2_SOURCE_V6" evtype=3 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"
2024-12-19 20:21:00 INFO GTBinnedAnalysis.run_gtapp(): This is gtsrcmaps version HEAD
2024-12-19 20:21:00 INFO GTBinnedAnalysis.run_gtapp(): Using evtype=3 (i.e., FRONT/BACK irfs)
2024-12-19 20:21:00 INFO GTBinnedAnalysis.run_gtapp(): ResponseFunctions::load: IRF used: P8R2_SOURCE_V6
2024-12-19 20:21:00 INFO GTBinnedAnalysis.run_gtapp(): event_types: 0 1
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0059.0-7242e
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0112.9-7506
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0023.9-7203
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0029.1-7045
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0021.6-6835
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J2351.9-7601
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J2338.7-7401
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0146.4-6746
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J2336.5-7620
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0002.0-6722
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named isodiff
2024-12-19 20:21:04 INFO GTBinnedAnalysis.run_gtapp(): Creating source named galdiff
2024-12-19 20:21:05 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0002.0-6722 23....................!
2024-12-19 20:21:05 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0021.6-6835 23....................!
2024-12-19 20:21:06 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0023.9-7203 23....................!
2024-12-19 20:21:07 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0029.1-7045 23....................!
2024-12-19 20:21:35 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0059.0-7242e 23....................!
2024-12-19 20:21:35 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0112.9-7506 23....................!
2024-12-19 20:21:36 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0146.4-6746 23....................!
2024-12-19 20:21:37 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J2336.5-7620 23....................!
2024-12-19 20:21:37 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J2338.7-7401 23....................!
2024-12-19 20:21:38 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J2351.9-7601 23....................!
2024-12-19 20:22:08 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for galdiff 23....................!
2024-12-19 20:22:33 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for isodiff 23....................!
2024-12-19 20:22:34 INFO GTBinnedAnalysis.run_gtapp(): Finished gtsrcmaps. Execution time: 94.04 s
2024-12-19 20:22:34 INFO GTBinnedAnalysis.setup(): Finished setup for component 00
2024-12-19 20:22:34 INFO GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00.
2024-12-19 20:22:39 INFO GTAnalysis.setup(): Initializing source properties
2024-12-19 20:22:42 INFO GTAnalysis.setup(): Finished setup.
[14]:
gta.print_model()
2024-12-19 20:22:42 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e 0.088 1.059 1.45e-05 2.22 nan 1437.6
3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.3
3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1679.9
3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 270.6
3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.2
3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.8
3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.7
3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 124.0
3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 187.3
3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.5
isodiff --- 1.000 0.0313 2.12 nan 9099.9
galdiff --- 1.000 0.132 0.00 nan 16777.6
[15]:
gta.free_sources()
gta.fit()
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0059.0-7242e : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization']
2024-12-19 20:22:42 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index']
2024-12-19 20:22:42 INFO GTAnalysis.fit(): Starting fit.
Drm_Cache::update Measured counts < 0 3FGL J0023.9-7203 21 -3.92429e-11 6.86055e-11
508.548 476.301 383.986 267.676 161.68 85.2989 39.7061 16.4355 5.9306 1.87763 0.52174 0.127727 0.0277026 0.00525312 0.00086478 0.000124394 1.56781e-05 1.73055e-06 1.67578e-07 1.42376e-08 1.05942e-09 6.86055e-11
/home/runner/miniconda3/envs/fermipy/lib/python3.9/site-packages/scipy/interpolate/_fitpack2.py:313: UserWarning:
The maximal number of iterations maxit (set to 20 by the program)
allowed for finding a smoothing spline with fp=s has been reached: s
too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.
warnings.warn(message)
2024-12-19 20:22:45 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0
2024-12-19 20:22:45 INFO GTAnalysis.fit(): LogLike: -73815.272 DeltaLogLike: 154.334
[15]:
{'fit_quality': 3,
'fit_status': 0,
'fit_success': True,
'dloglike': 154.33350336243166,
'edm': 0.00040817174676986245,
'loglike': -73815.27176892347,
'covariance': array([[ 4.98571048e-03, 4.07251389e-03, -2.54532021e-04,
-5.78972632e-05, 1.77001865e-05, 3.75091363e-05,
-1.21452409e-05, 1.67954117e-05, 1.30485290e-05,
9.50166404e-05, 1.01977968e-05, 4.96423895e-05,
1.55702488e-05, 4.74407335e-05, 2.57854615e-05,
2.75712397e-05, 2.82884366e-05, 2.24037483e-05,
1.78679609e-05, 3.26236510e-05, 1.88846184e-05,
-1.86837634e-05, -3.89180313e-05, -1.07154762e-04],
[ 4.07251389e-03, 1.88425372e-02, -4.94709427e-04,
-7.57633023e-05, 2.37483063e-05, 4.83155053e-05,
-1.25102366e-05, 2.08193908e-05, 2.69551614e-05,
1.76664373e-04, 6.24318465e-05, 7.44724284e-05,
3.37920653e-05, 4.82951204e-05, 3.62066614e-05,
4.90329536e-05, 6.45150368e-05, 2.30247459e-05,
2.98071894e-05, 2.66787585e-05, 3.92225864e-05,
-9.21043632e-05, -8.08092265e-05, -2.55399335e-05],
[-2.54532021e-04, -4.94709427e-04, 2.42814884e+00,
6.74241295e-01, 2.86690555e-04, 6.21833596e-04,
-1.68568021e-04, -3.75295644e-04, -5.09985898e-04,
2.55642065e-03, 9.47281867e-04, 7.53719995e-04,
4.19538977e-04, 1.07843872e-03, 7.43424504e-04,
5.83741135e-04, 8.84447133e-04, 3.90170936e-04,
4.73678499e-04, 2.31274366e-04, 5.31518980e-04,
-7.47119288e-04, -2.05556596e-03, -2.59554361e-03],
[-5.78972632e-05, -7.57633023e-05, 6.74241295e-01,
2.44610902e-01, 3.45341096e-05, 7.88453536e-05,
-1.48121171e-05, -6.93763722e-05, -8.27501964e-05,
3.87021084e-04, 2.43489755e-04, 1.97353130e-05,
6.03050388e-05, 1.28286915e-04, 1.16245874e-04,
6.01811569e-05, 1.46288940e-04, 2.48863968e-05,
6.78135444e-05, -6.42537969e-05, 8.03235455e-05,
-1.42246537e-04, -4.52563942e-04, -3.41689285e-04],
[ 1.77001865e-05, 2.37483063e-05, 2.86690555e-04,
3.45341096e-05, 2.98482327e-03, 9.28936792e-03,
-3.42644770e-03, -1.48019110e-04, -2.05809063e-04,
-1.42811266e-04, -5.28177780e-05, 3.13922485e-05,
1.65878012e-05, 4.06809152e-05, 2.75636024e-05,
1.87630613e-05, 2.89427589e-05, 8.88328461e-06,
9.60904560e-06, 5.72117820e-06, 1.52158553e-05,
-2.30608221e-05, -7.65189956e-05, -1.04686804e-04],
[ 3.75091363e-05, 4.83155053e-05, 6.21833596e-04,
7.88453536e-05, 9.28936792e-03, 3.46068811e-02,
-1.40838200e-02, -2.90759521e-04, -4.66575801e-04,
-3.22337842e-04, -1.34181327e-04, 2.51024854e-05,
2.46396805e-05, 9.80682675e-05, 6.60889055e-05,
2.20830456e-05, 4.89283655e-05, 1.58188741e-05,
1.66628937e-05, -9.02006881e-06, 2.34522705e-05,
-2.97673621e-06, -2.13849556e-04, -3.43662039e-04],
[-1.21452409e-05, -1.25102366e-05, -1.68568021e-04,
-1.48121171e-05, -3.42644770e-03, -1.40838200e-02,
6.30834129e-03, 8.01970755e-05, 1.34732751e-04,
9.64608750e-05, 4.15845404e-05, -4.64048163e-08,
-3.81981363e-06, -3.19115405e-05, -1.99368857e-05,
-2.09455169e-06, -8.74809200e-06, -4.88820017e-06,
-3.38777696e-06, 3.68086784e-06, -3.58826146e-06,
-1.46351148e-05, 6.56431087e-05, 1.32233176e-04],
[ 1.67954117e-05, 2.08193908e-05, -3.75295644e-04,
-6.93763722e-05, -1.48019110e-04, -2.90759521e-04,
8.01970755e-05, 3.28629292e-03, 4.06709069e-03,
-2.67355186e-06, -4.13432569e-06, 5.22590978e-05,
1.96893252e-05, 3.21446516e-05, 2.04969897e-05,
2.84422084e-05, 3.30135278e-05, 1.61053824e-05,
1.64205345e-05, 2.36642334e-05, 2.07913988e-05,
-4.25468447e-05, -3.47143376e-05, -3.43962021e-05],
[ 1.30485290e-05, 2.69551614e-05, -5.09985898e-04,
-8.27501964e-05, -2.05809063e-04, -4.66575801e-04,
1.34732751e-04, 4.06709069e-03, 1.17841263e-02,
3.13755230e-06, 6.95020983e-06, 5.10869899e-05,
2.61919698e-05, 3.16228756e-05, 2.62823835e-05,
3.32850510e-05, 4.78726295e-05, 1.34905519e-05,
2.08847510e-05, 1.10568003e-05, 2.84003491e-05,
-6.99617880e-05, -6.99566720e-05, -1.23203229e-05],
[ 9.50166404e-05, 1.76664373e-04, 2.55642065e-03,
3.87021084e-04, -1.42811266e-04, -3.22337842e-04,
9.64608750e-05, -2.67355186e-06, 3.13755230e-06,
1.30266793e-02, 5.76991042e-03, -1.42127889e-04,
-5.66370936e-05, 1.62226137e-04, 1.31862669e-04,
2.17665453e-04, 2.82310679e-04, 8.73111851e-05,
1.21739476e-04, 1.11517198e-04, 1.67572332e-04,
-4.56955040e-04, -2.84144002e-04, 1.08612143e-04],
[ 1.01977968e-05, 6.24318465e-05, 9.47281867e-04,
2.43489755e-04, -5.28177780e-05, -1.34181327e-04,
4.15845404e-05, -4.13432569e-06, 6.95020983e-06,
5.76991042e-03, 3.72936210e-03, -3.74885149e-05,
-1.41795605e-05, 3.56539860e-05, 4.91728841e-05,
6.32523985e-05, 1.11223754e-04, 1.07875460e-05,
4.20040470e-05, -1.84884026e-05, 6.16536171e-05,
-1.88778330e-04, -1.84654595e-04, 8.56894141e-05],
[ 4.96423895e-05, 7.44724284e-05, 7.53719995e-04,
1.97353130e-05, 3.13922485e-05, 2.51024854e-05,
-4.64048163e-08, 5.22590978e-05, 5.10869899e-05,
-1.42127889e-04, -3.74885149e-05, 3.73142150e-02,
1.32906663e-02, 5.16972452e-05, 3.61775588e-05,
1.31700623e-04, 1.32947857e-04, 5.22632564e-05,
5.50981708e-05, 1.20520621e-04, 8.36596892e-05,
-2.69885501e-04, 4.01340517e-05, 2.85529918e-04],
[ 1.55702488e-05, 3.37920653e-05, 4.19538977e-04,
6.03050388e-05, 1.65878012e-05, 2.46396805e-05,
-3.81981363e-06, 1.96893252e-05, 2.61919698e-05,
-5.66370936e-05, -1.41795605e-05, 1.32906663e-02,
1.22798456e-02, 2.17516790e-05, 2.06135956e-05,
4.95771637e-05, 6.03621865e-05, 1.65273709e-05,
2.41889816e-05, 2.86961452e-05, 3.62065805e-05,
-1.14850906e-04, -2.88120068e-05, 9.79975229e-05],
[ 4.74407335e-05, 4.82951204e-05, 1.07843872e-03,
1.28286915e-04, 4.06809152e-05, 9.80682675e-05,
-3.19115405e-05, 3.21446516e-05, 3.16228756e-05,
1.62226137e-04, 3.56539860e-05, 5.16972452e-05,
2.17516790e-05, 9.38070891e-03, 8.10022834e-03,
3.53648266e-05, 4.65696083e-05, 3.56614185e-05,
3.18687802e-05, 3.18286785e-05, 2.97170675e-05,
-4.77780692e-06, -1.32107471e-04, -2.87817571e-04],
[ 2.57854615e-05, 3.62066614e-05, 7.43424504e-04,
1.16245874e-04, 2.75636024e-05, 6.60889055e-05,
-1.99368857e-05, 2.04969897e-05, 2.62823835e-05,
1.31862669e-04, 4.91728841e-05, 3.61775588e-05,
2.06135956e-05, 8.10022834e-03, 1.31256456e-02,
2.87686303e-05, 4.41209336e-05, 1.98572047e-05,
2.41027047e-05, 1.09625334e-05, 2.65190273e-05,
-3.54352661e-05, -1.05750507e-04, -1.36802157e-04],
[ 2.75712397e-05, 4.90329536e-05, 5.83741135e-04,
6.01811569e-05, 1.87630613e-05, 2.20830456e-05,
-2.09455169e-06, 2.84422084e-05, 3.32850510e-05,
2.17665453e-04, 6.32523985e-05, 1.31700623e-04,
4.95771637e-05, 3.53648266e-05, 2.87686303e-05,
7.11364841e-03, 9.58417860e-03, -4.88274689e-06,
-2.81722105e-06, -4.90622609e-04, -4.53545618e-04,
-1.64150264e-04, -1.94224690e-05, 1.41485729e-04],
[ 2.82884366e-05, 6.45150368e-05, 8.84447133e-04,
1.46288940e-04, 2.89427589e-05, 4.89283655e-05,
-8.74809200e-06, 3.30135278e-05, 4.78726295e-05,
2.82310679e-04, 1.11223754e-04, 1.32947857e-04,
6.03621865e-05, 4.65696083e-05, 4.41209336e-05,
9.58417860e-03, 2.27429070e-02, -8.65248532e-06,
-1.90985927e-06, -4.30218150e-04, -5.67254919e-04,
-2.00628633e-04, -8.87877732e-05, 1.30761586e-04],
[ 2.24037483e-05, 2.30247459e-05, 3.90170936e-04,
2.48863968e-05, 8.88328461e-06, 1.58188741e-05,
-4.88820017e-06, 1.61053824e-05, 1.34905519e-05,
8.73111851e-05, 1.07875460e-05, 5.22632564e-05,
1.65273709e-05, 3.56614185e-05, 1.98572047e-05,
-4.88274689e-06, -8.65248532e-06, 3.90067021e-03,
1.49193303e-03, -1.06687376e-05, -1.49090030e-05,
-3.32588204e-05, -2.15483042e-05, -4.87914585e-05],
[ 1.78679609e-05, 2.98071894e-05, 4.73678499e-04,
6.78135444e-05, 9.60904560e-06, 1.66628937e-05,
-3.38777696e-06, 1.64205345e-05, 2.08847510e-05,
1.21739476e-04, 4.20040470e-05, 5.50981708e-05,
2.41889816e-05, 3.18687802e-05, 2.41027047e-05,
-2.81722105e-06, -1.90985927e-06, 1.49193303e-03,
8.62340969e-03, -1.64081890e-05, -1.34059726e-05,
-6.89088566e-05, -5.00911622e-05, -3.38388902e-06],
[ 3.26236510e-05, 2.66787585e-05, 2.31274366e-04,
-6.42537969e-05, 5.72117820e-06, -9.02006881e-06,
3.68086784e-06, 2.36642334e-05, 1.10568003e-05,
1.11517198e-04, -1.84884026e-05, 1.20520621e-04,
2.86961452e-05, 3.18286785e-05, 1.09625334e-05,
-4.90622609e-04, -4.30218150e-04, -1.06687376e-05,
-1.64081890e-05, 2.55714818e-02, -5.24793824e-03,
-8.15057385e-05, 7.06541623e-05, 7.82582840e-05],
[ 1.88846184e-05, 3.92225864e-05, 5.31518980e-04,
8.03235455e-05, 1.52158553e-05, 2.34522705e-05,
-3.58826146e-06, 2.07913988e-05, 2.84003491e-05,
1.67572332e-04, 6.16536171e-05, 8.36596892e-05,
3.62065805e-05, 2.97170675e-05, 2.65190273e-05,
-4.53545618e-04, -5.67254919e-04, -1.49090030e-05,
-1.34059726e-05, -5.24793824e-03, 9.82307515e-03,
-1.20664981e-04, -4.70839462e-05, 7.78580913e-05],
[-1.86837634e-05, -9.21043632e-05, -7.47119288e-04,
-1.42246537e-04, -2.30608221e-05, -2.97673621e-06,
-1.46351148e-05, -4.25468447e-05, -6.99617880e-05,
-4.56955040e-04, -1.88778330e-04, -2.69885501e-04,
-1.14850906e-04, -4.77780692e-06, -3.54352661e-05,
-1.64150264e-04, -2.00628633e-04, -3.32588204e-05,
-6.89088566e-05, -8.15057385e-05, -1.20664981e-04,
4.47954799e-04, 1.42452741e-05, -6.26032629e-04],
[-3.89180313e-05, -8.08092265e-05, -2.05556596e-03,
-4.52563942e-04, -7.65189956e-05, -2.13849556e-04,
6.56431087e-05, -3.47143376e-05, -6.99566720e-05,
-2.84144002e-04, -1.84654595e-04, 4.01340517e-05,
-2.88120068e-05, -1.32107471e-04, -1.05750507e-04,
-1.94224690e-05, -8.87877732e-05, -2.15483042e-05,
-5.00911622e-05, 7.06541623e-05, -4.70839462e-05,
1.42452741e-05, 4.23523229e-04, 5.18007943e-04],
[-1.07154762e-04, -2.55399335e-05, -2.59554361e-03,
-3.41689285e-04, -1.04686804e-04, -3.43662039e-04,
1.32233176e-04, -3.43962021e-05, -1.23203229e-05,
1.08612143e-04, 8.56894141e-05, 2.85529918e-04,
9.79975229e-05, -2.87817571e-04, -1.36802157e-04,
1.41485729e-04, 1.30761586e-04, -4.87914585e-05,
-3.38388902e-06, 7.82582840e-05, 7.78580913e-05,
-6.26032629e-04, 5.18007943e-04, 1.86206151e-03]]),
'correlation': array([[ 1.00000000e+00, 4.20174175e-01, -2.31334948e-03,
-1.65789340e-03, 4.58833379e-03, 2.85556668e-03,
-2.16563378e-03, 4.14929191e-03, 1.70235188e-03,
1.17901487e-02, 2.36496952e-03, 3.63958608e-03,
1.98991979e-03, 6.93697354e-03, 3.18750624e-03,
4.62963303e-03, 2.65657714e-03, 5.08027872e-03,
2.72503419e-03, 2.88928969e-03, 2.69849087e-03,
-1.25021221e-02, -2.67823523e-02, -3.51682646e-02],
[ 4.20174175e-01, 1.00000000e+00, -2.31282537e-03,
-1.11596687e-03, 3.16667607e-03, 1.89206305e-03,
-1.14746181e-03, 2.64572798e-03, 1.80893746e-03,
1.12761910e-02, 7.44764921e-03, 2.80859210e-03,
2.22151163e-03, 3.63258455e-03, 2.30228166e-03,
4.23518285e-03, 3.11650818e-03, 2.68568787e-03,
2.33836244e-03, 1.21539649e-03, 2.88298780e-03,
-3.17024931e-02, -2.86057041e-02, -4.31174491e-03],
[-2.31334948e-03, -2.31282537e-03, 1.00000000e+00,
8.74862480e-01, 3.36756838e-03, 2.14513831e-03,
-1.36200890e-03, -4.20129073e-03, -3.01489243e-03,
1.43740054e-02, 9.95461105e-03, 2.50400522e-03,
2.42961919e-03, 7.14562120e-03, 4.16427002e-03,
4.44156935e-03, 3.76366741e-03, 4.00910699e-03,
3.27345602e-03, 9.28136602e-04, 3.44157621e-03,
-2.26534942e-02, -6.40995747e-02, -3.86005655e-02],
[-1.65789340e-03, -1.11596687e-03, 8.74862480e-01,
1.00000000e+00, 1.27805943e-03, 8.56952935e-04,
-3.77069705e-04, -2.44692437e-03, -1.54128317e-03,
6.85614288e-03, 8.06167921e-03, 2.06570814e-04,
1.10032060e-03, 2.67809899e-03, 2.05153678e-03,
1.44270132e-03, 1.96132969e-03, 8.05665007e-04,
1.47651897e-03, -8.12424374e-04, 1.63863125e-03,
-1.35889751e-02, -4.44634776e-02, -1.60101885e-02],
[ 4.58833379e-03, 3.16667607e-03, 3.36756838e-03,
1.27805943e-03, 1.00000000e+00, 9.13998795e-01,
-7.89636483e-01, -4.72612652e-02, -3.47021587e-02,
-2.29026796e-02, -1.58308247e-02, 2.97458208e-03,
2.73988957e-03, 7.68800353e-03, 4.40368584e-03,
4.07191017e-03, 3.51283401e-03, 2.60342247e-03,
1.89400636e-03, 6.54859628e-04, 2.81004533e-03,
-1.99433623e-02, -6.80567699e-02, -4.44053828e-02],
[ 2.85556668e-03, 1.89206305e-03, 2.14513831e-03,
8.56952935e-04, 9.13998795e-01, 1.00000000e+00,
-9.53194760e-01, -2.72646281e-02, -2.31042719e-02,
-1.51814482e-02, -1.18111878e-02, 6.98551352e-04,
1.19524625e-03, 5.44288856e-03, 3.10089451e-03,
1.40744535e-03, 1.74404019e-03, 1.36152219e-03,
9.64560966e-04, -3.03214993e-04, 1.27197897e-03,
-7.56035212e-04, -5.58584017e-02, -4.28107977e-02],
[-2.16563378e-03, -1.14746181e-03, -1.36200890e-03,
-3.77069705e-04, -7.89636483e-01, -9.53194760e-01,
1.00000000e+00, 1.76135868e-02, 1.56266862e-02,
1.06408604e-02, 8.57347802e-03, -3.02460254e-06,
-4.33998401e-04, -4.14832094e-03, -2.19098494e-03,
-3.12670777e-04, -7.30352908e-04, -9.85420913e-04,
-4.59322489e-04, 2.89810881e-04, -4.55829845e-04,
-8.70605579e-03, 4.01599286e-02, 3.85820969e-02],
[ 4.14929191e-03, 2.64572798e-03, -4.20129073e-03,
-2.44692437e-03, -4.72612652e-02, -2.72646281e-02,
1.76135868e-02, 1.00000000e+00, 6.53554829e-01,
-4.08619056e-04, -1.18095751e-03, 4.71923515e-03,
3.09942580e-03, 5.78945600e-03, 3.12087669e-03,
5.88252770e-03, 3.81870238e-03, 4.49829869e-03,
3.08457010e-03, 2.58143596e-03, 3.65937434e-03,
-3.50668798e-02, -2.94250446e-02, -1.39046591e-02],
[ 1.70235188e-03, 1.80893746e-03, -3.01489243e-03,
-1.54128317e-03, -3.47021587e-02, -2.31042719e-02,
1.56266862e-02, 6.53554829e-01, 1.00000000e+00,
2.53235985e-04, 1.04841191e-03, 2.43626466e-03,
2.17732378e-03, 3.00770222e-03, 2.11327355e-03,
3.63541784e-03, 2.92425742e-03, 1.98980908e-03,
2.07176789e-03, 6.36946307e-04, 2.63967982e-03,
-3.04505478e-02, -3.13142367e-02, -2.63012497e-03],
[ 1.17901487e-02, 1.12761910e-02, 1.43740054e-02,
6.85614288e-03, -2.29026796e-02, -1.51814482e-02,
1.06408604e-02, -4.08619056e-04, 2.53235985e-04,
1.00000000e+00, 8.27818129e-01, -6.44651932e-03,
-4.47803666e-03, 1.46752712e-02, 1.00842746e-02,
2.26113476e-02, 1.64016469e-02, 1.22485141e-02,
1.14861651e-02, 6.11008203e-03, 1.48136377e-02,
-1.89164447e-01, -1.20971486e-01, 2.20528392e-02],
[ 2.36496952e-03, 7.44764921e-03, 9.95461105e-03,
8.06167921e-03, -1.58308247e-02, -1.18111878e-02,
8.57347802e-03, -1.18095751e-03, 1.04841191e-03,
8.27818129e-01, 1.00000000e+00, -3.17792618e-03,
-2.09531364e-03, 6.02799639e-03, 7.02826403e-03,
1.22804286e-02, 1.20769505e-02, 2.82836705e-03,
7.40686364e-03, -1.89323344e-03, 1.01863255e-02,
-1.46055450e-01, -1.46927884e-01, 3.25171808e-02],
[ 3.63958608e-03, 2.80859210e-03, 2.50400522e-03,
2.06570814e-04, 2.97458208e-03, 6.98551352e-04,
-3.02460254e-06, 4.71923515e-03, 2.43626466e-03,
-6.44651932e-03, -3.17792618e-03, 1.00000000e+00,
6.20887829e-01, 2.76320062e-03, 1.63471394e-03,
8.08359367e-03, 4.56374320e-03, 4.33201243e-03,
3.07157070e-03, 3.90163158e-03, 4.36973760e-03,
-6.60123665e-02, 1.00957185e-02, 3.42544859e-02],
[ 1.98991979e-03, 2.22151163e-03, 2.42961919e-03,
1.10032060e-03, 2.73988957e-03, 1.19524625e-03,
-4.33998401e-04, 3.09942580e-03, 2.17732378e-03,
-4.47803666e-03, -2.09531364e-03, 6.20887829e-01,
1.00000000e+00, 2.02664883e-03, 1.62366699e-03,
5.30443370e-03, 3.61198154e-03, 2.38801859e-03,
2.35061564e-03, 1.61938145e-03, 3.29660812e-03,
-4.89689593e-02, -1.26339292e-02, 2.04937594e-02],
[ 6.93697354e-03, 3.63258455e-03, 7.14562120e-03,
2.67809899e-03, 7.68800353e-03, 5.44288856e-03,
-4.14832094e-03, 5.78945600e-03, 3.00770222e-03,
1.46752712e-02, 6.02799639e-03, 2.76320062e-03,
2.02664883e-03, 1.00000000e+00, 7.29993671e-01,
4.32919855e-03, 3.18831900e-03, 5.89537137e-03,
3.54330144e-03, 2.05505207e-03, 3.09573935e-03,
-2.33073914e-03, -6.62782347e-02, -6.88656201e-02],
[ 3.18750624e-03, 2.30228166e-03, 4.16427002e-03,
2.05153678e-03, 4.40368584e-03, 3.10089451e-03,
-2.19098494e-03, 3.12087669e-03, 2.11327355e-03,
1.00842746e-02, 7.02826403e-03, 1.63471394e-03,
1.62366699e-03, 7.29993671e-01, 1.00000000e+00,
2.97723181e-03, 2.55364997e-03, 2.77516084e-03,
2.26550974e-03, 5.98373902e-04, 2.33546585e-03,
-1.46136353e-02, -4.48521746e-02, -2.76716844e-02],
[ 4.62963303e-03, 4.23518285e-03, 4.44156935e-03,
1.44270132e-03, 4.07191017e-03, 1.40744535e-03,
-3.12670777e-04, 5.88252770e-03, 3.63541784e-03,
2.26113476e-02, 1.22804286e-02, 8.08359367e-03,
5.30443370e-03, 4.32919855e-03, 2.97723181e-03,
1.00000000e+00, 7.53504261e-01, -9.26933114e-04,
-3.59695676e-04, -3.63767095e-02, -5.42564087e-02,
-9.19556229e-02, -1.11897304e-02, 3.88749127e-02],
[ 2.65657714e-03, 3.11650818e-03, 3.76366741e-03,
1.96132969e-03, 3.51283401e-03, 1.74404019e-03,
-7.30352908e-04, 3.81870238e-03, 2.92425742e-03,
1.64016469e-02, 1.20769505e-02, 4.56374320e-03,
3.61198154e-03, 3.18831900e-03, 2.55364997e-03,
7.53504261e-01, 1.00000000e+00, -9.18646165e-04,
-1.36376289e-04, -1.78397101e-02, -3.79517276e-02,
-6.28568815e-02, -2.86082676e-02, 2.00937124e-02],
[ 5.08027872e-03, 2.68568787e-03, 4.00910699e-03,
8.05665007e-04, 2.60342247e-03, 1.36152219e-03,
-9.85420913e-04, 4.49829869e-03, 1.98980908e-03,
1.22485141e-02, 2.82836705e-03, 4.33201243e-03,
2.38801859e-03, 5.89537137e-03, 2.77516084e-03,
-9.26933114e-04, -9.18646165e-04, 1.00000000e+00,
2.57241008e-01, -1.06823172e-03, -2.40854770e-03,
-2.51605499e-02, -1.67650504e-02, -1.81041097e-02],
[ 2.72503419e-03, 2.33836244e-03, 3.27345602e-03,
1.47651897e-03, 1.89400636e-03, 9.64560966e-04,
-4.59322489e-04, 3.08457010e-03, 2.07176789e-03,
1.14861651e-02, 7.40686364e-03, 3.07157070e-03,
2.35061564e-03, 3.54330144e-03, 2.26550974e-03,
-3.59695676e-04, -1.36376289e-04, 2.57241008e-01,
1.00000000e+00, -1.10495144e-03, -1.45658249e-03,
-3.50605268e-02, -2.62109633e-02, -8.44460986e-04],
[ 2.88928969e-03, 1.21539649e-03, 9.28136602e-04,
-8.12424374e-04, 6.54859628e-04, -3.03214993e-04,
2.89810881e-04, 2.58143596e-03, 6.36946307e-04,
6.11008203e-03, -1.89323344e-03, 3.90163158e-03,
1.61938145e-03, 2.05505207e-03, 5.98373902e-04,
-3.63767095e-02, -1.78397101e-02, -1.06823172e-03,
-1.10495144e-03, 1.00000000e+00, -3.31121236e-01,
-2.40820327e-02, 2.14694633e-02, 1.13411048e-02],
[ 2.69849087e-03, 2.88298780e-03, 3.44157621e-03,
1.63863125e-03, 2.81004533e-03, 1.27197897e-03,
-4.55829845e-04, 3.65937434e-03, 2.63967982e-03,
1.48136377e-02, 1.01863255e-02, 4.36973760e-03,
3.29660812e-03, 3.09573935e-03, 2.33546585e-03,
-5.42564087e-02, -3.79517276e-02, -2.40854770e-03,
-1.45658249e-03, -3.31121236e-01, 1.00000000e+00,
-5.75228531e-02, -2.30839701e-02, 1.82046783e-02],
[-1.25021221e-02, -3.17024931e-02, -2.26534942e-02,
-1.35889751e-02, -1.99433623e-02, -7.56035212e-04,
-8.70605579e-03, -3.50668798e-02, -3.04505478e-02,
-1.89164447e-01, -1.46055450e-01, -6.60123665e-02,
-4.89689593e-02, -2.33073914e-03, -1.46136353e-02,
-9.19556229e-02, -6.28568815e-02, -2.51605499e-02,
-3.50605268e-02, -2.40820327e-02, -5.75228531e-02,
1.00000000e+00, 3.27050710e-02, -6.85461175e-01],
[-2.67823523e-02, -2.86057041e-02, -6.40995747e-02,
-4.44634776e-02, -6.80567699e-02, -5.58584017e-02,
4.01599286e-02, -2.94250446e-02, -3.13142367e-02,
-1.20971486e-01, -1.46927884e-01, 1.00957185e-02,
-1.26339292e-02, -6.62782347e-02, -4.48521746e-02,
-1.11897304e-02, -2.86082676e-02, -1.67650504e-02,
-2.62109633e-02, 2.14694633e-02, -2.30839701e-02,
3.27050710e-02, 1.00000000e+00, 5.83311838e-01],
[-3.51682646e-02, -4.31174491e-03, -3.86005655e-02,
-1.60101885e-02, -4.44053828e-02, -4.28107977e-02,
3.85820969e-02, -1.39046591e-02, -2.63012497e-03,
2.20528392e-02, 3.25171808e-02, 3.42544859e-02,
2.04937594e-02, -6.88656201e-02, -2.76716844e-02,
3.88749127e-02, 2.00937124e-02, -1.81041097e-02,
-8.44460986e-04, 1.13411048e-02, 1.82046783e-02,
-6.85461175e-01, 5.83311838e-01, 1.00000000e+00]]),
'values': array([0.40873049, 1.97712566, 2.61760355, 3.28600754, 0.59437064,
1.1738829 , 0.58513717, 0.45812393, 2.32763903, 1.353692 ,
2.45898536, 1.13309978, 1.95233296, 0.66407893, 2.35321718,
0.39179202, 2.28983575, 0.59760462, 2.01578901, 1.40372793,
2.01286481, 1.09425086, 0.04635347, 0.68354775]),
'errors': array([0.07060956, 0.13726812, 1.55825185, 0.49458154, 0.05463354,
0.18602925, 0.07942507, 0.0573262 , 0.10855472, 0.11413448,
0.0610685 , 0.19316888, 0.11081446, 0.09685406, 0.11456721,
0.08434245, 0.15080752, 0.06245535, 0.09286232, 0.15991086,
0.09911143, 0.02116494, 0.02057968, 0.04315161]),
'indices': array([ 0, 1, 3, 4, 6, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23,
25, 26, 28, 29, 31, 32, 34]),
'is_norm': array([ True, False, True, False, True, False, False, True, False,
True, False, True, False, True, False, True, False, True,
False, True, False, True, False, True]),
'src_names': ['3FGL J0002.0-6722',
'3FGL J0002.0-6722',
'3FGL J0021.6-6835',
'3FGL J0021.6-6835',
'3FGL J0023.9-7203',
'3FGL J0023.9-7203',
'3FGL J0023.9-7203',
'3FGL J0029.1-7045',
'3FGL J0029.1-7045',
'3FGL J0059.0-7242e',
'3FGL J0059.0-7242e',
'3FGL J0112.9-7506',
'3FGL J0112.9-7506',
'3FGL J0146.4-6746',
'3FGL J0146.4-6746',
'3FGL J2336.5-7620',
'3FGL J2336.5-7620',
'3FGL J2338.7-7401',
'3FGL J2338.7-7401',
'3FGL J2351.9-7601',
'3FGL J2351.9-7601',
'galdiff',
'galdiff',
'isodiff'],
'par_names': ['Prefactor',
'Index',
'Prefactor',
'Index',
'norm',
'alpha',
'beta',
'Prefactor',
'Index',
'Prefactor',
'Index',
'Prefactor',
'Index',
'Prefactor',
'Index',
'Prefactor',
'Index',
'Prefactor',
'Index',
'Prefactor',
'Index',
'Prefactor',
'Index',
'Normalization'],
'config': {'optimizer': 'MINUIT',
'tol': 0.001,
'max_iter': 100,
'init_lambda': 0.0001,
'retries': 3,
'min_fit_quality': 2,
'verbosity': 0,
'covar': True,
'reoptimize': False},
'niter': 1}
Output files
The current state of the ROI can be written at any point by calling write_roi.
[16]:
gta.write_roi('initial',make_plots=True,save_model_map=True)
plt.show()
2024-12-19 20:22:45 INFO GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/initial_00.xml...
2024-12-19 20:22:45 INFO GTAnalysis.write_fits(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/initial.fits...
WARNING: Format %s cannot be mapped to the accepted TDISPn keyword values. Format will not be moved into TDISPn keyword. [astropy.io.fits.column]
WARNING: Format %f cannot be mapped to the accepted TDISPn keyword values. Format will not be moved into TDISPn keyword. [astropy.io.fits.column]
WARNING: Format %s cannot be mapped to the accepted TDISPn keyword values. Format will not be moved into TDISPn keyword. [astropy.io.fits.column]
2024-12-19 20:22:51 INFO GTBinnedAnalysis.write_model_map(): Generating model map for component 00.
2024-12-19 20:22:53 INFO GTAnalysis.write_roi(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/initial.npy...
The output file will contain all information about the state of the ROI as calculated up to that point in the analysis including model parameters and measured source characteristics (flux, TS, NPred). An XML model file will also be saved for each analysis component.
The output file can be read with load:
[17]:
gta.load_roi('initial')
2024-12-19 20:22:55 INFO GTAnalysis.load_roi(): Loading ROI file: /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/initial.npy
2024-12-19 20:22:55 INFO GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00.
2024-12-19 20:23:00 INFO GTAnalysis.load_roi(): Finished Loading ROI
Using gta.print_model You have an overview of the sources and components present in the ROI.
[18]:
gta.print_model()
2024-12-19 20:23:00 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e 0.088 1.354 1.02e-05 2.46 631.43 1387.2 *
3FGL J0112.9-7506 2.572 1.133 2.16e-06 1.95 145.27 129.2 *
3FGL J0023.9-7203 2.662 0.594 9.79e-06 2.70 5206.25 1799.4 *
3FGL J0029.1-7045 3.008 0.458 2.07e-06 2.33 269.77 239.2 *
3FGL J0021.6-6835 5.122 2.618 2.57e-07 3.29 16.47 57.1 *
3FGL J2351.9-7601 5.495 1.404 2.85e-06 2.01 243.25 192.1 *
3FGL J2338.7-7401 5.777 0.598 2.91e-06 2.02 294.33 187.1 *
3FGL J0146.4-6746 6.423 0.664 1.76e-06 2.35 256.39 201.6 *
3FGL J2336.5-7620 6.454 0.392 1.28e-06 2.29 112.83 135.9 *
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.14 95.4 *
isodiff --- 0.684 0.0214 2.12 713.57 6220.2 *
galdiff --- 1.094 0.134 0.05 7041.53 17811.3 *
Source Dictionary
The sources dictionary contains one element per source keyed to the source name. It is possible to have access to a lot of informations concerning each source of model.
[19]:
print(gta.roi.sources[0].name) #NAME OF THE SOURCE
print(gta.roi[gta.roi.sources[0].name]) #NAME OF THE SOURCE
print(gta.roi[gta.roi.sources[0].name]['glon']) #Longitude OF THE SOURCE
print(gta.roi[gta.roi.sources[0].name]['glat']) #Latitude OF THE SOURCE
print(gta.roi[gta.roi.sources[0].name]['flux']) #Flux OF THE SOURCE
print(gta.roi[gta.roi.sources[0].name]['npred']) #npred OF THE SOURCE
3FGL J0059.0-7242e
Name : 3FGL J0059.0-7242e
Associations : ['3FGL J0059.0-7242e', 'SMC', '2FGL J0059.0-7242e']
RA/DEC : 14.750/ -72.700
GLON/GLAT : 302.145/ -44.417
TS : 631.43
Npred : 1387.21
Flux : 3.407e-09 +/- 1.61e-10
EnergyFlux : 1.02e-05 +/- 8.19e-07
SpatialModel : SpatialMap
SpectrumType : PowerLaw
Spectral Parameters
b'Prefactor' : 1.354e-11 +/- 1.141e-12
b'Index' : -2.459 +/- -0.06107
b'Scale' : 665.5 +/- nan
302.1449479051668
-44.41669737470087
3.406737511517394e-09
1387.206279433444
Other possible outputs are listed here fermipy/sourcedictionary
[20]:
gta.free_shape(gta.roi.sources[0].name,free=False) #Free or fix the index
gta.get_free_source_params(gta.roi.sources[0].name) #Free or fix parameters for a source
gta.set_parameter(gta.roi.sources[0].name,par='Index',value=2.0,scale=-1.0,bounds=[-2.,5.]) #Change the value and bounds for a parameter of a source
2024-12-19 20:23:00 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0059.0-7242e : ['Index']
/home/runner/miniconda3/envs/fermipy/lib/python3.9/site-packages/scipy/interpolate/_fitpack2.py:313: UserWarning:
A theoretically impossible result was found during the iteration
process for finding a smoothing spline with fp = s: s too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.
warnings.warn(message)
You can always use gta.print_model() to have a summary of you model.
[21]:
gta.print_model()
2024-12-19 20:23:00 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e 0.088 1.354 4.79e+05 -2.00-1410013839029.03705007031198.9 *
3FGL J0112.9-7506 2.572 1.133 2.16e-06 1.95 145.27 129.2 *
3FGL J0023.9-7203 2.662 0.594 9.79e-06 2.70 5206.25 1799.4 *
3FGL J0029.1-7045 3.008 0.458 2.07e-06 2.33 269.77 239.2 *
3FGL J0021.6-6835 5.122 2.618 2.57e-07 3.29 16.47 57.1 *
3FGL J2351.9-7601 5.495 1.404 2.85e-06 2.01 243.25 192.1 *
3FGL J2338.7-7401 5.777 0.598 2.91e-06 2.02 294.33 187.1 *
3FGL J0146.4-6746 6.423 0.664 1.76e-06 2.35 256.39 201.6 *
3FGL J2336.5-7620 6.454 0.392 1.28e-06 2.29 112.83 135.9 *
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.14 95.4 *
isodiff --- 0.684 0.0214 2.12 713.57 6220.2 *
galdiff --- 1.094 0.134 0.05 7041.53 17811.3 *
Customizing your model
The ROIModel class is responsible for managing the source and diffuse components in the ROI. Configuration of the model is controlled with the model block of YAML configuration file.
DIFFUSE AND ISOTROPIC TEMPLATES
The simplest configuration uses a single file for the galactic and isotropic diffuse components. By default the galactic diffuse and isotropic components will be named galdiff and isodiff respectively. An alias for each component will also be created with the name of the mapcube or file spectrum. For instance the galactic diffuse can be referred to as galdiff or gll_iem_v06 in the following example.
model: src_roiwidth : 10.0 galdiff : '$FERMI_DIFFUSE_DIR/gll_iem_v06.fits' isodiff : '$FERMI_DIFFUSE_DIR/isotropic_source_4years_P8V3.txt' catalogs : ['gll_psc_v14.fit']To define two or more galactic diffuse components you can optionally define the galdiff and isodiff parameters as lists. A separate component will be generated for each element in the list with the name galdiffXX or isodiffXX where XX is an integer position in the list.
model: galdiff : - '$FERMI_DIFFUSE_DIR/diffuse_component0.fits' - '$FERMI_DIFFUSE_DIR/diffuse_component1.fits'SOURCE COMPONENT
The list of sources for inclusion in the ROI model is set by defining a list of catalogs with the catalogs parameter. Catalog files can be in either XML or FITS format. Sources from the catalogs in this list that satisfy either the src_roiwidth or src_radius selections are added to the ROI model. If a source is defined in multiple catalogs the source definition from the last file in the catalogs list takes precedence.
model: src_radius: 5.0 src_roiwidth: 10.0 catalogs : - 'gll_psc_v16.fit' - 'extra_sources.xml'Individual sources can also be defined within the configuration file with the sources parameter. This parameter contains a list of dictionaries that defines the spatial and spectral parameters of each source. The keys of the source dictionary map to the spectral and spatial source properties as they would be defined in the XML model file.
model: sources : - { name: 'SourceA', glon : 120.0, glat : -3.0, SpectrumType : 'PowerLaw', Index : 2.0, Scale : 1000, Prefactor : !!float 1e-11, SpatialModel: 'PointSource' } - { name: 'SourceB', glon : 122.0, glat : -3.0, SpectrumType : 'LogParabola', norm : !!float 1E-11, Scale : 1000, beta : 0.0, SpatialModel: 'PointSource' } model: sources : - { name: 'PointSource', glon : 120.0, glat : 0.0, SpectrumType : 'PowerLaw', Index : 2.0, Scale : 1000, Prefactor : !!float 1e-11, SpatialModel: 'PointSource' } - { name: 'DiskSource', glon : 120.0, glat : 0.0, SpectrumType : 'PowerLaw', Index : 2.0, Scale : 1000, Prefactor : !!float 1e-11, SpatialModel: 'RadialDisk', SpatialWidth: 1.0 } - { name: 'GaussSource', glon : 120.0, glat : 0.0, SpectrumType : 'PowerLaw', Index : 2.0, Scale : 1000, Prefactor : !!float 1e-11, SpatialModel: 'RadialGaussian', SpatialWidth: 1.0 } - { name: 'MapSource', glon : 120.0, glat : 0.0, SpectrumType : 'PowerLaw', Index : 2.0, Scale : 1000, Prefactor : !!float 1e-11, SpatialModel: 'SpatialTemplate', Spatial_Filename : 'template.fits' }Or you can do it while you are running your script with:
[22]:
gta.delete_source(gta.roi.sources[0].name)
glon0 = gta.config['selection']['glon']
glat0 = gta.config['selection']['glat']
gta.add_source('SMC', dict(glon=glon0, glat=glat0, Index=dict(value=-2.4,scale=1.0,max="-1.",min="-5."), Scale=dict(value=1e3,scale=1.0,max="1e5",min="1e0"), Prefactor=dict(value=1.0,scale=1e-13,max="10000.0", min="0.0001"), SpectrumType='PowerLaw'), free=True, init_source=True, save_source_maps=True)
gta.print_model()
2024-12-19 20:23:00 INFO GTAnalysis.delete_source(): Deleting source 3FGL J0059.0-7242e
2024-12-19 20:23:00 INFO GTAnalysis.add_source(): Adding source SMC
2024-12-19 20:23:01 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.000 1.000 2.29e-07 2.40 nan 30.6 *
3FGL J0112.9-7506 2.572 1.133 2.16e-06 1.95 145.27 129.2 *
3FGL J0023.9-7203 2.662 0.594 9.79e-06 2.70 5206.25 1799.4 *
3FGL J0029.1-7045 3.008 0.458 2.07e-06 2.33 269.77 239.2 *
3FGL J0021.6-6835 5.122 2.618 2.57e-07 3.29 16.47 57.1 *
3FGL J2351.9-7601 5.495 1.404 2.85e-06 2.01 243.25 192.1 *
3FGL J2338.7-7401 5.777 0.598 2.91e-06 2.02 294.33 187.1 *
3FGL J0146.4-6746 6.423 0.664 1.76e-06 2.35 256.39 201.6 *
3FGL J2336.5-7620 6.454 0.392 1.28e-06 2.29 112.83 135.9 *
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.14 95.4 *
isodiff --- 0.684 0.0214 2.12 713.57 6220.2 *
galdiff --- 1.094 0.134 0.05 7041.53 17811.3 *
All sources have nan because we have not done yet a fit do the ROI. Moreover in the model above all sources are fixed. In order to free the parameters of the source it’s enough to make gta.free_sources()
[23]:
gta.free_sources()
gta.print_model()
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Index']
2024-12-19 20:23:01 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.000 1.000 2.29e-07 2.40 nan 30.6 *
3FGL J0112.9-7506 2.572 1.133 2.16e-06 1.95 145.27 129.2 *
3FGL J0023.9-7203 2.662 0.594 9.79e-06 2.70 5206.25 1799.4 *
3FGL J0029.1-7045 3.008 0.458 2.07e-06 2.33 269.77 239.2 *
3FGL J0021.6-6835 5.122 2.618 2.57e-07 3.29 16.47 57.1 *
3FGL J2351.9-7601 5.495 1.404 2.85e-06 2.01 243.25 192.1 *
3FGL J2338.7-7401 5.777 0.598 2.91e-06 2.02 294.33 187.1 *
3FGL J0146.4-6746 6.423 0.664 1.76e-06 2.35 256.39 201.6 *
3FGL J2336.5-7620 6.454 0.392 1.28e-06 2.29 112.83 135.9 *
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.14 95.4 *
isodiff --- 0.684 0.0214 2.12 713.57 6220.2 *
galdiff --- 1.094 0.134 0.05 7041.53 17811.3 *
It is also possible to free only the sources that are at a certain angular distance from a source. For example below we free the sources that are 2 degrees away from 3FGL J0322.5-3721:
[24]:
gta.free_sources(free=False)
gta.free_sources(skydir=gta.roi[gta.roi.sources[0].name].skydir,distance=[3.0],free=True)
gta.print_model()
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for isodiff : ['Normalization']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.000 1.000 2.29e-07 2.40 nan 30.6 *
3FGL J0112.9-7506 2.572 1.133 2.16e-06 1.95 145.27 129.2 *
3FGL J0023.9-7203 2.662 0.594 9.79e-06 2.70 5206.25 1799.4 *
3FGL J0029.1-7045 3.008 0.458 2.07e-06 2.33 269.77 239.2
3FGL J0021.6-6835 5.122 2.618 2.57e-07 3.29 16.47 57.1
3FGL J2351.9-7601 5.495 1.404 2.85e-06 2.01 243.25 192.1
3FGL J2338.7-7401 5.777 0.598 2.91e-06 2.02 294.33 187.1
3FGL J0146.4-6746 6.423 0.664 1.76e-06 2.35 256.39 201.6
3FGL J2336.5-7620 6.454 0.392 1.28e-06 2.29 112.83 135.9
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.14 95.4
isodiff --- 0.684 0.0214 2.12 713.57 6220.2 *
galdiff --- 1.094 0.134 0.05 7041.53 17811.3 *
Fit Roi
Source fitting with fermipy is generally performed with the optimize and fit methods. fit is a wrapper on the pyLikelihood fit method and performs a likelihood fit of all free parameters of the model. This method can be used to manually optimize of the model by calling it after freeing one or more source parameters.
[25]:
gta.print_model()
gta.free_sources(free=True)
gta.print_model()
first_fit=gta.fit()
gta.print_model()
gta.write_roi('SMC_firstfit',make_plots=True,save_model_map=True)
2024-12-19 20:23:01 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.000 1.000 2.29e-07 2.40 nan 30.6 *
3FGL J0112.9-7506 2.572 1.133 2.16e-06 1.95 145.27 129.2 *
3FGL J0023.9-7203 2.662 0.594 9.79e-06 2.70 5206.25 1799.4 *
3FGL J0029.1-7045 3.008 0.458 2.07e-06 2.33 269.77 239.2
3FGL J0021.6-6835 5.122 2.618 2.57e-07 3.29 16.47 57.1
3FGL J2351.9-7601 5.495 1.404 2.85e-06 2.01 243.25 192.1
3FGL J2338.7-7401 5.777 0.598 2.91e-06 2.02 294.33 187.1
3FGL J0146.4-6746 6.423 0.664 1.76e-06 2.35 256.39 201.6
3FGL J2336.5-7620 6.454 0.392 1.28e-06 2.29 112.83 135.9
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.14 95.4
isodiff --- 0.684 0.0214 2.12 713.57 6220.2 *
galdiff --- 1.094 0.134 0.05 7041.53 17811.3 *
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index']
2024-12-19 20:23:01 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.000 1.000 2.29e-07 2.40 nan 30.6 *
3FGL J0112.9-7506 2.572 1.133 2.16e-06 1.95 145.27 129.2 *
3FGL J0023.9-7203 2.662 0.594 9.79e-06 2.70 5206.25 1799.4 *
3FGL J0029.1-7045 3.008 0.458 2.07e-06 2.33 269.77 239.2 *
3FGL J0021.6-6835 5.122 2.618 2.57e-07 3.29 16.47 57.1 *
3FGL J2351.9-7601 5.495 1.404 2.85e-06 2.01 243.25 192.1 *
3FGL J2338.7-7401 5.777 0.598 2.91e-06 2.02 294.33 187.1 *
3FGL J0146.4-6746 6.423 0.664 1.76e-06 2.35 256.39 201.6 *
3FGL J2336.5-7620 6.454 0.392 1.28e-06 2.29 112.83 135.9 *
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.14 95.4 *
isodiff --- 0.684 0.0214 2.12 713.57 6220.2 *
galdiff --- 1.094 0.134 0.05 7041.53 17811.3 *
2024-12-19 20:23:01 INFO GTAnalysis.fit(): Starting fit.
/home/runner/miniconda3/envs/fermipy/lib/python3.9/site-packages/scipy/interpolate/_fitpack2.py:313: UserWarning:
The maximal number of iterations maxit (set to 20 by the program)
allowed for finding a smoothing spline with fp=s has been reached: s
too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.
warnings.warn(message)
2024-12-19 20:23:05 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0
2024-12-19 20:23:05 INFO GTAnalysis.fit(): LogLike: -74007.768 DeltaLogLike: 124.131
2024-12-19 20:23:05 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.000 16.743 1.54e-06 3.08 237.86 345.4 *
3FGL J0112.9-7506 2.572 1.156 2.13e-06 1.96 144.09 130.9 *
3FGL J0023.9-7203 2.662 0.614 9.88e-06 2.71 5220.39 1821.4 *
3FGL J0029.1-7045 3.008 0.456 2.05e-06 2.33 262.02 237.5 *
3FGL J0021.6-6835 5.122 2.244 2.22e-07 3.28 12.44 49.3 *
3FGL J2351.9-7601 5.495 1.350 2.82e-06 1.99 227.99 181.7 *
3FGL J2338.7-7401 5.777 0.573 2.9e-06 2.00 278.99 179.3 *
3FGL J0146.4-6746 6.423 0.628 1.73e-06 2.33 240.73 193.3 *
3FGL J2336.5-7620 6.454 0.350 1.25e-06 2.25 102.13 125.3 *
3FGL J0002.0-6722 7.153 0.380 1.61e-06 1.95 86.39 89.3 *
isodiff --- 0.692 0.0217 2.12 676.40 6299.0 *
galdiff --- 1.145 0.143 0.03 7143.72 18803.3 *
2024-12-19 20:23:05 INFO GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/SMC_firstfit_00.xml...
2024-12-19 20:23:05 INFO GTAnalysis.write_fits(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/SMC_firstfit.fits...
WARNING: Format %s cannot be mapped to the accepted TDISPn keyword values. Format will not be moved into TDISPn keyword. [astropy.io.fits.column]
WARNING: Format %f cannot be mapped to the accepted TDISPn keyword values. Format will not be moved into TDISPn keyword. [astropy.io.fits.column]
WARNING: Format %s cannot be mapped to the accepted TDISPn keyword values. Format will not be moved into TDISPn keyword. [astropy.io.fits.column]
2024-12-19 20:23:11 INFO GTBinnedAnalysis.write_model_map(): Generating model map for component 00.
2024-12-19 20:23:13 INFO GTAnalysis.write_roi(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/SMC_firstfit.npy...
By default fit will repeat the fit until a fit quality of 3 is obtained. After the fit returns all sources with free parameters will have their properties (flux, TS, NPred, etc.) updated in the ROIModel instance. The return value of the method is a dictionary containing the following diagnostic information about the fit.
The fit also accepts keyword arguments which can be used to configure its behavior at runtime:
[26]:
print(first_fit['fit_quality'])
print(first_fit['errors'])
print(first_fit['loglike'])
print(first_fit['values'])
3
[0.06991289 0.14072903 1.95529323 0.72232398 0.05789817 0.19306505
0.0824121 0.058591 0.11147643 0.20037076 0.11381506 0.09626897
0.11835223 0.08326155 0.15952366 0.06197246 0.09395016 0.1555259
0.09940693 2.08724529 0.16953993 0.02112615 0.01936994 0.04429168]
-74007.7682636879
[ 0.38044108 1.95000454 2.24442147 3.28059977 0.61376278 1.20944436
0.57544589 0.45570337 2.33070973 1.15558693 1.96447879 0.62764624
2.33430442 0.35032136 2.25046591 0.57271341 1.99675518 1.35003922
1.98995478 16.74347976 -3.08450717 1.1448052 0.03238419 0.69220955]
[27]:
print(gta.roi.sources[0]['param_names'])
print(gta.roi.sources[0]['param_values'])
print(gta.roi.sources[0]['param_errors'])
[b'Prefactor' b'Index' b'Scale' b'' b'' b'' b'' b'' b'' b'']
[ 1.67434798e-12 -3.08450717e+00 1.00000000e+03 nan
nan nan nan nan
nan nan]
[2.08724529e-13 1.69539934e-01 nan nan
nan nan nan nan
nan nan]
The optimize method performs an automatic optimization of the ROI by fitting all sources with an iterative strategy. It is generally good practice to run this method once at the start of your analysis to ensure that all parameters are close to their global likelihood maxima.
[28]:
gta.load_roi('initial')
gta.print_model()
2024-12-19 20:23:15 INFO GTAnalysis.load_roi(): Loading ROI file: /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/initial.npy
2024-12-19 20:23:15 INFO GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00.
2024-12-19 20:23:20 INFO GTAnalysis.load_roi(): Finished Loading ROI
2024-12-19 20:23:20 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e 0.088 1.354 1.02e-05 2.46 631.43 1387.2 *
3FGL J0112.9-7506 2.572 1.133 2.16e-06 1.95 145.27 129.2 *
3FGL J0023.9-7203 2.662 0.594 9.79e-06 2.70 5206.25 1799.4 *
3FGL J0029.1-7045 3.008 0.458 2.07e-06 2.33 269.77 239.2 *
3FGL J0021.6-6835 5.122 2.618 2.57e-07 3.29 16.47 57.1 *
3FGL J2351.9-7601 5.495 1.404 2.85e-06 2.01 243.25 192.1 *
3FGL J2338.7-7401 5.777 0.598 2.91e-06 2.02 294.33 187.1 *
3FGL J0146.4-6746 6.423 0.664 1.76e-06 2.35 256.39 201.6 *
3FGL J2336.5-7620 6.454 0.392 1.28e-06 2.29 112.83 135.9 *
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.14 95.4 *
isodiff --- 0.684 0.0214 2.12 713.57 6220.2 *
galdiff --- 1.094 0.134 0.05 7041.53 17811.3 *
[29]:
gta.load_roi('SMC_firstfit')
gta.print_model()
2024-12-19 20:23:20 INFO GTAnalysis.load_roi(): Loading ROI file: /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/SMC_firstfit.npy
2024-12-19 20:23:20 INFO GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00.
2024-12-19 20:23:25 INFO GTAnalysis.load_roi(): Finished Loading ROI
2024-12-19 20:23:25 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.000 16.743 1.54e-06 3.08 237.86 345.4 *
3FGL J0112.9-7506 2.572 1.156 2.13e-06 1.96 144.09 130.9 *
3FGL J0023.9-7203 2.662 0.614 9.88e-06 2.71 5220.39 1821.4 *
3FGL J0029.1-7045 3.008 0.456 2.05e-06 2.33 262.02 237.5 *
3FGL J0021.6-6835 5.122 2.244 2.22e-07 3.28 12.44 49.3 *
3FGL J2351.9-7601 5.495 1.350 2.82e-06 1.99 227.99 181.7 *
3FGL J2338.7-7401 5.777 0.573 2.9e-06 2.00 278.99 179.3 *
3FGL J0146.4-6746 6.423 0.628 1.73e-06 2.33 240.73 193.3 *
3FGL J2336.5-7620 6.454 0.350 1.25e-06 2.25 102.13 125.3 *
3FGL J0002.0-6722 7.153 0.380 1.61e-06 1.95 86.39 89.3 *
isodiff --- 0.692 0.0217 2.12 676.40 6299.0 *
galdiff --- 1.145 0.143 0.03 7143.72 18803.3 *
TS Map
tsmap() generates a test statistic (TS) map for an additional source component centered at each spatial bin in the ROI. The methodology is similar to that of the gttsmap ST application but with the following approximations:
Evaluation of the likelihood is limited to pixels in the vicinity of the test source position.
The background model is fixed when fitting the test source amplitude.
TS Cube is a related method that can also be used to generate TS maps as well as cubes (TS vs. position and energy).
[30]:
plt.clf()
tsmap_postfit = gta.tsmap(prefix='TSmap_start',make_plots=True,write_fits=True,write_npy=True)
2024-12-19 20:23:25 INFO GTAnalysis.tsmap(): Generating TS map
2024-12-19 20:23:25 INFO GTAnalysis._make_tsmap_fast(): Fitting test source.
2024-12-19 20:23:34 INFO GTAnalysis.tsmap(): Finished TS map
2024-12-19 20:23:40 WARNING GTAnalysis.tsmap(): Saving TS maps in .npy files is disabled b/c of incompatibilities in python3, remove the maps from the /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/TSmap_start_pointsource_powerlaw_2.00_tsmap.npy
2024-12-19 20:23:40 INFO GTAnalysis.tsmap(): Execution time: 15.36 s
[31]:
plt.clf()
fig = plt.figure(figsize=(14,6))
ROIPlotter(tsmap_postfit['sqrt_ts'],roi=gta.roi).plot(levels=[0,3,5,7],vmin=0,vmax=5,subplot=121,cmap='magma')
plt.gca().set_title('Sqrt(TS)')
ROIPlotter(tsmap_postfit['npred'],roi=gta.roi).plot(vmin=0,vmax=100,subplot=122,cmap='magma')
plt.gca().set_title('NPred')
plt.show()
<Figure size 800x600 with 0 Axes>
Looking to the TSmap it is quite clear that the model does not fit sufficiently well the data.
Residual Map
residmap() calculates the residual between smoothed data and model maps. Whereas a TS map is only sensitive to positive deviations with respect to the model, residmap() is sensitive to both positive and negative residuals and therefore can be useful for assessing the model goodness-of-fit.
[32]:
resid = gta.residmap('SMC_postfit',model={'SpatialModel' : 'PointSource', 'Index' : 2.0},write_fits=True,write_npy=True,make_plots=True)
2024-12-19 20:23:41 INFO GTAnalysis.residmap(): Generating residual maps
2024-12-19 20:23:41 INFO GTAnalysis.add_source(): Adding source residmap_testsource
2024-12-19 20:23:42 INFO GTAnalysis.delete_source(): Deleting source residmap_testsource
2024-12-19 20:23:44 INFO GTAnalysis.residmap(): Finished residual maps
2024-12-19 20:23:48 WARNING GTAnalysis.residmap(): Saving maps in .npy files is disabled b/c of incompatibilities in python3, remove the maps from the /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/SMC_postfit_pointsource_powerlaw_2.00_residmap.npy
2024-12-19 20:23:48 INFO GTAnalysis.residmap(): Execution time: 7.10 s
[33]:
plt.clf()
fig = plt.figure(figsize=(14,6))
ROIPlotter(resid['data'],roi=gta.roi).plot(vmin=50,vmax=400,subplot=121,cmap='magma')
plt.gca().set_title('Data')
ROIPlotter(resid['model'],roi=gta.roi).plot(vmin=50,vmax=400,subplot=122,cmap='magma')
plt.gca().set_title('Model')
plt.show()
<Figure size 640x480 with 0 Axes>
[34]:
plt.clf()
fig = plt.figure(figsize=(14,6))
ROIPlotter(resid['sigma'],roi=gta.roi).plot(vmin=-5,vmax=5,levels=[-5,-3,3,5],subplot=121,cmap='RdBu_r')
plt.gca().set_title('Significance')
ROIPlotter(resid['excess'],roi=gta.roi).plot(vmin=-100,vmax=100,subplot=122,cmap='RdBu_r')
plt.gca().set_title('Excess')
plt.show()
<Figure size 640x480 with 0 Axes>
Source Localization
The localize() method can be used to spatially localize a source. Localization is performed by scanning the likelihood surface in source position in a local patch around the nominal source position. The fit to the source position proceeds in two iterations:
TS Map Scan: Obtain a first estimate of the source position by generating a likelihood map of the region using the tsmap method. In this step all background parameters are fixed to their nominal values. The size of the search region used for this step is set with the dtheta_max parameter. Likelihood Scan: Refine the position of the source by performing a scan of the likelihood surface in a box centered on the best-fit position found in the first iteration. The size of the search region is set to encompass the 99% positional uncertainty contour. This method uses a full likelihood fit at each point in the likelihood scan and will re-fit all free parameters of the model. If a peak is found in the search region and the positional fit succeeds, the method will update the position of the source in the model to the new best-fit position.
[35]:
gta.free_sources(free=False)
gta.print_model()
gta.free_sources(skydir=gta.roi[gta.roi.sources[0].name].skydir,distance=[3.0],free=True)
gta.print_model()
localsmc = gta.localize(gta.roi.sources[0].name, update=True, make_plots=True)
gta.print_model()
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for isodiff : ['Normalization']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.000 16.743 1.54e-06 3.08 237.86 345.4
3FGL J0112.9-7506 2.572 1.156 2.13e-06 1.96 144.09 130.9
3FGL J0023.9-7203 2.662 0.614 9.88e-06 2.71 5220.39 1821.4
3FGL J0029.1-7045 3.008 0.456 2.05e-06 2.33 262.02 237.5
3FGL J0021.6-6835 5.122 2.244 2.22e-07 3.28 12.44 49.3
3FGL J2351.9-7601 5.495 1.350 2.82e-06 1.99 227.99 181.7
3FGL J2338.7-7401 5.777 0.573 2.9e-06 2.00 278.99 179.3
3FGL J0146.4-6746 6.423 0.628 1.73e-06 2.33 240.73 193.3
3FGL J2336.5-7620 6.454 0.350 1.25e-06 2.25 102.13 125.3
3FGL J0002.0-6722 7.153 0.380 1.61e-06 1.95 86.39 89.3
isodiff --- 0.692 0.0217 2.12 676.40 6299.0
galdiff --- 1.145 0.143 0.03 7143.72 18803.3
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization']
2024-12-19 20:23:50 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index']
2024-12-19 20:23:50 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.000 16.743 1.54e-06 3.08 237.86 345.4 *
3FGL J0112.9-7506 2.572 1.156 2.13e-06 1.96 144.09 130.9 *
3FGL J0023.9-7203 2.662 0.614 9.88e-06 2.71 5220.39 1821.4 *
3FGL J0029.1-7045 3.008 0.456 2.05e-06 2.33 262.02 237.5
3FGL J0021.6-6835 5.122 2.244 2.22e-07 3.28 12.44 49.3
3FGL J2351.9-7601 5.495 1.350 2.82e-06 1.99 227.99 181.7
3FGL J2338.7-7401 5.777 0.573 2.9e-06 2.00 278.99 179.3
3FGL J0146.4-6746 6.423 0.628 1.73e-06 2.33 240.73 193.3
3FGL J2336.5-7620 6.454 0.350 1.25e-06 2.25 102.13 125.3
3FGL J0002.0-6722 7.153 0.380 1.61e-06 1.95 86.39 89.3
isodiff --- 0.692 0.0217 2.12 676.40 6299.0 *
galdiff --- 1.145 0.143 0.03 7143.72 18803.3 *
2024-12-19 20:23:50 INFO GTAnalysis.localize(): Running localization for SMC
2024-12-19 20:23:54 INFO GTAnalysis._localize(): Localization succeeded.
2024-12-19 20:23:54 INFO GTAnalysis._localize(): Updating source SMC to localized position.
2024-12-19 20:23:54 INFO GTAnalysis.delete_source(): Deleting source SMC
2024-12-19 20:23:54 INFO GTAnalysis.add_source(): Adding source SMC
2024-12-19 20:23:55 INFO GTAnalysis._localize(): Localization completed with new position:
( ra, dec) = ( 14.4129 +/- 0.0668, -72.6823 +/- 0.0573)
(glon,glat) = ( 302.2844 +/- 0.0682, -44.4382 +/- 0.0557)
offset = 0.0725 r68 = 0.0786 r95 = 0.1268 r99 = 0.1572
2024-12-19 20:23:55 INFO GTAnalysis._localize(): LogLike: -74004.956 DeltaLogLike: 3.025
2024-12-19 20:23:55 INFO GTAnalysis.localize(): Finished localization.
2024-12-19 20:23:59 WARNING GTAnalysis.localize(): Saving TS maps in .npy files is disabled b/c of incompatibilities in python3, remove the maps from the /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/smc_loc.npy
2024-12-19 20:23:59 INFO GTAnalysis.localize(): Execution time: 9.39 s
2024-12-19 20:23:59 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.072 17.030 1.54e-06 3.11 247.69 347.5 *
3FGL J0112.9-7506 2.572 1.156 2.13e-06 1.96 144.09 130.9 *
3FGL J0023.9-7203 2.662 0.614 9.88e-06 2.71 5220.39 1821.4 *
3FGL J0029.1-7045 3.008 0.456 2.05e-06 2.33 262.02 237.5
3FGL J0021.6-6835 5.122 2.244 2.22e-07 3.28 12.44 49.3
3FGL J2351.9-7601 5.495 1.350 2.82e-06 1.99 227.99 181.7
3FGL J2338.7-7401 5.777 0.573 2.9e-06 2.00 278.99 179.3
3FGL J0146.4-6746 6.423 0.628 1.73e-06 2.33 240.73 193.3
3FGL J2336.5-7620 6.454 0.350 1.25e-06 2.25 102.13 125.3
3FGL J0002.0-6722 7.153 0.380 1.61e-06 1.95 86.39 89.3
isodiff --- 0.692 0.0217 2.12 676.40 6299.0 *
galdiff --- 1.145 0.143 0.03 7143.72 18803.3 *
The SMC is relocalized at 0.07deg.
[36]:
print(localsmc['glon'])
print(localsmc['glat'])
print(localsmc['pos_r68'])
print(localsmc['pos_r95'])
print(localsmc['pos_r99'])
print(localsmc['pos_err_semimajor'])
print(localsmc['pos_err_semiminor'])
print(localsmc['dloglike_loc'])
302.2843802615741
-44.43818743570833
0.07855371928038839
0.12676992855694294
0.15719279984855322
0.08167938347530923
0.0328468114688483
2.7860946212749695
Extension Fitting
The extension() method executes a source extension analysis for a given source by computing a likelihood ratio test with respect to the no-extension (point-source) hypothesis and a best-fit model for extension. The best-fit extension is found by performing a likelihood profile scan over the source width (68% containment) and fitting for the extension that maximizes the model likelihood. Currently this method supports two models for extension: a 2D Gaussian (RadialGaussian) or a 2D disk (RadialDisk).
By default the method will fix all background parameters before performing the extension fit. One can leave background parameters free by setting free_background=True.
[37]:
gta.free_sources(free=False)
gta.print_model()
gta.free_sources(skydir=gta.roi[gta.roi.sources[0].name].skydir,distance=[3.0],free=True)
gta.print_model()
extensionsmc = gta.extension(gta.roi.sources[0].name,update=True,make_plots=True,sqrt_ts_threshold=3.0,spatial_model='RadialGaussian')
gta.print_model()
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Prefactor', 'Index']
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index']
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta']
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Fixing parameters for isodiff : ['Normalization']
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Prefactor', 'Index']
2024-12-19 20:23:59 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.072 17.030 1.54e-06 3.11 247.69 347.5
3FGL J0112.9-7506 2.572 1.156 2.13e-06 1.96 144.09 130.9
3FGL J0023.9-7203 2.662 0.614 9.88e-06 2.71 5220.39 1821.4
3FGL J0029.1-7045 3.008 0.456 2.05e-06 2.33 262.02 237.5
3FGL J0021.6-6835 5.122 2.244 2.22e-07 3.28 12.44 49.3
3FGL J2351.9-7601 5.495 1.350 2.82e-06 1.99 227.99 181.7
3FGL J2338.7-7401 5.777 0.573 2.9e-06 2.00 278.99 179.3
3FGL J0146.4-6746 6.423 0.628 1.73e-06 2.33 240.73 193.3
3FGL J2336.5-7620 6.454 0.350 1.25e-06 2.25 102.13 125.3
3FGL J0002.0-6722 7.153 0.380 1.61e-06 1.95 86.39 89.3
isodiff --- 0.692 0.0217 2.12 676.40 6299.0
galdiff --- 1.145 0.143 0.03 7143.72 18803.3
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Prefactor', 'Index']
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta']
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index']
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index']
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization']
2024-12-19 20:23:59 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index']
2024-12-19 20:23:59 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.072 17.030 1.54e-06 3.11 247.69 347.5 *
3FGL J0112.9-7506 2.572 1.156 2.13e-06 1.96 144.09 130.9 *
3FGL J0023.9-7203 2.662 0.614 9.88e-06 2.71 5220.39 1821.4 *
3FGL J0029.1-7045 3.008 0.456 2.05e-06 2.33 262.02 237.5 *
3FGL J0021.6-6835 5.122 2.244 2.22e-07 3.28 12.44 49.3
3FGL J2351.9-7601 5.495 1.350 2.82e-06 1.99 227.99 181.7
3FGL J2338.7-7401 5.777 0.573 2.9e-06 2.00 278.99 179.3
3FGL J0146.4-6746 6.423 0.628 1.73e-06 2.33 240.73 193.3
3FGL J2336.5-7620 6.454 0.350 1.25e-06 2.25 102.13 125.3
3FGL J0002.0-6722 7.153 0.380 1.61e-06 1.95 86.39 89.3
isodiff --- 0.692 0.0217 2.12 676.40 6299.0 *
galdiff --- 1.145 0.143 0.03 7143.72 18803.3 *
2024-12-19 20:23:59 INFO GTAnalysis.extension(): Running extension fit for SMC
2024-12-19 20:24:04 INFO GTAnalysis._extension(): Fitting extended-source model.
2024-12-19 20:24:08 INFO GTAnalysis._extension(): Generating TS map.
2024-12-19 20:24:10 INFO GTAnalysis._extension(): Testing point-source model.
2024-12-19 20:24:15 INFO GTAnalysis._extension(): Best-fit extension: 1.0934 + 0.0711 - 0.0641
2024-12-19 20:24:15 INFO GTAnalysis._extension(): TS_ext: 363.960
2024-12-19 20:24:15 INFO GTAnalysis._extension(): Extension UL: 1.2048
2024-12-19 20:24:15 INFO GTAnalysis._extension(): LogLike: -73823.018 DeltaLogLike: 181.938
2024-12-19 20:24:15 INFO GTAnalysis.extension(): Finished extension fit.
{'spatial_model': 'RadialGaussian', 'width': [], 'fit_position': False, 'width_min': 0.01, 'width_max': 1.0, 'width_nstep': 21, 'free_background': False, 'fix_shape': False, 'free_radius': None, 'fit_ebin': False, 'update': True, 'save_model_map': False, 'sqrt_ts_threshold': 3.0, 'psf_scale_fn': None, 'make_tsmap': True, 'tsmap_fitter': 'tsmap', 'make_plots': True, 'write_fits': True, 'write_npy': True, 'reoptimize': False, 'optimizer': {'optimizer': 'MINUIT', 'tol': 0.001, 'max_iter': 100, 'init_lambda': 0.0001, 'retries': 3, 'min_fit_quality': 2, 'verbosity': 0}, 'prefix': '', 'outfile': None, 'loge_bins': []}
{'spatial_model': 'RadialGaussian', 'width': [], 'fit_position': False, 'width_min': 0.01, 'width_max': 1.0, 'width_nstep': 21, 'free_background': False, 'fix_shape': False, 'free_radius': None, 'fit_ebin': False, 'update': True, 'save_model_map': False, 'sqrt_ts_threshold': 3.0, 'psf_scale_fn': None, 'make_tsmap': True, 'tsmap_fitter': 'tsmap', 'make_plots': True, 'write_fits': True, 'write_npy': True, 'reoptimize': False, 'optimizer': {'optimizer': 'MINUIT', 'tol': 0.001, 'max_iter': 100, 'init_lambda': 0.0001, 'retries': 3, 'min_fit_quality': 2, 'verbosity': 0}, 'prefix': '', 'outfile': None, 'loge_bins': []}
2024-12-19 20:24:18 WARNING GTAnalysis.extension(): Saving maps in .npy files is disabled b/c of incompatibilities in python3, remove the maps from the /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/smc_ext.npy
2024-12-19 20:24:18 INFO GTAnalysis.extension(): Execution time: 18.56 s
2024-12-19 20:24:18 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.072 37.873 8.09e-06 2.44 611.57 1128.7 *
3FGL J0112.9-7506 2.572 1.156 2.13e-06 1.96 144.09 130.9 *
3FGL J0023.9-7203 2.662 0.614 9.88e-06 2.71 5220.39 1821.4 *
3FGL J0029.1-7045 3.008 0.456 2.05e-06 2.33 262.02 237.5 *
3FGL J0021.6-6835 5.122 2.244 2.22e-07 3.28 12.44 49.3
3FGL J2351.9-7601 5.495 1.350 2.82e-06 1.99 227.99 181.7
3FGL J2338.7-7401 5.777 0.573 2.9e-06 2.00 278.99 179.3
3FGL J0146.4-6746 6.423 0.628 1.73e-06 2.33 240.73 193.3
3FGL J2336.5-7620 6.454 0.350 1.25e-06 2.25 102.13 125.3
3FGL J0002.0-6722 7.153 0.380 1.61e-06 1.95 86.39 89.3
isodiff --- 0.692 0.0217 2.12 676.40 6299.0 *
galdiff --- 1.145 0.143 0.03 7143.72 18803.3 *
{'name': 'SMC', 'file': None, 'config': {'spatial_model': 'RadialGaussian', 'width': [], 'fit_position': False, 'width_min': 0.01, 'width_max': 1.0, 'width_nstep': 21, 'free_background': False, 'fix_shape': False, 'free_radius': None, 'fit_ebin': False, 'update': True, 'save_model_map': False, 'sqrt_ts_threshold': 3.0, 'psf_scale_fn': None, 'make_tsmap': True, 'tsmap_fitter': 'tsmap', 'make_plots': True, 'write_fits': True, 'write_npy': True, 'reoptimize': False, 'optimizer': {'optimizer': 'MINUIT', 'tol': 0.001, 'max_iter': 100, 'init_lambda': 0.0001, 'retries': 3, 'min_fit_quality': 2, 'verbosity': 0}, 'prefix': '', 'outfile': None, 'loge_bins': []}, 'width': array([0. , 0.01 , 0.01258925, 0.01584893, 0.01995262,
0.02511886, 0.03162278, 0.03981072, 0.05011872, 0.06309573,
0.07943282, 0.1 , 0.12589254, 0.15848932, 0.19952623,
0.25118864, 0.31622777, 0.39810717, 0.50118723, 0.63095734,
0.79432823, 1. ]), 'dloglike': array([8.87445842e-03, 8.89452997e-02, 1.41156992e-01, 2.23932399e-01,
3.55122023e-01, 5.62931809e-01, 8.91949928e-01, 1.41254733e+00,
2.23503533e+00, 3.53109574e+00, 5.56481373e+00, 8.73004410e+00,
1.36037509e+01, 2.11754956e+01, 3.24697746e+01, 4.76795818e+01,
6.78030352e+01, 9.15188983e+01, 1.17996215e+02, 1.44955740e+02,
1.67622886e+02, 1.80764122e+02]), 'loglike': array([-74005.17861959, -74005.09854875, -74005.04633705, -74004.96356165,
-74004.83237202, -74004.62456224, -74004.29554412, -74003.77494671,
-74002.95245872, -74001.65639831, -73999.62268032, -73996.45744994,
-73991.58374314, -73984.01199847, -73972.71771942, -73957.50791225,
-73937.38445883, -73913.66859577, -73887.19127856, -73860.23175429,
-73837.56460786, -73824.42337211]), 'loglike_ptsrc': -74005.18749404605, 'loglike_ext': -73823.01773309303, 'loglike_init': -74004.95613240519, 'loglike_base': -74004.95613240465, 'ext': 1.0933767550850568, 'ext_err_hi': 0.0710919613227825, 'ext_err_lo': 0.06411071814020364, 'ext_err': 0.06760133973149307, 'ext_ul95': 1.2048203454000854, 'ts_ext': 363.9600503608235, 'ebin_e_min': array([], dtype=float64), 'ebin_e_ctr': array([], dtype=float64), 'ebin_e_max': array([], dtype=float64), 'ebin_ext': array([], dtype=float64), 'ebin_ext_err': array([], dtype=float64), 'ebin_ext_err_hi': array([], dtype=float64), 'ebin_ext_err_lo': array([], dtype=float64), 'ebin_ext_ul95': array([], dtype=float64), 'ebin_ts_ext': array([], dtype=float64), 'ebin_dloglike': array([], shape=(0, 22), dtype=float64), 'ebin_loglike': array([], shape=(0, 22), dtype=float64), 'ebin_loglike_ptsrc': array([], dtype=float64), 'ebin_loglike_ext': array([], dtype=float64), 'ra': 14.41286585005637, 'dec': -72.6822517991408, 'glon': 302.28438026157403, 'glat': -44.4381874357083, 'ra_err': nan, 'dec_err': nan, 'glon_err': nan, 'glat_err': nan, 'pos_offset': 0.0, 'pos_err': nan, 'pos_r68': nan, 'pos_r95': nan, 'pos_r99': nan, 'pos_err_semimajor': nan, 'pos_err_semiminor': nan, 'pos_angle': nan, 'tsmap': <gammapy.maps.wcs.ndmap.WcsNDMap object at 0x7fd4dba5fb50>, 'ptsrc_tot_map': None, 'ptsrc_src_map': None, 'ptsrc_bkg_map': None, 'ext_tot_map': None, 'ext_src_map': None, 'ext_bkg_map': None, 'source_fit': {'param_names': array([b'Prefactor', b'Index', b'Scale', b'', b'', b'', b'', b'', b'',
b''], dtype='|S32'), 'param_values': array([ 3.80310097e-12, -2.44934062e+00, 1.00000000e+03, nan,
nan, nan, nan, nan,
nan, nan]), 'param_errors': array([2.58631158e-13, 6.42353817e-02, nan, nan,
nan, nan, nan, nan,
nan, nan]), 'ts': 611.1870074401377, 'loglike': -73823.20746886564, 'loglike_scan': array([-74128.80097259, -73825.93130365, -73825.28359089, -73824.72600647,
-73824.25734506, -73823.87642726, -73823.5820988 , -73823.37322984,
-73823.24871424, -73823.20746887, -73823.2353798 , -73823.3186679 ,
-73823.45675837, -73823.64908602, -73823.89509503, -73824.19423877,
-73824.54597952, -73824.94978836, -73825.40514488, -73825.91153707]), 'dloglike_scan': array([-3.05593504e+02, -2.72383479e+00, -2.07612202e+00, -1.51853760e+00,
-1.04987620e+00, -6.68958393e-01, -3.74629934e-01, -1.65760976e-01,
-4.12453745e-02, 0.00000000e+00, -2.79109358e-02, -1.11199033e-01,
-2.49289502e-01, -4.41617152e-01, -6.87626168e-01, -9.86769902e-01,
-1.33851066e+00, -1.74231949e+00, -2.19767601e+00, -2.70406820e+00]), 'eflux_scan': array([0.00000000e+00, 7.04541486e-06, 7.15795007e-06, 7.27048529e-06,
7.38302050e-06, 7.49555571e-06, 7.60809092e-06, 7.72062613e-06,
7.83316135e-06, 7.94569656e-06, 8.03854505e-06, 8.13139354e-06,
8.22424203e-06, 8.31709052e-06, 8.40993901e-06, 8.50278750e-06,
8.59563599e-06, 8.68848448e-06, 8.78133297e-06, 8.87418146e-06]), 'flux_scan': array([0.00000000e+00, 2.32802797e-09, 2.36521317e-09, 2.40239836e-09,
2.43958355e-09, 2.47676875e-09, 2.51395394e-09, 2.55113914e-09,
2.58832433e-09, 2.62550953e-09, 2.65618960e-09, 2.68686968e-09,
2.71754976e-09, 2.74822984e-09, 2.77890992e-09, 2.80959000e-09,
2.84027008e-09, 2.87095016e-09, 2.90163024e-09, 2.93231031e-09]), 'norm_scan': array([ 0. , 33.72193228, 34.26056696, 34.79920165, 35.33783633,
35.87647101, 36.4151057 , 36.95374038, 37.49237506, 38.03100975,
38.47541658, 38.91982342, 39.36423025, 39.80863708, 40.25304392,
40.69745075, 41.14185759, 41.58626442, 42.03067126, 42.47507809]), 'npred': 1124.7379457335603, 'npred_wt': 1124.7379457335603, 'pivot_energy': 1000.0, 'flux': 2.6255095261727488e-09, 'flux100': 7.392778772434294e-08, 'flux1000': 2.6249493329170427e-09, 'flux10000': 9.26403746966029e-11, 'flux_err': 2.716925583330113e-10, 'flux100_err': 5.5614102710026396e-09, 'flux1000_err': 2.7157092122572687e-10, 'flux10000_err': 2.2465655471285004e-11, 'flux_ul95': 2.8420950210328774e-09, 'flux100_ul95': 8.002629406323704e-08, 'flux1000_ul95': 2.841488615896279e-09, 'flux10000_ul95': 1.0028253375094081e-10, 'eflux': 7.945696558110034e-06, 'eflux100': 2.318334329992341e-05, 'eflux1000': 7.827078112178487e-06, 'eflux10000': 2.370554362038278e-06, 'eflux_err': 1.3580936436354446e-06, 'eflux100_err': 1.3112180683286926e-06, 'eflux1000_err': 1.3075558659176449e-06, 'eflux10000_err': 6.692636136169798e-07, 'eflux_ul95': 8.601158899378055e-06, 'eflux100_ul95': 2.5095800989020282e-05, 'eflux1000_ul95': 8.47275529191671e-06, 'eflux10000_ul95': 2.5661079048750957e-06, 'dnde': 3.803100974718096e-12, 'dnde100': 1.0702333412104598e-09, 'dnde1000': 3.803100974718096e-12, 'dnde10000': 1.351441453650012e-14, 'dnde_err': 2.5863115756258356e-13, 'dnde100_err': 1.2048949629145216e-10, 'dnde1000_err': 2.5863115756258356e-13, 'dnde10000_err': 2.7139373718956286e-15, 'dnde_index': 2.4493406201568346, 'dnde100_index': 2.4493406201679364, 'dnde1000_index': 2.4493406201568346, 'dnde10000_index': 2.449340620145733, 'name': 'SMC', 'spectral_pars': {'Prefactor': {'name': 'Prefactor', 'value': 38.03100974718095, 'error': 2.586311575625835, 'min': 0.0001, 'max': 10000.0, 'free': True, 'scale': 1.0000000000000003e-13}, 'Index': {'name': 'Index', 'value': -2.449340620163031, 'error': 0.06423538174658115, 'min': -5.0, 'max': -1.0, 'free': True, 'scale': 1.0}, 'Scale': {'name': 'Scale', 'value': 1000.0, 'error': nan, 'min': 1.0, 'max': 100000.0, 'free': False, 'scale': 1.0}}, 'model_counts': array([3.60736175e+02, 2.51377012e+02, 1.71416364e+02, 1.14957581e+02,
7.60212719e+01, 4.99730528e+01, 3.30563847e+01, 2.21233675e+01,
1.47984598e+01, 9.91629261e+00, 6.67012401e+00, 4.51888320e+00,
3.08484466e+00, 2.08925595e+00, 1.39755005e+00, 9.29826496e-01,
6.16140814e-01, 4.07840511e-01, 2.70356112e-01, 1.79516079e-01,
1.19079153e-01, 7.85676245e-02]), 'model_counts_wt': array([3.60736175e+02, 2.51377012e+02, 1.71416364e+02, 1.14957581e+02,
7.60212719e+01, 4.99730528e+01, 3.30563847e+01, 2.21233675e+01,
1.47984598e+01, 9.91629261e+00, 6.67012401e+00, 4.51888320e+00,
3.08484466e+00, 2.08925595e+00, 1.39755005e+00, 9.29826496e-01,
6.16140814e-01, 4.07840511e-01, 2.70356112e-01, 1.79516079e-01,
1.19079153e-01, 7.85676245e-02]), 'covar': array([[6.68900757e+00, 1.14183992e-01],
[1.14183992e-01, 4.12618427e-03]]), 'model_flux': {'energies': array([ 1000. , 1135.22257894, 1288.73030373, 1462.99573896,
1660.82579576, 1885.40694302, 2140.35653221, 2429.78106234,
2758.34232385, 3131.33248647, 3554.7593408 , 4035.44306637,
4581.12608497, 5200.59776862, 5903.83601091, 6702.16794193,
7608.45237552, 8637.28692746, 9805.24314083, 11131.13340544,
12636.31397103, 14345.02893447, 16284.80074193, 18486.87349575,
20986.71620635, 23824.59409522, 27046.21715093, 30703.47638461,
34855.2796437 , 39568.50044674, 44919.05512187, 50993.12559891,
57888.54755052, 65716.38624129, 74602.72546734, 84690.69840085,
96142.7930507 , 109143.46947334, 123902.13088979, 140656.49656465,
159676.43077454, 181268.28953953, 205779.85513079, 233605.93783511,
265194.73520446, 301055.05121965, 341764.49164796, 387978.76759812,
440442.25712601, 499999.99500797]), 'log_energies': array([3. , 3.05508102, 3.11016204, 3.16524306, 3.22032408,
3.2754051 , 3.33048612, 3.38556714, 3.44064816, 3.49572918,
3.5508102 , 3.60589122, 3.66097224, 3.71605327, 3.77113429,
3.82621531, 3.88129633, 3.93637735, 3.99145837, 4.04653939,
4.10162041, 4.15670143, 4.21178245, 4.26686347, 4.32194449,
4.37702551, 4.43210653, 4.48718755, 4.54226857, 4.59734959,
4.65243061, 4.70751163, 4.76259265, 4.81767367, 4.87275469,
4.92783571, 4.98291673, 5.03799776, 5.09307878, 5.1481598 ,
5.20324082, 5.25832184, 5.31340286, 5.36848388, 5.4235649 ,
5.47864592, 5.53372694, 5.58880796, 5.64388898, 5.69897 ]), 'dnde': array([3.80310097e-12, 2.78756932e-12, 2.04321230e-12, 1.49761891e-12,
1.09771382e-12, 8.04594303e-13, 5.89745685e-13, 4.32267507e-13,
3.16840296e-13, 2.32235298e-13, 1.70222141e-13, 1.24768188e-13,
9.14516800e-14, 6.70315879e-14, 4.91323262e-14, 3.60126555e-14,
2.63962945e-14, 1.93477642e-14, 1.41813836e-14, 1.03945675e-14,
7.61893455e-15, 5.58447128e-15, 4.09326518e-15, 3.00025177e-15,
2.19910274e-15, 1.61188235e-15, 1.18146581e-15, 8.65982225e-16,
6.34741359e-16, 4.65248109e-16, 3.41014178e-16, 2.49954094e-16,
1.83209536e-16, 1.34287594e-16, 9.84291451e-17, 7.21458795e-17,
5.28809626e-17, 3.87603037e-17, 2.84102457e-17, 2.08239355e-17,
1.52633769e-17, 1.11876391e-17, 8.20023442e-18, 6.01054824e-18,
4.40556797e-18, 3.22916120e-18, 2.36688711e-18, 1.73486372e-18,
1.27160780e-18, 9.32053846e-19]), 'dnde_lo': array([3.56093818e-12, 2.59588346e-12, 1.89171694e-12, 1.37820839e-12,
1.00389898e-12, 7.31144587e-13, 5.32440655e-13, 3.87709572e-13,
2.82305282e-13, 2.05549426e-13, 1.49659502e-13, 1.08965195e-13,
7.93360446e-14, 5.77637699e-14, 4.20576670e-14, 3.06225566e-14,
2.22969738e-14, 1.62352845e-14, 1.18218227e-14, 8.60835948e-15,
6.26856981e-15, 4.56487855e-15, 3.32432243e-15, 2.42097651e-15,
1.76316043e-15, 1.28412453e-15, 9.35269319e-16, 6.81209359e-16,
4.96179702e-16, 3.61419780e-16, 2.63268813e-16, 1.91779199e-16,
1.39707002e-16, 1.01776944e-16, 7.41472695e-17, 5.40201015e-17,
3.93577302e-17, 2.86760309e-17, 2.08940343e-17, 1.52243848e-17,
1.10935692e-17, 8.08382384e-18, 5.89082727e-18, 4.29288778e-18,
3.12850231e-18, 2.28001136e-18, 1.66169389e-18, 1.21109553e-18,
8.82712018e-19, 6.43387799e-19]), 'dnde_hi': array([4.06173213e-12, 2.99340968e-12, 2.20683995e-12, 1.62737538e-12,
1.20029571e-12, 8.85422669e-13, 6.53218288e-13, 4.81946311e-13,
3.55600054e-13, 2.62385717e-13, 1.93610008e-13, 1.42863056e-13,
1.05417529e-13, 7.77863665e-14, 5.73970373e-14, 4.23515048e-14,
3.12492794e-14, 2.30569398e-14, 1.70118979e-14, 1.25514081e-14,
9.26019258e-15, 6.83179610e-15, 5.04007063e-15, 3.71813219e-15,
2.74283201e-15, 2.02329653e-15, 1.49247007e-15, 1.10087333e-15,
8.11997329e-16, 5.98904141e-16, 4.41718366e-16, 3.25775942e-16,
2.40258066e-16, 1.77183135e-16, 1.30662891e-16, 9.63535386e-17,
7.10507487e-17, 5.23908328e-17, 3.86302641e-17, 2.84830090e-17,
2.10005158e-17, 1.54831762e-17, 1.14150087e-17, 8.41547507e-18,
6.20393634e-18, 4.57343425e-18, 3.37135175e-18, 2.48514839e-18,
1.83183911e-18, 1.35023445e-18]), 'dnde_err': array([2.58631158e-13, 2.05840367e-13, 1.63627648e-13, 1.29756469e-13,
1.02581881e-13, 8.08283662e-14, 6.34726026e-14, 4.96788035e-14,
3.87597577e-14, 3.01504192e-14, 2.33878670e-14, 1.80948677e-14,
1.39658489e-14, 1.07547786e-14, 8.26471108e-15, 6.33884933e-15,
4.85298486e-15, 3.70917563e-15, 2.83051430e-15, 2.15684065e-15,
1.64125803e-15, 1.24732482e-15, 9.46805450e-16, 7.17880418e-16,
5.43729264e-16, 4.11414182e-16, 3.11004254e-16, 2.34891103e-16,
1.77255971e-16, 1.33656032e-16, 1.00704188e-16, 7.58218473e-17,
5.70485301e-17, 4.28955411e-17, 3.22337461e-17, 2.42076591e-17,
1.81697861e-17, 1.36305292e-17, 1.02200184e-17, 7.65907352e-18,
5.73713888e-18, 4.29553707e-18, 3.21477428e-18, 2.40492683e-18,
1.79836837e-18, 1.34427305e-18, 1.00446464e-18, 7.50284673e-19,
5.60231311e-19, 4.18180606e-19]), 'dnde_ferr': array([0.06584021, 0.07130338, 0.0771146 , 0.08318771, 0.08945716,
0.09587321, 0.10239806, 0.1090028 , 0.11566517, 0.1223679 ,
0.1290975 , 0.13584336, 0.14259708, 0.14935195, 0.15610263,
0.16284481, 0.16957504, 0.17629053, 0.18298903, 0.18966872,
0.19632816, 0.20296617, 0.20958185, 0.21617447, 0.22274347,
0.22928845, 0.23580909, 0.24230519, 0.24877663, 0.25522335,
0.26164536, 0.2680427 , 0.27441548, 0.2807638 , 0.28708784,
0.29338777, 0.29966378, 0.3059161 , 0.31214496, 0.31835059,
0.32453325, 0.3306932 , 0.3368307 , 0.34294603, 0.34903945,
0.35511124, 0.36116168, 0.36719105, 0.37319962, 0.37918767]), 'pivot_energy': 1000.0}}}
In this specific case SMC is found to be extended with TSext=371 and with an angular extension of 1.19:nbsphinx-math:`pm`0.07deg.
[38]:
print(extensionsmc['ext'])
print(extensionsmc['ext_err_hi'])
print(extensionsmc['ext_err_lo'])
print(extensionsmc['ext_err'])
print(extensionsmc['ext'])
print(extensionsmc['ext_ul95'])
print(extensionsmc['ts_ext'])
1.0933767550850568
0.0710919613227825
0.06411071814020364
0.06760133973149307
1.0933767550850568
1.2048203454000854
363.9600503608235
Source Finding
find_sources() is an iterative source-finding algorithm that uses peak detection on a TS map to find new source candidates. The procedure for adding new sources at each iteration is as follows:
Generate a TS map for the test source model defined with the model argument.
Identify peaks with sqrt(TS) > sqrt_ts_threshold and an angular distance of at least min_separation from a higher amplitude peak in the map.
Order the peaks by TS and add a source at each peak starting from the highest TS peak. Set the source position by fitting a 2D parabola to the log-likelihood surface around the peak maximum. After adding each source, re-fit its spectral parameters.
Add sources at the N highest peaks up to N = sources_per_iter.
Source finding is repeated up to max_iter iterations or until no peaks are found in a given iteration. Sources found by the method are added to the model and given designations PS JXXXX.X+XXXX according to their position in celestial coordinates.
This may take a few minutes.
[39]:
gta.free_sources()
model = {'Index' : 2.0, 'SpatialModel' : 'PointSource'}
findsource26 = gta.find_sources(model=model,sqrt_ts_threshold=5,min_separation=0.2,tsmap_fitter='tsmap')
2024-12-19 20:24:18 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index']
2024-12-19 20:24:18 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index']
2024-12-19 20:24:18 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index']
2024-12-19 20:24:18 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index']
2024-12-19 20:24:18 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index']
2024-12-19 20:24:18 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index']
2024-12-19 20:24:18 INFO GTAnalysis.find_sources(): Starting.
2024-12-19 20:24:18 INFO GTAnalysis.tsmap(): Generating TS map
2024-12-19 20:24:18 INFO GTAnalysis._make_tsmap_fast(): Fitting test source.
2024-12-19 20:24:26 INFO GTAnalysis.tsmap(): Finished TS map
2024-12-19 20:24:32 WARNING GTAnalysis.tsmap(): Saving TS maps in .npy files is disabled b/c of incompatibilities in python3, remove the maps from the /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/sourcefind_00_pointsource_powerlaw_2.00_tsmap.npy
2024-12-19 20:24:32 INFO GTAnalysis.tsmap(): Execution time: 14.51 s
2024-12-19 20:24:32 INFO GTAnalysis._build_src_dicts_from_peaks(): Found source
name: PS J0040.7-7158
ts: 46.845299
2024-12-19 20:24:32 INFO GTAnalysis._build_src_dicts_from_peaks(): Found source
name: PS J0000.6-7354
ts: 46.104512
2024-12-19 20:24:32 INFO GTAnalysis._build_src_dicts_from_peaks(): Found source
name: PS J0102.8-7052
ts: 29.406879
2024-12-19 20:24:32 INFO GTAnalysis.add_source(): Adding source PS J0040.7-7158
2024-12-19 20:24:33 INFO GTAnalysis.free_source(): Fixing parameters for PS J0040.7-7158 : ['Prefactor']
2024-12-19 20:24:33 INFO GTAnalysis.add_source(): Adding source PS J0000.6-7354
2024-12-19 20:24:34 INFO GTAnalysis.free_source(): Fixing parameters for PS J0000.6-7354 : ['Prefactor']
2024-12-19 20:24:34 INFO GTAnalysis.add_source(): Adding source PS J0102.8-7052
2024-12-19 20:24:35 INFO GTAnalysis.free_source(): Fixing parameters for PS J0102.8-7052 : ['Prefactor']
2024-12-19 20:24:35 INFO GTAnalysis._find_sources_iterate(): Performing spectral fit for PS J0040.7-7158.
2024-12-19 20:24:35 INFO GTAnalysis.free_source(): Freeing parameters for PS J0040.7-7158 : ['Prefactor', 'Index']
2024-12-19 20:24:35 INFO GTAnalysis.fit(): Starting fit.
/home/runner/miniconda3/envs/fermipy/lib/python3.9/site-packages/scipy/interpolate/_fitpack2.py:313: UserWarning:
The maximal number of iterations maxit (set to 20 by the program)
allowed for finding a smoothing spline with fp=s has been reached: s
too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.
warnings.warn(message)
2024-12-19 20:24:39 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0
2024-12-19 20:24:39 INFO GTAnalysis.fit(): LogLike: -73739.790 DeltaLogLike: 20.272
2024-12-19 20:24:39 INFO GTAnalysis._find_sources_iterate(): {'Index': {'error': 0.18304093782478006, 'value': -2.2299213773351614},
'Prefactor': {'error': 7.406011069471449e-14, 'value': 2.5440955727876956e-13},
'Scale': {'error': nan, 'value': 1000.0}}
2024-12-19 20:24:39 INFO GTAnalysis.free_source(): Fixing parameters for PS J0040.7-7158 : ['Prefactor', 'Index']
2024-12-19 20:24:39 INFO GTAnalysis._find_sources_iterate(): Performing spectral fit for PS J0000.6-7354.
2024-12-19 20:24:39 INFO GTAnalysis.free_source(): Freeing parameters for PS J0000.6-7354 : ['Prefactor', 'Index']
2024-12-19 20:24:39 INFO GTAnalysis.fit(): Starting fit.
2024-12-19 20:24:43 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0
2024-12-19 20:24:43 INFO GTAnalysis.fit(): LogLike: -73739.249 DeltaLogLike: 0.541
2024-12-19 20:24:43 INFO GTAnalysis._find_sources_iterate(): {'Index': {'error': 0.1858441040956374, 'value': -2.176241356373905},
'Prefactor': {'error': 6.303342684672173e-14, 'value': 1.9932066851208575e-13},
'Scale': {'error': nan, 'value': 1000.0}}
2024-12-19 20:24:43 INFO GTAnalysis.free_source(): Fixing parameters for PS J0000.6-7354 : ['Prefactor', 'Index']
2024-12-19 20:24:43 INFO GTAnalysis._find_sources_iterate(): Performing spectral fit for PS J0102.8-7052.
2024-12-19 20:24:43 INFO GTAnalysis.free_source(): Freeing parameters for PS J0102.8-7052 : ['Prefactor', 'Index']
2024-12-19 20:24:43 INFO GTAnalysis.fit(): Starting fit.
2024-12-19 20:24:47 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0
2024-12-19 20:24:47 INFO GTAnalysis.fit(): LogLike: -73733.983 DeltaLogLike: 5.265
2024-12-19 20:24:47 INFO GTAnalysis._find_sources_iterate(): {'Index': {'error': 0.25607249839555624, 'value': -2.734897844544784},
'Prefactor': {'error': 9.882191571214541e-14, 'value': 3.730890368782016e-13},
'Scale': {'error': nan, 'value': 1000.0}}
2024-12-19 20:24:47 INFO GTAnalysis.free_source(): Fixing parameters for PS J0102.8-7052 : ['Prefactor', 'Index']
2024-12-19 20:24:47 INFO GTAnalysis.find_sources(): Found 3 sources in iteration 0.
2024-12-19 20:24:47 INFO GTAnalysis.tsmap(): Generating TS map
2024-12-19 20:24:47 INFO GTAnalysis._make_tsmap_fast(): Fitting test source.
2024-12-19 20:24:55 INFO GTAnalysis.tsmap(): Finished TS map
2024-12-19 20:25:01 WARNING GTAnalysis.tsmap(): Saving TS maps in .npy files is disabled b/c of incompatibilities in python3, remove the maps from the /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/sourcefind_01_pointsource_powerlaw_2.00_tsmap.npy
2024-12-19 20:25:01 INFO GTAnalysis.tsmap(): Execution time: 14.57 s
2024-12-19 20:25:01 INFO GTAnalysis.find_sources(): Found 0 sources in iteration 1.
2024-12-19 20:25:01 INFO GTAnalysis.find_sources(): Done.
2024-12-19 20:25:01 INFO GTAnalysis.find_sources(): Execution time: 43.44 s
[40]:
gta.print_model()
gta.write_roi('SMC_relext_TS25',make_plots=True,save_model_map=True)
2024-12-19 20:25:01 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.072 37.938 8.16e-06 2.43 589.10 1133.7 *
PS J0040.7-7158 1.523 2.544 8.41e-07 2.23 53.63 88.5
PS J0102.8-7052 1.918 3.731 5.02e-07 2.73 44.61 91.8
3FGL J0112.9-7506 2.572 1.188 2.16e-06 1.97 151.36 134.2 *
3FGL J0023.9-7203 2.662 0.591 9.78e-06 2.70 5225.69 1795.0 *
3FGL J0029.1-7045 3.008 0.458 2.08e-06 2.33 271.03 239.3 *
PS J0000.6-7354 4.262 1.993 7.53e-07 2.18 53.96 72.2
3FGL J0021.6-6835 5.122 2.628 2.57e-07 3.29 16.48 57.2 *
3FGL J2351.9-7601 5.495 1.400 2.85e-06 2.01 242.69 191.2 *
3FGL J2338.7-7401 5.777 0.591 2.92e-06 2.01 292.25 185.0 *
3FGL J0146.4-6746 6.423 0.665 1.76e-06 2.35 257.03 201.9 *
3FGL J2336.5-7620 6.454 0.389 1.28e-06 2.29 112.51 135.3 *
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.41 95.5 *
isodiff --- 0.673 0.0211 2.12 697.36 6126.1 *
galdiff --- 1.100 0.135 0.05 7280.08 17908.1 *
2024-12-19 20:25:01 INFO GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/SMC_relext_TS25_00.xml...
2024-12-19 20:25:01 INFO GTAnalysis.write_fits(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/SMC_relext_TS25.fits...
WARNING: Format %s cannot be mapped to the accepted TDISPn keyword values. Format will not be moved into TDISPn keyword. [astropy.io.fits.column]
WARNING: Format %f cannot be mapped to the accepted TDISPn keyword values. Format will not be moved into TDISPn keyword. [astropy.io.fits.column]
WARNING: Format %s cannot be mapped to the accepted TDISPn keyword values. Format will not be moved into TDISPn keyword. [astropy.io.fits.column]
2024-12-19 20:25:07 INFO GTBinnedAnalysis.write_model_map(): Generating model map for component 00.
2024-12-19 20:25:09 INFO GTAnalysis.write_roi(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/SMC_relext_TS25.npy...
[41]:
tsmap_relext = gta.tsmap(prefix='TSmap_relext_TS25',make_plots=True,write_fits=True,write_npy=True)
2024-12-19 20:25:11 INFO GTAnalysis.tsmap(): Generating TS map
2024-12-19 20:25:12 INFO GTAnalysis._make_tsmap_fast(): Fitting test source.
2024-12-19 20:25:21 INFO GTAnalysis.tsmap(): Finished TS map
2024-12-19 20:25:26 WARNING GTAnalysis.tsmap(): Saving TS maps in .npy files is disabled b/c of incompatibilities in python3, remove the maps from the /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/TSmap_relext_TS25_pointsource_powerlaw_2.00_tsmap.npy
2024-12-19 20:25:26 INFO GTAnalysis.tsmap(): Execution time: 15.45 s
[42]:
plt.clf()
fig = plt.figure(figsize=(14,6))
ROIPlotter(tsmap_relext['sqrt_ts'],roi=gta.roi).plot(levels=[0,3,5,7],vmin=0,vmax=6,subplot=121,cmap='magma')
plt.gca().set_title('Sqrt(TS)')
ROIPlotter(tsmap_relext['npred'],roi=gta.roi).plot(vmin=0,vmax=100,subplot=122,cmap='magma')
plt.gca().set_title('NPred')
plt.show()
<Figure size 800x600 with 0 Axes>
[43]:
resid_relext = gta.residmap('TSmap_relext_TS26',model={'SpatialModel' : 'PointSource', 'Index' : 2.0},write_fits=True,write_npy=True,make_plots=True)
2024-12-19 20:25:27 INFO GTAnalysis.residmap(): Generating residual maps
2024-12-19 20:25:27 INFO GTAnalysis.add_source(): Adding source residmap_testsource
2024-12-19 20:25:28 INFO GTAnalysis.delete_source(): Deleting source residmap_testsource
2024-12-19 20:25:30 INFO GTAnalysis.residmap(): Finished residual maps
2024-12-19 20:25:34 WARNING GTAnalysis.residmap(): Saving maps in .npy files is disabled b/c of incompatibilities in python3, remove the maps from the /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/TSmap_relext_TS26_pointsource_powerlaw_2.00_residmap.npy
2024-12-19 20:25:34 INFO GTAnalysis.residmap(): Execution time: 7.16 s
[44]:
plt.clf()
fig = plt.figure(figsize=(14,6))
ROIPlotter(resid_relext['data'],roi=gta.roi).plot(vmin=50,vmax=400,subplot=121,cmap='magma')
plt.gca().set_title('Data')
ROIPlotter(resid_relext['model'],roi=gta.roi).plot(vmin=50,vmax=400,subplot=122,cmap='magma')
plt.gca().set_title('Model')
plt.show()
<Figure size 640x480 with 0 Axes>
[45]:
plt.clf()
fig = plt.figure(figsize=(14,6))
ROIPlotter(resid_relext['sigma'],roi=gta.roi).plot(vmin=-5,vmax=5,levels=[-5,-3,3,5],subplot=121,cmap='RdBu_r')
plt.gca().set_title('Significance')
ROIPlotter(resid_relext['excess'],roi=gta.roi).plot(vmin=-100,vmax=100,subplot=122,cmap='RdBu_r')
plt.gca().set_title('Excess')
plt.show()
<Figure size 640x480 with 0 Axes>
Sed Analysis
The sed() method computes a spectral energy distribution (SED) by performing independent fits for the flux normalization of a source in bins of energy. The normalization in each bin is fit using a power-law spectral parameterization with a fixed index. The value of this index can be set with the bin_index parameter or allowed to vary over the energy range according to the local slope of the global spectral model (with the use_local_index parameter).
The free_background, free_radius, and cov_scale parameters control how nuisance parameters are dealt with in the fit. By default the method will fix the parameters of background components ROI when fitting the source normalization in each energy bin (free_background=False). Setting free_background=True will profile the normalizations of all background components that were free when the method was executed. In order to minimize overfitting, background normalization parameters are constrained with priors taken from the global fit. The strength of the priors is controlled with the cov_scale parameter. A larger (smaller) value of cov_scale applies a weaker (stronger) constraint on the background amplitude. Setting cov_scale=None performs an unconstrained fit without priors.
[46]:
gta.free_sources(free=False)
gta.print_model()
gta.free_sources(skydir=gta.roi[gta.roi.sources[0].name].skydir,distance=[3.0],free=True)
gta.print_model()
sedsmc = gta.sed(gta.roi.sources[0].name, bin_index=2.2, outfile='sedSMC.fits', loge_bins=None,write_npy=True,write_fits=True,make_plots=True)
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for isodiff : ['Normalization']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.072 37.938 8.16e-06 2.43 589.10 1133.7
PS J0040.7-7158 1.523 2.544 8.41e-07 2.23 53.63 88.5
PS J0102.8-7052 1.918 3.731 5.02e-07 2.73 44.61 91.8
3FGL J0112.9-7506 2.572 1.188 2.16e-06 1.97 151.36 134.2
3FGL J0023.9-7203 2.662 0.591 9.78e-06 2.70 5225.69 1795.0
3FGL J0029.1-7045 3.008 0.458 2.08e-06 2.33 271.03 239.3
PS J0000.6-7354 4.262 1.993 7.53e-07 2.18 53.96 72.2
3FGL J0021.6-6835 5.122 2.628 2.57e-07 3.29 16.48 57.2
3FGL J2351.9-7601 5.495 1.400 2.85e-06 2.01 242.69 191.2
3FGL J2338.7-7401 5.777 0.591 2.92e-06 2.01 292.25 185.0
3FGL J0146.4-6746 6.423 0.665 1.76e-06 2.35 257.03 201.9
3FGL J2336.5-7620 6.454 0.389 1.28e-06 2.29 112.51 135.3
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.41 95.5
isodiff --- 0.673 0.0211 2.12 697.36 6126.1
galdiff --- 1.100 0.135 0.05 7280.08 17908.1
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Freeing parameters for PS J0040.7-7158 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Freeing parameters for PS J0102.8-7052 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index']
2024-12-19 20:25:36 INFO GTAnalysis.print_model():
sourcename offset norm eflux index ts npred free
--------------------------------------------------------------------------------
SMC 0.072 37.938 8.16e-06 2.43 589.10 1133.7 *
PS J0040.7-7158 1.523 2.544 8.41e-07 2.23 53.63 88.5 *
PS J0102.8-7052 1.918 3.731 5.02e-07 2.73 44.61 91.8 *
3FGL J0112.9-7506 2.572 1.188 2.16e-06 1.97 151.36 134.2 *
3FGL J0023.9-7203 2.662 0.591 9.78e-06 2.70 5225.69 1795.0 *
3FGL J0029.1-7045 3.008 0.458 2.08e-06 2.33 271.03 239.3 *
PS J0000.6-7354 4.262 1.993 7.53e-07 2.18 53.96 72.2
3FGL J0021.6-6835 5.122 2.628 2.57e-07 3.29 16.48 57.2
3FGL J2351.9-7601 5.495 1.400 2.85e-06 2.01 242.69 191.2
3FGL J2338.7-7401 5.777 0.591 2.92e-06 2.01 292.25 185.0
3FGL J0146.4-6746 6.423 0.665 1.76e-06 2.35 257.03 201.9
3FGL J2336.5-7620 6.454 0.389 1.28e-06 2.29 112.51 135.3
3FGL J0002.0-6722 7.153 0.409 1.63e-06 1.98 94.41 95.5
isodiff --- 0.673 0.0211 2.12 697.36 6126.1 *
galdiff --- 1.100 0.135 0.05 7280.08 17908.1 *
2024-12-19 20:25:36 INFO GTAnalysis.sed(): Computing SED for SMC
2024-12-19 20:25:36 INFO GTAnalysis._make_sed(): Fitting SED
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for PS J0040.7-7158 : ['Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for PS J0102.8-7052 : ['Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['alpha', 'beta']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045 : ['Index']
2024-12-19 20:25:36 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Index']
2024-12-19 20:25:37 INFO GTAnalysis.sed(): Finished SED
2024-12-19 20:25:43 INFO GTAnalysis.sed(): Execution time: 6.80 s
[47]:
print(sedsmc['e_min'])
print(sedsmc['e_max'])
print(sedsmc['e_ref'])
print(sedsmc['flux'])
print(sedsmc['eflux'])
print(sedsmc['e2dnde'])
print(sedsmc['dnde_ul95'])
print(sedsmc['ts'])
[ 1000. 1326.41675759 1759.38141482 2333.67299161
3095.42296281 4105.8208897 5446.02963176 7223.70496591
9581.64331867 12709.25226315 16857.76517829 22360.93710169
29659.92168712 39341.41715463 52183.11498128 69216.55817447
91810.00266538 121778.32604983 161528.81238386 214254.52357972
284190.7904658 376955.42682685]
[ 1326.41675759 1759.38141482 2333.67299161 3095.42296281
4105.8208897 5446.02963176 7223.70496591 9581.64331867
12709.25226315 16857.76517829 22360.93710169 29659.92168712
39341.41715463 52183.11498128 69216.55817447 91810.00266538
121778.32604983 161528.81238386 214254.52357972 284190.7904658
376955.42682685 499999.99500797]
[ 1151.70167908 1527.63640687 2026.28252958 2687.69510285
3565.00382372 4728.68081266 6272.20147121 8319.5531384
11035.19469844 14637.26717129 19415.33998741 25753.12880578
34159.38160838 45309.5761943 60099.38114346 79716.82626953
105737.73422587 140252.30258689 186033.00444196 246757.2945568
327303.01055795 434140.19801402]
[7.87353243e-10 6.25439407e-10 3.88233117e-10 2.83188157e-10
1.73240690e-10 1.58400536e-10 9.26656142e-11 5.24741227e-11
3.82015047e-11 3.44187595e-11 1.86529375e-14 9.45189894e-12
6.85955693e-18 4.58470944e-18 2.25162052e-13 3.03946406e-12
1.35471767e-18 3.83085981e-12 2.26440901e-16 4.02467489e-19
3.95276163e-18 1.79609334e-19]
[9.02588228e-07 9.51010442e-07 7.83019583e-07 7.57591566e-07
6.14737842e-07 7.45549856e-07 5.78520367e-07 4.34535468e-07
4.19604863e-07 5.01458800e-07 3.60472344e-10 2.42286443e-07
2.33230911e-13 2.06767302e-13 1.34693067e-08 2.41172096e-07
1.42580075e-13 5.34793726e-07 4.19300053e-11 9.88509501e-14
1.28774736e-12 7.76137999e-14]
[3.19479091e-06 3.36618563e-06 2.77156711e-06 2.68156240e-06
2.17591900e-06 2.63893970e-06 2.04772404e-06 1.53807675e-06
1.48522855e-06 1.77495780e-06 1.27581974e-09 8.57594308e-07
8.25541451e-13 7.31871165e-13 4.76758031e-08 8.53649976e-07
5.04674795e-13 1.89294972e-06 1.48414965e-10 3.49891686e-13
4.55809576e-12 2.74720914e-13]
[2.80875308e-12 1.68625253e-12 8.19352686e-13 4.58372162e-13
2.24254513e-13 1.52454435e-13 7.28157606e-14 3.48634265e-14
2.07670255e-14 1.36923575e-14 2.17807765e-15 3.48225994e-15
5.20850469e-16 3.35547663e-16 3.70446661e-16 4.78839325e-16
1.00894645e-16 2.77583069e-16 9.91581999e-17 4.30892598e-17
3.86617839e-17 2.47867775e-17]
[1.42109227e+02 1.50590702e+02 9.55060260e+01 8.39253058e+01
4.87697225e+01 5.80943557e+01 3.20404488e+01 1.54978643e+01
1.00251295e+01 1.20056160e+01 0.00000000e+00 1.71922559e+00
0.00000000e+00 0.00000000e+00 2.45887836e-03 1.50896803e+00
0.00000000e+00 3.92673490e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00]
[48]:
# E^2 x Differential flux ULs in each bin in units of MeV cm^{-2} s^{-1}
print(sedsmc['e2dnde_ul95'])
e2dnde_scan = sedsmc['norm_scan']*sedsmc['ref_e2dnde'][:,None]
plt.clf()
plt.figure()
plt.plot(e2dnde_scan[0],sedsmc['dloglike_scan'][0]-np.max(sedsmc['dloglike_scan'][0]))
plt.gca().set_ylim(-5,1)
plt.gca().axvline(sedsmc['e2dnde_ul95'][0],color='k')
plt.gca().axhline(-2.71/2.,color='r')
plt.show()
[3.72557716e-06 3.93516199e-06 3.36411537e-06 3.31114526e-06
2.85010717e-06 3.40894553e-06 2.86460925e-06 2.41307082e-06
2.52891537e-06 2.93358199e-06 8.21038192e-07 2.30951712e-06
6.07761324e-07 6.88865157e-07 1.33802949e-06 3.04291492e-06
1.12804939e-06 5.46025560e-06 3.43169462e-06 2.62366894e-06
4.14173100e-06 4.67175510e-06]
<Figure size 640x480 with 0 Axes>
[49]:
plt.clf()
fig = plt.figure(figsize=(14,4))
ylim=[1E-7,1E-5]
fig.add_subplot(121)
SEDPlotter(sedsmc).plot()
plt.gca().set_ylim(ylim)
plt.show()
<Figure size 640x480 with 0 Axes>
[50]:
plt.clf()
fig = plt.figure(figsize=(14,4))
fig.add_subplot(121)
SEDPlotter(sedsmc).plot(showlnl=True,ylim=ylim)
plt.gca().set_ylim(ylim)
plt.show()
<Figure size 640x480 with 0 Axes>
Light curve
lightcurve() fits the charateristics of a source (flux, TS, etc.) in a sequence of time bins. This method uses the data selection and model of a baseline analysis (e.g. the full mission) and is therefore restricted to analyzing time bins that are encompassed by the time selection of the baseline analysis. In general when using this method it is recommended to use a baseline time selection of at least several years or more to ensure the best characterization of background sources in the ROI.
When fitting a time bin the method will initialize the model to the current parameters of the baseline analysis. The parameters to be refit in each time bin may be controlled with free_background, free_sources, free_radius, free_params, and shape_ts_threshold options.
By default the lightcurve method will run an end-to-end analysis in each time bin using the same processing steps as the baseline analysis. Depending on the data selection and ROI size each time bin may take 10-15 minutes to process. There are several options which can be used to reduce the lightcurve computation time. The multithread option splits the analysis of time bins across multiple cores.
The use_scaled_srcmap option generates an approximate source map for each time bin by scaling the source map of the baseline analysis by the relative exposure.
The lightcurve analysis requires the original spacecraft (SC) files. If you haven’t already, download them.
[51]:
from string import ascii_lowercase
[52]:
if not os.path.isfile('./../data/SMC_SC.tar.gz'):
for c in ascii_lowercase[:12]:
if not os.path.isfile('./../data/SMC_SC.tar.gz.parta'+c):
URL = 'https://raw.githubusercontent.com/fermiPy/fermipy-extras/master/data/SMC_SC.tar.gz.parta' + c
!curl -OL --output-dir ./../data/ {URL}
!cat ./../data/SMC_SC.tar.gz.part* >./../data/SMC_SC.tar.gz
!tar xzf ./../data/SMC_SC.tar.gz -C ./SMC_data/
Now find the lightcurve
[53]:
lc = gta.lightcurve('SMC', free_radius=3.0, nbins=8, multithread=True, nthread=8, use_scaled_srcmap=True)
2024-12-19 20:25:54 INFO GTAnalysis.lightcurve(): Computing Lightcurve for SMC
2024-12-19 20:25:59 INFO lightcurve_239557417_273737042 GTAnalysis._process_lc_bin(): Fitting time range 239557417 273737042
2024-12-19 20:25:59 INFO lightcurve_307916667_342096292 GTAnalysis._process_lc_bin(): Fitting time range 307916667 342096292
2024-12-19 20:25:59 INFO lightcurve_342096292_376275917 GTAnalysis._process_lc_bin(): Fitting time range 342096292 376275917
2024-12-19 20:25:59 INFO lightcurve_410455542_444635167 GTAnalysis._process_lc_bin(): Fitting time range 410455542 444635167
2024-12-19 20:25:59 INFO lightcurve_273737042_307916667 GTAnalysis._process_lc_bin(): Fitting time range 273737042 307916667
2024-12-19 20:25:59 INFO lightcurve_376275917_410455542 GTAnalysis._process_lc_bin(): Fitting time range 376275917 410455542
2024-12-19 20:25:59 INFO lightcurve_478814792_512994417 GTAnalysis._process_lc_bin(): Fitting time range 478814792 512994417
2024-12-19 20:25:59 INFO lightcurve_444635167_478814792 GTAnalysis._process_lc_bin(): Fitting time range 444635167 478814792
2024-12-19 20:26:00 INFO lightcurve_410455542_444635167 GTBinnedAnalysis._create_ltcube(): Generating local LT cube.
2024-12-19 20:26:00 INFO lightcurve_307916667_342096292 GTBinnedAnalysis._create_ltcube(): Generating local LT cube.
2024-12-19 20:26:00 INFO lightcurve_342096292_376275917 GTBinnedAnalysis._create_ltcube(): Generating local LT cube.
2024-12-19 20:26:00 INFO lightcurve_376275917_410455542 GTBinnedAnalysis._create_ltcube(): Generating local LT cube.
2024-12-19 20:26:00 INFO lightcurve_239557417_273737042 GTBinnedAnalysis._create_ltcube(): Generating local LT cube.
2024-12-19 20:26:00 INFO lightcurve_273737042_307916667 GTBinnedAnalysis._create_ltcube(): Generating local LT cube.
2024-12-19 20:26:00 INFO lightcurve_478814792_512994417 GTBinnedAnalysis._create_ltcube(): Generating local LT cube.
2024-12-19 20:26:00 INFO lightcurve_444635167_478814792 GTBinnedAnalysis._create_ltcube(): Generating local LT cube.
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]WARNING
: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]WARNING
: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]WARNING
: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNING
: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNINGWARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Set DATEREF to '2001-01-01T00:01:04.184' from MJDREF.
Set MJD-OBS to 54682.655283 from DATE-OBS.
Set MJD-END to 57847.435324 from DATE-END'. [astropy.wcs.wcs]
2024-12-19 20:27:24 INFO lightcurve_410455542_444635167 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_410455542_444635167/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045']
2024-12-19 20:27:24 INFO lightcurve_478814792_512994417 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_478814792_512994417/base_00.xml...
Joint fit
2024-12-19 20:27:24 INFO lightcurve_307916667_342096292 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_307916667_342096292/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045']
/home/runner/miniconda3/envs/fermipy/lib/python3.9/site-packages/scipy/interpolate/_fitpack2.py:313: UserWarning:
The maximal number of iterations maxit (set to 20 by the program)
allowed for finding a smoothing spline with fp=s has been reached: s
too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.
warnings.warn(message)
['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045']
2024-12-19 20:27:24 INFO lightcurve_376275917_410455542 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_376275917_410455542/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045']
2024-12-19 20:27:24 INFO lightcurve_273737042_307916667 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_273737042_307916667/base_00.xml...
2024-12-19 20:27:24 INFO lightcurve_444635167_478814792 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_444635167_478814792/base_00.xml...
Joint fit Joint fit
2024-12-19 20:27:24 INFO lightcurve_342096292_376275917 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_342096292_376275917/base_00.xml...
/home/runner/miniconda3/envs/fermipy/lib/python3.9/site-packages/scipy/interpolate/_fitpack2.py:313: UserWarning:
The maximal number of iterations maxit (set to 20 by the program)
allowed for finding a smoothing spline with fp=s has been reached: s
too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.
warnings.warn(message)
['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045']['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045']Joint fit
['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045']
2024-12-19 20:27:25 INFO lightcurve_239557417_273737042 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_239557417_273737042/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045']
/home/runner/miniconda3/envs/fermipy/lib/python3.9/site-packages/scipy/interpolate/_fitpack2.py:313: UserWarning:
The maximal number of iterations maxit (set to 20 by the program)
allowed for finding a smoothing spline with fp=s has been reached: s
too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.
warnings.warn(message)
Fitting shape 3FGL J0023.9-7203 TS: 520.777
Fitting shape 3FGL J0023.9-7203 TS: 665.330
Fitting shape 3FGL J0023.9-7203 TS: 795.857
Fitting shape 3FGL J0146.4-6746 TS: 68.512
/home/runner/miniconda3/envs/fermipy/lib/python3.9/site-packages/scipy/interpolate/_fitpack2.py:313: UserWarning:
The maximal number of iterations maxit (set to 20 by the program)
allowed for finding a smoothing spline with fp=s has been reached: s
too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.
warnings.warn(message)
Fitting shape SMC TS: 95.464
Fitting shape 3FGL J2338.7-7401 TS: 142.315
Fitting shape SMC TS: 64.410
Fitting shape 3FGL J0023.9-7203 TS: 637.307Fitting shape SMC TS: 83.434
Fitting shape 3FGL J0112.9-7506 TS: 50.496
Fitting shape 3FGL J0023.9-7203 TS: 777.835
Fitting shape 3FGL J0023.9-7203 TS: 699.367
Fitting shape 3FGL J0029.1-7045 TS: 28.116Fitting shape 3FGL J0023.9-7203 TS: 719.612
Fitting shape SMC TS: 74.113Fitting shape 3FGL J0029.1-7045 TS: 34.237Fitting shape 3FGL J2351.9-7601 TS: 39.627
Fitting shape 3FGL J0029.1-7045 TS: 119.174
Fitting shape SMC TS: 76.758Fitting shape SMC TS: 106.867
Fitting shape 3FGL J0029.1-7045 TS: 43.996
Fitting shape 3FGL J0146.4-6746 TS: 31.944
Fitting shape 3FGL J2338.7-7401 TS: 39.582
Fitting shape SMC TS: 85.536
Fitting shape 3FGL J2351.9-7601 TS: 44.812
Fitting shape 3FGL J0146.4-6746 TS: 96.577Fitting shape 3FGL J2336.5-7620 TS: 31.280
Fitting shape 3FGL J0146.4-6746 TS: 20.004Fitting shape 3FGL J2338.7-7401 TS: 31.231
Fitting shape 3FGL J0023.9-7203 TS: 532.485
Fitting shape 3FGL J0146.4-6746 TS: 28.027Fitting shape 3FGL J2338.7-7401 TS: 26.566
Fitting shape 3FGL J2351.9-7601 TS: 89.419
Fitting shape 3FGL J2336.5-7620 TS: 16.705Fitting shape 3FGL J0002.0-6722 TS: 26.807
Fitting shape SMC TS: 53.311
Fitting shape 3FGL J2336.5-7620 TS: 26.390
Fitting shape 3FGL J0029.1-7045 TS: 26.175
Fitting shape 3FGL J2338.7-7401 TS: 38.284
Fitting shape 3FGL J0029.1-7045 TS: 40.500
Fitting shape 3FGL J2351.9-7601 TS: 23.518
Fitting shape 3FGL J0146.4-6746 TS: 23.152
Fitting shape 3FGL J2351.9-7601 TS: 37.726
Fitting shape 3FGL J0112.9-7506 TS: 22.481Fitting shape 3FGL J0112.9-7506 TS: 21.152
Fitting shape 3FGL J0002.0-6722 TS: 23.409
Fitting shape 3FGL J2338.7-7401 TS: 19.371Fitting shape PS J0102.8-7052 TS: 18.148
Fitting shape 3FGL J0112.9-7506 TS: 16.307
2024-12-19 20:27:28 INFO lightcurve_410455542_444635167 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_410455542_444635167/fit_model_final_00.xml...
2024-12-19 20:27:29 INFO lightcurve_307916667_342096292 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_307916667_342096292/fit_model_final_00.xml...
2024-12-19 20:27:29 INFO lightcurve_376275917_410455542 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_376275917_410455542/fit_model_final_00.xml...
2024-12-19 20:27:29 INFO lightcurve_478814792_512994417 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_478814792_512994417/fit_model_final_00.xml...
2024-12-19 20:27:29 INFO lightcurve_444635167_478814792 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_444635167_478814792/fit_model_final_00.xml...
2024-12-19 20:27:30 INFO lightcurve_342096292_376275917 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_342096292_376275917/fit_model_final_00.xml...
2024-12-19 20:27:30 INFO lightcurve_239557417_273737042 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_239557417_273737042/fit_model_final_00.xml...
2024-12-19 20:27:30 INFO lightcurve_273737042_307916667 GTBinnedAnalysis.write_xml(): Writing /home/runner/work/fermipy/fermipy/fermipy-extra/notebooks/SMC_data/lightcurve_273737042_307916667/fit_model_final_00.xml...
2024-12-19 20:27:31 INFO lightcurve_410455542_444635167 GTAnalysis._process_lc_bin(): Finished time range 410455542 444635167
2024-12-19 20:27:31 INFO lightcurve_478814792_512994417 GTAnalysis._process_lc_bin(): Finished time range 478814792 512994417
2024-12-19 20:27:31 INFO lightcurve_307916667_342096292 GTAnalysis._process_lc_bin(): Finished time range 307916667 342096292
2024-12-19 20:27:31 INFO lightcurve_444635167_478814792 GTAnalysis._process_lc_bin(): Finished time range 444635167 478814792
2024-12-19 20:27:31 INFO lightcurve_376275917_410455542 GTAnalysis._process_lc_bin(): Finished time range 376275917 410455542
2024-12-19 20:27:32 INFO lightcurve_342096292_376275917 GTAnalysis._process_lc_bin(): Finished time range 342096292 376275917
2024-12-19 20:27:32 INFO lightcurve_273737042_307916667 GTAnalysis._process_lc_bin(): Finished time range 273737042 307916667
2024-12-19 20:27:32 INFO lightcurve_239557417_273737042 GTAnalysis._process_lc_bin(): Finished time range 239557417 273737042
2024-12-19 20:27:34 INFO GTAnalysis.lightcurve(): Finished Lightcurve
[54]:
print(lc['tmin'])
print(lc['tmax'])
print(lc['fit_success'])
print(lc['ts_var'])
print(lc['flux'])
print(lc['eflux'])
print(lc['flux_ul95'])
[2.39557417e+08 2.73737042e+08 3.07916667e+08 3.42096292e+08
3.76275917e+08 4.10455542e+08 4.44635167e+08 4.78814792e+08]
[2.73737042e+08 3.07916667e+08 3.42096292e+08 3.76275917e+08
4.10455542e+08 4.44635167e+08 4.78814792e+08 5.12994417e+08]
[ True True True True True True True True]
3.203208369385318
[2.46923977e-09 2.60856772e-09 2.75698985e-09 2.88957581e-09
2.63485307e-09 2.78679863e-09 3.16431886e-09 2.91662089e-09]
[7.00219661e-06 7.59830000e-06 7.64876554e-06 7.37341939e-06
7.08109175e-06 1.08397581e-05 1.10009120e-05 1.03577327e-05]
[3.17514107e-09 3.23721990e-09 3.38459553e-09 3.54028715e-09
3.28010774e-09 3.50470895e-09 3.81467673e-09 3.55887385e-09]
[55]:
plt.clf()
fig = plt.figure(figsize=(8,6))
plt.errorbar((lc['tmin']+lc['tmax'])/2., lc['flux'], yerr=lc['flux_err'], xerr=(lc['tmax']-lc['tmin'])/2., fmt="o", color="black")
plt.ylabel(r'$\Phi_{\gamma}$ [ph/cm$^2$/s]', fontsize=18)
plt.xlabel(r'$t$ [s]')
plt.axis([lc['tmin'][0],lc['tmax'][len(lc['tmax'])-1],2e-9,6e-9])
plt.grid(True)
plt.yscale('log')
plt.xscale('linear')
fig.tight_layout(pad=0.5)
plt.show()
<Figure size 640x480 with 0 Axes>
[ ]: