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:
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:
$ 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.
$ 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.
$ 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.
# 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
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:
$ conda update fermipy
If you want to make development of Fermipy you should get the github version making:
$ git clone https://github.com/fermiPy/fermipy.git
Then you should create a branch using:
$ 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
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:
%matplotlib inline
import os
import numpy as np
from fermipy.gtanalysis import GTAnalysis
from fermipy.plotting import ROIPlotter, SEDPlotter
import matplotlib.pyplot as plt
import matplotlib
--------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-2-02a3369a5ba9> in <module>() 3 import os 4 import numpy as np ----> 5 from fermipy.gtanalysis import GTAnalysis 6 from fermipy.plotting import ROIPlotter, SEDPlotter 7 import matplotlib.pyplot as plt ImportError: No module named fermipy.gtanalysis
if os.path.isfile('../data/SMC_data.tar.gz'):
!tar xzf ../data/SMC_data.tar.gz
else:
!curl -OL https://raw.githubusercontent.com/fermiPy/fermipy-extras/master/data/SMC_data.tar.gz
!tar xzf SMC_data.tar.gz
cat config.yaml
data: evfile : 'ft1.fits' scfile : '/u/gl/mdimauro/kipac/workdir/files/SC/P8_104months_ft2.fits' ltcube : '/u/gl/mdimauro/dmcat/workdir/mattia/LogNLogS_Ebins/files_bins/bin13/P8_SOURCE_zmax105_1_3_ltcube.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_v06.fits' isodiff : '$FERMI_DIFFUSE_DIR/iso_P8R2_SOURCE_V6_v06.txt' catalogs: gll_psc_v16.fit fileio: usescratch: False
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:
import yaml
# Load a configuration
config = yaml.load(open('config.yaml'))
# 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 } }
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
%matplotlib inline
import os
import numpy as np
from fermipy.gtanalysis import GTAnalysis
from fermipy.plotting import ROIPlotter, SEDPlotter
import matplotlib.pyplot as plt
import matplotlib
if os.path.isfile('../data/SMC_data.tar.gz'):
!tar xzf ../data/SMC_data.tar.gz
else:
!curl -OL https://raw.githubusercontent.com/fermiPy/fermipy-extras/master/data/SMC_data.tar.gz
!tar xzf SMC_data.tar.gz
gta = GTAnalysis('config.yaml')
matplotlib.interactive(True)
gta.setup()
2018-06-29 17:10:10 INFO GTAnalysis.__init__(): -------------------------------------------------------------------------------- fermipy version 0.17.2+9.gacd6.dirty ScienceTools version ScienceTools-11-07-00 WARNING: UnitsWarning: 'photon/cm**2/MeV/s' contains multiple slashes, which is discouraged by the FITS standard [astropy.units.format.generic] WARNING: UnitsWarning: 'photon/cm**2/s' contains multiple slashes, which is discouraged by the FITS standard [astropy.units.format.generic] WARNING: UnitsWarning: 'erg/cm**2/s' contains multiple slashes, which is discouraged by the FITS standard [astropy.units.format.generic] 2018-06-29 17:10:12 INFO GTAnalysis.setup(): Running setup. 2018-06-29 17:10:12 INFO GTBinnedAnalysis.setup(): Running setup for component 00 2018-06-29 17:10:12 INFO GTBinnedAnalysis.run_gtapp(): Running gtselect. 2018-06-29 17:10:12 INFO GTBinnedAnalysis.run_gtapp(): time -p gtselect infile=ft1.fits outfile=/nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/ft1_00.fits ra=14.5034619337 dec=-72.7495444282 rad=8.98528137424 tmin=239557417.0 tmax=512994417.0 emin=1000.0 emax=500000.0 zmin=0.0 zmax=105.0 evclass=128 evtype=3 convtype=-1 phasemin=0.0 phasemax=1.0 evtable="EVENTS" chatter=3 clobber=yes debug=no gui=no mode="ql" 2018-06-29 17:10:13 INFO GTBinnedAnalysis.run_gtapp(): This is gtselect version ScienceTools-11-07-00 2018-06-29 17:10:13 INFO GTBinnedAnalysis.run_gtapp(): Applying filter string: ((EVENT_CLASS&o200) != o0) && ((EVENT_TYPE&o3) != o0) && angsep(RA,DEC,14.50346193,-72.74954443) < 8.985281374 && angsep(RA,DEC,14.50346193,-72.74954443) < 8.985281374 && 1000 < ENERGY && ENERGY <= 500000 && 239557417 < TIME && TIME <= 512994417 && 0 < ZENITH_ANGLE && ZENITH_ANGLE <= 105 && gtifilter() 2018-06-29 17:10:13 INFO GTBinnedAnalysis.run_gtapp(): Done. 2018-06-29 17:10:13 INFO GTBinnedAnalysis.run_gtapp(): Finished gtselect. Execution time: 1.16 s 2018-06-29 17:10:13 INFO GTBinnedAnalysis.setup(): Using external LT cube. 2018-06-29 17:10:15 INFO GTBinnedAnalysis.run_gtapp(): Running gtbin. 2018-06-29 17:10:15 INFO GTBinnedAnalysis.run_gtapp(): time -p gtbin evfile=/nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/ft1_00.fits scfile=/u/gl/mdimauro/kipac/workdir/files/SC/P8_104months_ft2.fits outfile=/nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/ccube_00.fits algorithm="ccube" ebinalg="LOG" emin=1000.0 emax=500000.0 enumbins=22 ebinfile=NONE tbinalg="LIN" tbinfile=NONE nxpix=150 nypix=150 binsz=0.08 coordsys="GAL" xref=302.25 yref=-44.37 axisrot=0.0 rafield="RA" decfield="DEC" proj="AIT" hpx_ordering_scheme="RING" hpx_order=3 hpx_ebin=yes hpx_region="" evtable="EVENTS" sctable="SC_DATA" efield="ENERGY" tfield="TIME" chatter=3 clobber=yes debug=no gui=no mode="ql" 2018-06-29 17:10:25 INFO GTBinnedAnalysis.run_gtapp(): This is gtbin version ScienceTools-11-07-00 2018-06-29 17:10:25 INFO GTBinnedAnalysis.run_gtapp(): Finished gtbin. Execution time: 9.79 s 2018-06-29 17:10:25 INFO GTBinnedAnalysis.run_gtapp(): Running gtexpcube2. 2018-06-29 17:10:25 INFO GTBinnedAnalysis.run_gtapp(): time -p gtexpcube2 infile=/u/gl/mdimauro/dmcat/workdir/mattia/LogNLogS_Ebins/files_bins/bin13/P8_SOURCE_zmax105_1_3_ltcube.fits cmap=none outfile=/nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/bexpmap_00.fits irfs="P8R2_SOURCE_V6" evtype=3 nxpix=360 nypix=180 binsz=1.0 coordsys="GAL" xref=0.0 yref=0.0 axisrot=0.0 proj="CAR" ebinalg="LOG" emin=1000.0 emax=500000.0 enumbins=22 ebinfile="NONE" hpx_ordering_scheme="RING" hpx_order=6 bincalc="EDGE" ignorephi=no thmax=180.0 thmin=0.0 table="EXPOSURE" chatter=3 clobber=yes debug=no mode="ql" 2018-06-29 17:10:40 INFO GTBinnedAnalysis.run_gtapp(): This is gtexpcube2 version ScienceTools-11-07-00 2018-06-29 17:10:40 INFO GTBinnedAnalysis.run_gtapp(): Using evtype=3 (i.e., FRONT/BACK irfs) 2018-06-29 17:10:40 INFO GTBinnedAnalysis.run_gtapp(): ResponseFunctions::load: IRF used: P8R2_SOURCE_V6 2018-06-29 17:10:40 INFO GTBinnedAnalysis.run_gtapp(): event_types: 0 1 2018-06-29 17:10:40 INFO GTBinnedAnalysis.run_gtapp(): Computing binned exposure map....................! 2018-06-29 17:10:40 INFO GTBinnedAnalysis.run_gtapp(): Finished gtexpcube2. Execution time: 15.53 s 2018-06-29 17:10:40 INFO GTBinnedAnalysis.run_gtapp(): Running gtexpcube2. 2018-06-29 17:10:40 INFO GTBinnedAnalysis.run_gtapp(): time -p gtexpcube2 infile=/u/gl/mdimauro/dmcat/workdir/mattia/LogNLogS_Ebins/files_bins/bin13/P8_SOURCE_zmax105_1_3_ltcube.fits cmap=none outfile=/nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/bexpmap_roi_00.fits irfs="P8R2_SOURCE_V6" evtype=3 nxpix=150 nypix=150 binsz=0.08 coordsys="GAL" xref=302.25 yref=-44.37 axisrot=0.0 proj="CAR" ebinalg="LOG" emin=1000.0 emax=500000.0 enumbins=22 ebinfile="NONE" hpx_ordering_scheme="RING" hpx_order=6 bincalc="EDGE" ignorephi=no thmax=180.0 thmin=0.0 table="EXPOSURE" chatter=3 clobber=yes debug=no mode="ql" 2018-06-29 17:10:46 INFO GTBinnedAnalysis.run_gtapp(): This is gtexpcube2 version ScienceTools-11-07-00 2018-06-29 17:10:46 INFO GTBinnedAnalysis.run_gtapp(): Using evtype=3 (i.e., FRONT/BACK irfs) 2018-06-29 17:10:46 INFO GTBinnedAnalysis.run_gtapp(): ResponseFunctions::load: IRF used: P8R2_SOURCE_V6 2018-06-29 17:10:46 INFO GTBinnedAnalysis.run_gtapp(): event_types: 0 1 2018-06-29 17:10:46 INFO GTBinnedAnalysis.run_gtapp(): Computing binned exposure map....................! 2018-06-29 17:10:46 INFO GTBinnedAnalysis.run_gtapp(): Finished gtexpcube2. Execution time: 5.93 s 2018-06-29 17:10:46 INFO GTBinnedAnalysis.run_gtapp(): Running gtsrcmaps. 2018-06-29 17:10:46 INFO GTBinnedAnalysis.run_gtapp(): time -p gtsrcmaps scfile=/u/gl/mdimauro/kipac/workdir/files/SC/P8_104months_ft2.fits sctable="SC_DATA" expcube=/u/gl/mdimauro/dmcat/workdir/mattia/LogNLogS_Ebins/files_bins/bin13/P8_SOURCE_zmax105_1_3_ltcube.fits cmap=/nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/ccube_00.fits srcmdl=/nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/srcmdl_00.xml bexpmap=/nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/bexpmap_00.fits wmap=none outfile=/nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/srcmap_00.fits irfs="P8R2_SOURCE_V6" evtype=3 convol=yes resample=yes rfactor=2 minbinsz=0.05 ptsrc=yes psfcorr=yes emapbnds=no copyall=no chatter=3 clobber=yes debug=no gui=no mode="ql" 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): This is gtsrcmaps version ScienceTools-11-07-00 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Using evtype=3 (i.e., FRONT/BACK irfs) 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): ResponseFunctions::load: IRF used: P8R2_SOURCE_V6 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): event_types: 0 1 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): difference in gti interval found 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): WARNING: 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): AppHelpers::checkTimeCuts: 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Time range cuts and GTI extensions in files /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/ccube_00.fitsand /u/gl/mdimauro/dmcat/workdir/mattia/LogNLogS_Ebins/files_bins/bin13/P8_SOURCE_zmax105_1_3_ltcube.fits[Exposure] do not agree. 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Aggregate absolute differences in GTI start times (s): 1.96803e+10 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Aggregate absolute differences in GTI stop times (s): 1.96802e+10 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0059.0-7242e 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0112.9-7506 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0023.9-7203 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0029.1-7045 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0021.6-6835 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J2351.9-7601 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J2338.7-7401 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0146.4-6746 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J2336.5-7620 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named 3FGL J0002.0-6722 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named isodiff 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Creating source named galdiff 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0002.0-6722....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0021.6-6835....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0023.9-7203....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0029.1-7045....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0059.0-7242e....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0112.9-7506....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J0146.4-6746....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J2336.5-7620....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J2338.7-7401....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for 3FGL J2351.9-7601....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for galdiff....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Generating SourceMap for isodiff....................! 2018-06-29 17:13:57 INFO GTBinnedAnalysis.run_gtapp(): Finished gtsrcmaps. Execution time: 190.37 s 2018-06-29 17:13:57 INFO GTBinnedAnalysis.setup(): Finished setup for component 00 2018-06-29 17:13:57 INFO GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00. WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] 2018-06-29 17:14:16 INFO GTAnalysis.setup(): Initializing source properties 2018-06-29 17:14:24 INFO GTAnalysis.setup(): Finished setup.
gta.print_model()
2018-06-29 17:14:28 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 1434.2 3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.0 3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1675.8 3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 269.9 3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.0 3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.5 3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.2 3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 123.7 3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 186.9 3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.2 isodiff --- 1.000 0.0313 2.12 nan 9076.7 galdiff --- 1.000 0.126 0.00 nan 17968.1
gta.free_sources()
gta.fit()
2018-06-29 17:14:49 INFO GTAnalysis.fit(): Starting fit. /u/gl/mdimauro/kipac/software/anaconda/lib/python2.7/site-packages/scipy/interpolate/fitpack2.py:226: 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) 2018-06-29 17:15:05 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0 2018-06-29 17:15:05 INFO GTAnalysis.fit(): LogLike: -77797.480 DeltaLogLike: 77.991
{'config': {'covar': True, 'init_lambda': 0.0001, 'max_iter': 100, 'min_fit_quality': 2, 'optimizer': 'MINUIT', 'reoptimize': False, 'retries': 3, 'tol': 0.001, 'verbosity': 0}, 'correlation': array([[ 1.00000000e+00, 4.41213321e-01, -1.68928666e-03, -1.26101446e-03, 4.75069270e-03, 2.99355059e-03, -2.27977805e-03, 4.30742411e-03, 1.80080622e-03, 1.19095108e-02, 2.64517667e-03, 3.98596710e-03, 2.18620628e-03, 6.03607400e-03, 2.94792882e-03, 4.92794564e-03, 2.93347538e-03, 4.75911932e-03, 2.74784090e-03, 2.74212616e-03, 2.85560646e-03, -1.20322982e-02, -2.65882496e-02, -3.31780055e-02], [ 4.41213321e-01, 1.00000000e+00, -1.73755585e-03, -7.26334318e-04, 3.04604145e-03, 1.77554687e-03, -1.02995968e-03, 2.64139475e-03, 1.82329601e-03, 1.15173698e-02, 8.09669776e-03, 3.05839750e-03, 2.39391524e-03, 3.42156860e-03, 2.30245155e-03, 4.62280791e-03, 3.38242828e-03, 2.70017690e-03, 2.46915971e-03, 1.14708084e-03, 3.03681425e-03, -3.35624627e-02, -2.70923494e-02, -1.63719899e-03], [-1.68928666e-03, -1.73755585e-03, 1.00000000e+00, 8.67184815e-01, 3.89694312e-03, 2.58185051e-03, -1.71554656e-03, -3.69887944e-03, -2.65740334e-03, 1.56305503e-02, 1.05939709e-02, 2.93632040e-03, 2.70047937e-03, 6.18603566e-03, 3.93539102e-03, 4.91301670e-03, 4.21424550e-03, 3.64196718e-03, 3.34331522e-03, 7.49153625e-04, 3.65066849e-03, -2.12594053e-02, -6.39890682e-02, -3.86306881e-02], [-1.26101446e-03, -7.26334318e-04, 8.67184815e-01, 1.00000000e+00, 1.54977839e-03, 1.10195232e-03, -5.82975012e-04, -2.05900619e-03, -1.27136068e-03, 7.59517911e-03, 8.29773457e-03, 3.11041544e-04, 1.16844667e-03, 2.14972352e-03, 1.88758255e-03, 1.56786945e-03, 2.12119802e-03, 5.38564138e-04, 1.44565255e-03, -9.41626715e-04, 1.65094458e-03, -1.18329983e-02, -4.34475938e-02, -1.66096262e-02], [ 4.75069270e-03, 3.04604145e-03, 3.89694312e-03, 1.54977839e-03, 1.00000000e+00, 9.13363184e-01, -7.88519441e-01, -4.83039709e-02, -3.53186219e-02, -2.41069997e-02, -1.81648609e-02, 3.18908124e-03, 2.90581036e-03, 7.04673205e-03, 4.32365763e-03, 4.01449051e-03, 3.74361986e-03, 2.21064971e-03, 1.93230961e-03, 2.75921293e-04, 2.77858782e-03, -9.28765042e-03, -7.50558567e-02, -5.63407923e-02], [ 2.99355059e-03, 1.77554687e-03, 2.58185051e-03, 1.10195232e-03, 9.13363184e-01, 1.00000000e+00, -9.53061617e-01, -2.78623657e-02, -2.35926021e-02, -1.54924254e-02, -1.34114263e-02, 8.99687738e-04, 1.34140991e-03, 4.77098746e-03, 2.96876948e-03, 1.39606848e-03, 1.97186405e-03, 9.52020552e-04, 9.66762882e-04, -5.60859226e-04, 1.28669971e-03, 7.27968131e-03, -6.14848738e-02, -5.21298716e-02], [-2.27977805e-03, -1.02995968e-03, -1.71554656e-03, -5.82975012e-04, -7.88519441e-01, -9.53061617e-01, 1.00000000e+00, 1.79180716e-02, 1.59855040e-02, 1.05116600e-02, 9.67915518e-03, -1.48731220e-04, -5.28598882e-04, -3.53640152e-03, -2.04745942e-03, -2.62264418e-04, -8.91197534e-04, -6.10679607e-04, -4.30035403e-04, 4.77654480e-04, -4.62687012e-04, -1.54190817e-02, 4.49532214e-02, 4.63004559e-02], [ 4.30742411e-03, 2.64139475e-03, -3.69887944e-03, -2.05900619e-03, -4.83039709e-02, -2.78623657e-02, 1.79180716e-02, 1.00000000e+00, 6.47961062e-01, -1.41259446e-03, -1.99342718e-03, 4.71439092e-03, 3.12003168e-03, 5.82228535e-03, 3.26213249e-03, 5.78035886e-03, 3.88822949e-03, 4.44150079e-03, 3.15127657e-03, 2.26703401e-03, 3.60089165e-03, -2.74262577e-02, -3.51855453e-02, -2.27558272e-02], [ 1.80080622e-03, 1.82329601e-03, -2.65740334e-03, -1.27136068e-03, -3.53186219e-02, -2.35926021e-02, 1.59855040e-02, 6.47961062e-01, 1.00000000e+00, -3.16100197e-04, 5.41958559e-04, 2.41666184e-03, 2.19586533e-03, 3.08860979e-03, 2.22001794e-03, 3.61965251e-03, 2.99666542e-03, 1.97338522e-03, 2.12715447e-03, 4.32421128e-04, 2.59572487e-03, -2.60611228e-02, -3.39617300e-02, -7.87303402e-03], [ 1.19095108e-02, 1.15173698e-02, 1.56305503e-02, 7.59517911e-03, -2.41069997e-02, -1.54924254e-02, 1.05116600e-02, -1.41259446e-03, -3.16100197e-04, 1.00000000e+00, 8.47803788e-01, -1.06551000e-02, -7.26216820e-03, 1.60135575e-02, 1.12597231e-02, 2.18226480e-02, 1.66683101e-02, 1.20288745e-02, 1.18927622e-02, 4.15198852e-03, 1.44300694e-02, -1.64988565e-01, -1.49386406e-01, -1.07133917e-02], [ 2.64517667e-03, 8.09669776e-03, 1.05939709e-02, 8.29773457e-03, -1.81648609e-02, -1.34114263e-02, 9.67915518e-03, -1.99342718e-03, 5.41958559e-04, 8.47803788e-01, 1.00000000e+00, -5.10386470e-03, -3.66088040e-03, 6.97590085e-03, 7.86508046e-03, 1.37317165e-02, 1.33335427e-02, 3.32066962e-03, 8.22586345e-03, -2.42416614e-03, 1.08062673e-02, -1.50964102e-01, -1.52462020e-01, 2.94601524e-02], [ 3.98596710e-03, 3.05839750e-03, 2.93632040e-03, 3.11041544e-04, 3.18908124e-03, 8.99687738e-04, -1.48731220e-04, 4.71439092e-03, 2.41666184e-03, -1.06551000e-02, -5.10386470e-03, 1.00000000e+00, 6.09891210e-01, 4.05426285e-03, 2.23960595e-03, 7.96028660e-03, 4.46630534e-03, 4.93358221e-03, 3.32937404e-03, 3.68094971e-03, 4.26926812e-03, -6.13385208e-02, 4.20700191e-03, 2.63128619e-02], [ 2.18620628e-03, 2.39391524e-03, 2.70047937e-03, 1.16844667e-03, 2.90581036e-03, 1.34140991e-03, -5.28598882e-04, 3.12003168e-03, 2.19586533e-03, -7.26216820e-03, -3.66088040e-03, 6.09891210e-01, 1.00000000e+00, 2.75382989e-03, 1.99956194e-03, 5.34807187e-03, 3.66739252e-03, 2.71696514e-03, 2.54521954e-03, 1.43719447e-03, 3.28096658e-03, -4.65069825e-02, -1.61207347e-02, 1.57153382e-02], [ 6.03607400e-03, 3.42156860e-03, 6.18603566e-03, 2.14972352e-03, 7.04673205e-03, 4.77098746e-03, -3.53640152e-03, 5.82228535e-03, 3.08860979e-03, 1.60135575e-02, 6.97590085e-03, 4.05426285e-03, 2.75382989e-03, 1.00000000e+00, 7.32610818e-01, 5.66478651e-03, 4.04061221e-03, 5.14644018e-03, 3.57184793e-03, 2.20349861e-03, 3.70876712e-03, -1.55188830e-02, -5.27126978e-02, -4.65371558e-02], [ 2.94792882e-03, 2.30245155e-03, 3.93539102e-03, 1.88758255e-03, 4.32365763e-03, 2.96876948e-03, -2.04745942e-03, 3.26213249e-03, 2.22001794e-03, 1.12597231e-02, 7.86508046e-03, 2.23960595e-03, 1.99956194e-03, 7.32610818e-01, 1.00000000e+00, 3.69735368e-03, 3.06297479e-03, 2.55510363e-03, 2.38680311e-03, 6.19709534e-04, 2.67376535e-03, -1.95607175e-02, -4.09557811e-02, -2.06321325e-02], [ 4.92794564e-03, 4.62280791e-03, 4.91301670e-03, 1.56786945e-03, 4.01449051e-03, 1.39606848e-03, -2.62264418e-04, 5.78035886e-03, 3.61965251e-03, 2.18226480e-02, 1.37317165e-02, 7.96028660e-03, 5.34807187e-03, 5.66478651e-03, 3.69735368e-03, 1.00000000e+00, 7.53152767e-01, -1.41490293e-04, 6.97426261e-05, -3.58642560e-02, -5.76527929e-02, -9.06397466e-02, -1.70567350e-02, 3.34960916e-02], [ 2.93347538e-03, 3.38242828e-03, 4.21424550e-03, 2.12119802e-03, 3.74361986e-03, 1.97186405e-03, -8.91197534e-04, 3.88822949e-03, 2.99666542e-03, 1.66683101e-02, 1.33335427e-02, 4.46630534e-03, 3.66739252e-03, 4.04061221e-03, 3.06297479e-03, 7.53152767e-01, 1.00000000e+00, -4.93818381e-04, 1.91766446e-04, -1.76316745e-02, -3.98654913e-02, -6.01629702e-02, -3.46699973e-02, 1.33246115e-02], [ 4.75911932e-03, 2.70017690e-03, 3.64196718e-03, 5.38564138e-04, 2.21064971e-03, 9.52020552e-04, -6.10679607e-04, 4.44150079e-03, 1.97338522e-03, 1.20288745e-02, 3.32066962e-03, 4.93358221e-03, 2.71696514e-03, 5.14644018e-03, 2.55510363e-03, -1.41490293e-04, -4.93818381e-04, 1.00000000e+00, 2.70637179e-01, -5.41282886e-04, -1.85931600e-03, -3.15812013e-02, -1.09126776e-02, -7.89020711e-03], [ 2.74784090e-03, 2.46915971e-03, 3.34331522e-03, 1.44565255e-03, 1.93230961e-03, 9.66762882e-04, -4.30035403e-04, 3.15127657e-03, 2.12715447e-03, 1.18927622e-02, 8.22586345e-03, 3.32937404e-03, 2.54521954e-03, 3.57184793e-03, 2.38680311e-03, 6.97426261e-05, 1.91766446e-04, 2.70637179e-01, 1.00000000e+00, -9.50945368e-04, -1.07511037e-03, -3.67518512e-02, -2.63745563e-02, 2.47277323e-04], [ 2.74212616e-03, 1.14708084e-03, 7.49153625e-04, -9.41626715e-04, 2.75921293e-04, -5.60859226e-04, 4.77654480e-04, 2.26703401e-03, 4.32421128e-04, 4.15198852e-03, -2.42416614e-03, 3.68094971e-03, 1.43719447e-03, 2.20349861e-03, 6.19709534e-04, -3.58642560e-02, -1.76316745e-02, -5.41282886e-04, -9.50945368e-04, 1.00000000e+00, -3.59102825e-01, -2.20582878e-02, 2.26623778e-02, 1.18730440e-02], [ 2.85560646e-03, 3.03681425e-03, 3.65066849e-03, 1.65094458e-03, 2.77858782e-03, 1.28669971e-03, -4.62687012e-04, 3.60089165e-03, 2.59572487e-03, 1.44300694e-02, 1.08062673e-02, 4.26926812e-03, 3.28096658e-03, 3.70876712e-03, 2.67376535e-03, -5.76527929e-02, -3.98654913e-02, -1.85931600e-03, -1.07511037e-03, -3.59102825e-01, 1.00000000e+00, -5.49247516e-02, -2.56712043e-02, 1.39226221e-02], [-1.20322982e-02, -3.35624627e-02, -2.12594053e-02, -1.18329983e-02, -9.28765042e-03, 7.27968131e-03, -1.54190817e-02, -2.74262577e-02, -2.60611228e-02, -1.64988565e-01, -1.50964102e-01, -6.13385208e-02, -4.65069825e-02, -1.55188830e-02, -1.95607175e-02, -9.06397466e-02, -6.01629702e-02, -3.15812013e-02, -3.67518512e-02, -2.20582878e-02, -5.49247516e-02, 1.00000000e+00, 5.49626294e-04, -6.94933777e-01], [-2.65882496e-02, -2.70923494e-02, -6.39890682e-02, -4.34475938e-02, -7.50558567e-02, -6.14848738e-02, 4.49532214e-02, -3.51855453e-02, -3.39617300e-02, -1.49386406e-01, -1.52462020e-01, 4.20700191e-03, -1.61207347e-02, -5.27126978e-02, -4.09557811e-02, -1.70567350e-02, -3.46699973e-02, -1.09126776e-02, -2.63745563e-02, 2.26623778e-02, -2.56712043e-02, 5.49626294e-04, 1.00000000e+00, 6.11971992e-01], [-3.31780055e-02, -1.63719899e-03, -3.86306881e-02, -1.66096262e-02, -5.63407923e-02, -5.21298716e-02, 4.63004559e-02, -2.27558272e-02, -7.87303402e-03, -1.07133917e-02, 2.94601524e-02, 2.63128619e-02, 1.57153382e-02, -4.65371558e-02, -2.06321325e-02, 3.34960916e-02, 1.33246115e-02, -7.89020711e-03, 2.47277323e-04, 1.18730440e-02, 1.39226221e-02, -6.94933777e-01, 6.11971992e-01, 1.00000000e+00]]), 'covariance': array([[ 5.03925722e-03, 4.35305134e-03, -1.80443638e-04, -5.02988998e-05, 1.87950782e-05, 3.95679775e-05, -1.28959906e-05, 1.81660288e-05, 1.41161757e-05, 1.06101681e-04, 1.15365067e-05, 5.82052044e-05, 1.73280220e-05, 3.70064223e-05, 2.50682508e-05, 3.21896380e-05, 3.19210395e-05, 2.11052889e-05, 1.87433759e-05, 3.17863321e-05, 2.03697692e-05, -1.72302577e-05, -4.46217437e-05, -1.14778528e-04], [ 4.35305134e-03, 1.93162945e-02, -3.63375497e-04, -5.67222735e-05, 2.35940043e-05, 4.59481507e-05, -1.14067260e-05, 2.18099324e-05, 2.79824606e-05, 2.00890916e-04, 6.91363128e-05, 8.74380947e-05, 3.71488410e-05, 4.10701647e-05, 3.83332979e-05, 5.91200344e-05, 7.20612550e-05, 2.34442082e-05, 3.29749434e-05, 2.60330863e-05, 4.24115971e-05, -9.40969725e-05, -8.90188755e-05, -1.10889517e-05], [-1.80443638e-04, -3.63375497e-04, 2.26417460e+00, 7.33198852e-01, 3.26800686e-04, 7.23369239e-04, -2.05700972e-04, -3.30661957e-04, -4.41549342e-04, 2.95171419e-03, 9.79377475e-04, 9.08873091e-04, 4.53701705e-04, 8.03908570e-04, 7.09359881e-04, 6.80252455e-04, 9.72044404e-04, 3.42351652e-04, 4.83398446e-04, 1.84075320e-04, 5.51990805e-04, -6.45306425e-04, -2.27632501e-03, -2.83279087e-03], [-5.02988998e-05, -5.67222735e-05, 7.33198852e-01, 3.15725973e-01, 4.85320562e-05, 1.15290081e-04, -2.61026122e-05, -6.87340456e-05, -7.88843295e-05, 5.35597146e-04, 2.86451480e-04, 3.59516146e-05, 7.33058512e-05, 1.04322274e-04, 1.27052988e-04, 8.10647362e-05, 1.82703844e-04, 1.89048846e-05, 7.80534402e-05, -8.63979917e-05, 9.32163600e-05, -1.34125044e-04, -5.77157589e-04, -4.54822693e-04], [ 1.87950782e-05, 2.35940043e-05, 3.26800686e-04, 4.85320562e-05, 3.10604591e-03, 9.47810298e-03, -3.50183127e-03, -1.59935867e-04, -2.17357431e-04, -1.68613435e-04, -6.21974225e-05, 3.65606883e-05, 1.80819720e-05, 3.39180578e-05, 2.88654948e-05, 2.05873900e-05, 3.19821012e-05, 7.69671332e-06, 1.03479332e-05, 2.51107031e-06, 1.55608226e-05, -1.04416641e-05, -9.88922021e-05, -1.53022044e-04], [ 3.95679775e-05, 4.59481507e-05, 7.23369239e-04, 1.15290081e-04, 9.47810298e-03, 3.46695314e-02, -1.41407955e-02, -3.08213086e-04, -4.85083652e-04, -3.62024930e-04, -1.53421184e-04, 3.44596318e-05, 2.78875324e-05, 7.67222877e-05, 6.62177223e-05, 2.39192539e-05, 5.62810602e-05, 1.10739295e-05, 1.72968461e-05, -1.70528737e-05, 2.40744113e-05, 2.73430070e-05, -2.70654840e-04, -4.73028986e-04], [-1.28959906e-05, -1.14067260e-05, -2.05700972e-04, -2.61026122e-05, -3.50183127e-03, -1.41407955e-02, 6.34976647e-03, 8.48260500e-05, 1.40660455e-04, 1.05122398e-04, 4.73862897e-05, -2.43795600e-06, -4.70305120e-06, -2.43377109e-05, -1.95442025e-05, -1.92302606e-06, -1.08858957e-05, -3.04000108e-06, -3.29272950e-06, 6.21530510e-06, -3.70485038e-06, -2.47854784e-05, 8.46863123e-05, 1.79800650e-04], [ 1.81660288e-05, 2.18099324e-05, -3.30661957e-04, -6.87340456e-05, -1.59935867e-04, -3.08213086e-04, 8.48260500e-05, 3.52954074e-03, 4.25084057e-03, -1.05322625e-05, -7.27605297e-06, 5.76142000e-05, 2.06962992e-05, 2.98738962e-05, 2.32158436e-05, 3.15995444e-05, 3.54097047e-05, 1.64842915e-05, 1.79894790e-05, 2.19931206e-05, 2.14967914e-05, -3.28689305e-05, -4.94193366e-05, -6.58838301e-05], [ 1.41161757e-05, 2.79824606e-05, -4.41549342e-04, -7.88843295e-05, -2.17357431e-04, -4.85083652e-04, 1.40660455e-04, 4.25084057e-03, 1.21936470e-02, -4.38063082e-06, 3.67679372e-06, 5.48943363e-05, 2.70736681e-05, 2.94556855e-05, 2.93661537e-05, 3.67790586e-05, 5.07243371e-05, 1.36131968e-05, 2.25703766e-05, 7.79728547e-06, 2.88024848e-05, -5.80523562e-05, -8.86604925e-05, -4.23678133e-05], [ 1.06101681e-04, 2.00890916e-04, 2.95171419e-03, 5.35597146e-04, -1.68613435e-04, -3.62024930e-04, 1.05122398e-04, -1.05322625e-05, -4.38063082e-06, 1.57503481e-02, 6.53697475e-03, -2.75072677e-04, -1.01762079e-04, 1.73569009e-04, 1.69276458e-04, 2.52010971e-04, 3.20662346e-04, 9.43086472e-05, 1.43417048e-04, 8.50885150e-05, 1.81977622e-04, -4.17694584e-04, -4.43230548e-04, -6.55238151e-05], [ 1.15365067e-05, 6.91363128e-05, 9.79377475e-04, 2.86451480e-04, -6.21974225e-05, -1.53421184e-04, 4.73862897e-05, -7.27605297e-06, 3.67679372e-06, 6.53697475e-03, 3.77461580e-03, -6.45030685e-05, -2.51128792e-05, 3.70148470e-05, 5.78846379e-05, 7.76297389e-05, 1.25572126e-04, 1.27451071e-05, 4.85613598e-05, -2.43202749e-05, 6.67139369e-05, -1.87098362e-04, -2.21447903e-04, 8.82060711e-05], [ 5.82052044e-05, 8.74380947e-05, 9.08873091e-04, 3.59516146e-05, 3.65606883e-05, 3.44596318e-05, -2.43795600e-06, 5.76142000e-05, 5.48943363e-05, -2.75072677e-04, -6.45030685e-05, 4.23145465e-02, 1.40078606e-02, 7.20271167e-05, 5.51874379e-05, 1.50674747e-04, 1.40833046e-04, 6.33999125e-05, 6.58082591e-05, 1.23644400e-04, 8.82475720e-05, -2.54529465e-04, 2.04593146e-05, 2.63778895e-04], [ 1.73280220e-05, 3.71488410e-05, 4.53701705e-04, 7.33058512e-05, 1.80819720e-05, 2.78875324e-05, -4.70305120e-06, 2.06962992e-05, 2.70736681e-05, -1.01762079e-04, -2.51128792e-05, 1.40078606e-02, 1.24666332e-02, 2.65552859e-05, 2.67444227e-05, 5.49463371e-05, 6.27687240e-05, 1.89513477e-05, 2.73069256e-05, 2.62035329e-05, 3.68112772e-05, -1.04749672e-04, -4.25532709e-05, 8.55116789e-05], [ 3.70064223e-05, 4.10701647e-05, 8.03908570e-04, 1.04322274e-04, 3.39180578e-05, 7.67222877e-05, -2.43377109e-05, 2.98738962e-05, 2.94556855e-05, 1.73569009e-04, 3.70148470e-05, 7.20271167e-05, 2.65552859e-05, 7.45896493e-03, 7.57942718e-03, 4.50183683e-05, 5.34931004e-05, 2.77669166e-05, 2.96418435e-05, 3.10757618e-05, 3.21864690e-05, -2.70370723e-05, -1.07628690e-04, -1.95869238e-04], [ 2.50682508e-05, 3.83332979e-05, 7.09359881e-04, 1.27052988e-04, 2.88654948e-05, 6.62177223e-05, -1.95442025e-05, 2.32158436e-05, 2.93661537e-05, 1.69276458e-04, 5.78846379e-05, 5.51874379e-05, 2.67444227e-05, 7.57942718e-03, 1.43498562e-02, 4.07550746e-05, 5.62442997e-05, 1.91211381e-05, 2.74734587e-05, 1.21222064e-05, 3.21848549e-05, -4.72681361e-05, -1.15987854e-04, -1.20446728e-04], [ 3.21896380e-05, 5.91200344e-05, 6.80252455e-04, 8.10647362e-05, 2.05873900e-05, 2.39192539e-05, -1.92302606e-06, 3.15995444e-05, 3.67790586e-05, 2.52010971e-04, 7.76297389e-05, 1.50674747e-04, 5.49463371e-05, 4.50183683e-05, 4.07550746e-05, 8.46708348e-03, 1.06233456e-02, -8.13345391e-07, 6.16649217e-07, -5.38887944e-04, -5.33079228e-04, -1.68246301e-04, -3.71053342e-05, 1.50206307e-04], [ 3.19210395e-05, 7.20612550e-05, 9.72044404e-04, 1.82703844e-04, 3.19821012e-05, 5.62810602e-05, -1.08858957e-05, 3.54097047e-05, 5.07243371e-05, 3.20662346e-04, 1.25572126e-04, 1.40833046e-04, 6.27687240e-05, 5.34931004e-05, 5.62442997e-05, 1.06233456e-02, 2.34975526e-02, -4.72889870e-06, 2.82459966e-06, -4.41341327e-04, -6.14062993e-04, -1.86037504e-04, -1.25643102e-04, 9.95389333e-05], [ 2.11052889e-05, 2.34442082e-05, 3.42351652e-04, 1.89048846e-05, 7.69671332e-06, 1.10739295e-05, -3.04000108e-06, 1.64842915e-05, 1.36131968e-05, 9.43086472e-05, 1.27451071e-05, 6.33999125e-05, 1.89513477e-05, 2.77669166e-05, 1.91211381e-05, -8.13345391e-07, -4.72889870e-06, 3.90267950e-03, 1.62458287e-03, -5.52173374e-06, -1.16718350e-05, -3.97988029e-05, -1.61170775e-05, -2.40213250e-05], [ 1.87433759e-05, 3.29749434e-05, 4.83398446e-04, 7.80534402e-05, 1.03479332e-05, 1.72968461e-05, -3.29272950e-06, 1.79894790e-05, 2.25703766e-05, 1.43417048e-04, 4.85613598e-05, 6.58082591e-05, 2.73069256e-05, 2.96418435e-05, 2.74734587e-05, 6.16649217e-07, 2.82459966e-06, 1.62458287e-03, 9.23306588e-03, -1.49210112e-05, -1.03807924e-05, -7.12380638e-05, -5.99144607e-05, 1.15793550e-06], [ 3.17863321e-05, 2.60330863e-05, 1.84075320e-04, -8.63979917e-05, 2.51107031e-06, -1.70528737e-05, 6.21530510e-06, 2.19931206e-05, 7.79728547e-06, 8.50885150e-05, -2.43202749e-05, 1.23644400e-04, 2.62035329e-05, 3.10757618e-05, 1.21222064e-05, -5.38887944e-04, -4.41341327e-04, -5.52173374e-06, -1.49210112e-05, 2.66648682e-02, -5.89241101e-03, -7.26610115e-05, 8.74880471e-05, 9.44841390e-05], [ 2.03697692e-05, 4.24115971e-05, 5.51990805e-04, 9.32163600e-05, 1.55608226e-05, 2.40744113e-05, -3.70485038e-06, 2.14967914e-05, 2.88024848e-05, 1.81977622e-04, 6.67139369e-05, 8.82475720e-05, 3.68112772e-05, 3.21864690e-05, 3.21848549e-05, -5.33079228e-04, -6.14062993e-04, -1.16718350e-05, -1.03807924e-05, -5.89241101e-03, 1.00973864e-02, -1.11335205e-04, -6.09851728e-05, 6.81793155e-05], [-1.72302577e-05, -9.40969725e-05, -6.45306425e-04, -1.34125044e-04, -1.04416641e-05, 2.73430070e-05, -2.47854784e-05, -3.28689305e-05, -5.80523562e-05, -4.17694584e-04, -1.87098362e-04, -2.54529465e-04, -1.04749672e-04, -2.70370723e-05, -4.72681361e-05, -1.68246301e-04, -1.86037504e-04, -3.97988029e-05, -7.12380638e-05, -7.26610115e-05, -1.11335205e-04, 4.06930124e-04, 2.62120476e-07, -6.83172623e-04], [-4.46217437e-05, -8.90188755e-05, -2.27632501e-03, -5.77157589e-04, -9.88922021e-05, -2.70654840e-04, 8.46863123e-05, -4.94193366e-05, -8.86604925e-05, -4.43230548e-04, -2.21447903e-04, 2.04593146e-05, -4.25532709e-05, -1.07628690e-04, -1.15987854e-04, -3.71053342e-05, -1.25643102e-04, -1.61170775e-05, -5.99144607e-05, 8.74880471e-05, -6.09851728e-05, 2.62120476e-07, 5.58916656e-04, 7.05069917e-04], [-1.14778528e-04, -1.10889517e-05, -2.83279087e-03, -4.54822693e-04, -1.53022044e-04, -4.73028986e-04, 1.79800650e-04, -6.58838301e-05, -4.23678133e-05, -6.55238151e-05, 8.82060711e-05, 2.63778895e-04, 8.55116789e-05, -1.95869238e-04, -1.20446728e-04, 1.50206307e-04, 9.95389333e-05, -2.40213250e-05, 1.15793550e-06, 9.44841390e-05, 6.81793155e-05, -6.83172623e-04, 7.05069917e-04, 2.37494866e-03]]), 'dloglike': 77.99108547650394, 'edm': 0.00022718430097703774, 'errors': array([0.07098773, 0.13898307, 1.50471745, 0.56189498, 0.05573191, 0.18619756, 0.07968542, 0.05940994, 0.11042485, 0.12550039, 0.0614379 , 0.205705 , 0.11165408, 0.0863653 , 0.11979089, 0.09201676, 0.15328911, 0.06247143, 0.09608884, 0.16329381, 0.10048575, 0.02017251, 0.02364142, 0.04873344]), 'fit_quality': 3, 'fit_status': 0, 'fit_success': True, '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]), 'loglike': -77797.48030839092, 'niter': 1, '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'], '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'], 'values': array([ 0.39292551, 1.94186375, 2.24315698, 3.29225318, 0.60718761, 1.21055792, 0.57106955, 0.48166733, 2.36157635, 1.52714858, 2.46752971, 1.26104134, 1.99588998, 0.52557022, 2.27314314, 0.44599164, 2.35206146, 0.57186249, 2.01013752, 1.42542305, 2.03504696, 0.9433182 , -0.01767633, 0.92737063])}
The current state of the ROI can be written at any point by calling write_roi.
gta.write_roi('initial',make_plots=True,save_model_map=True)
2018-03-13 08:49:12 INFO GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/initial_00.xml... 2018-03-13 08:49:12 INFO GTAnalysis.write_fits(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/initial.fits... WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] 2018-03-13 08:49:13 INFO GTBinnedAnalysis.write_model_map(): Generating model map for component 00. 2018-03-13 08:49:15 INFO GTAnalysis.write_roi(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/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:
gta.load_roi('initial')
2018-03-13 08:50:57 INFO GTAnalysis.load_roi(): Loading ROI file: /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/initial.npy 2018-03-13 08:50:58 INFO GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00. 2018-03-13 08:51:16 INFO GTAnalysis.load_roi(): Finished Loading ROI
Using gta.print_model You have an overview of the sources and components present in the ROI.
gta.print_model()
2018-03-13 08:51:26 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 1434.2 3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.0 3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1675.8 3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 269.9 3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.0 3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.5 3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.2 3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 123.7 3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 186.9 3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.2 isodiff --- 1.000 0.0313 2.12 nan 9076.7 galdiff --- 1.000 0.126 0.00 nan 17968.1
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.
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 : nan Npred : 1434.19 Flux : 3.508e-09 +/- nan EnergyFlux : 1.447e-05 +/- nan SpatialModel : SpatialMap SpectrumType : PowerLaw Spectral Parameters Prefactor : 1.059e-11 +/- nan Index : -2.221 +/- nan Scale : 665.5 +/- nan 302.1449479051668 -44.41669737470087 3.50766230419e-09 1434.19374951
Other possible outputs are listed here fermipy/sourcedictionary
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
You can always use gta.print_model() to have a summary of you model.
gta.print_model()
2018-03-12 01:02:47 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- 3FGL J0059.0-7242e 0.088 1.059 3.75e+05 -2.00 nan550368946660.2 3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.0 3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1675.8 3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 269.9 3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.0 3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.5 3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.2 3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 123.7 3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 186.9 3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.2 isodiff --- 1.000 0.0313 2.12 nan 9076.7 galdiff --- 1.000 0.126 0.00 nan 17968.1
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.
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.
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.
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.
Or you can do it while you are running your script with:
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()
2018-03-13 08:54:18 INFO GTAnalysis.delete_source(): Deleting source 3FGL J0059.0-7242e 2018-03-13 08:54:18 INFO GTAnalysis.add_source(): Adding source SMC WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] 2018-03-13 08:54:21 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.000 1.000 2.29e-07 2.40 nan 29.1 * 3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.0 3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1675.8 3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 269.9 3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.0 3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.5 3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.2 3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 123.7 3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 186.9 3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.2 isodiff --- 1.000 0.0313 2.12 nan 9076.7 galdiff --- 1.000 0.126 0.00 nan 17968.1
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()
gta.free_sources()
gta.print_model()
2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Index'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization'] 2018-03-13 08:55:29 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index'] 2018-03-13 08:55:29 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.000 1.000 2.29e-07 2.40 nan 29.1 * 3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.0 * 3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1675.8 * 3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 269.9 * 3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.0 * 3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.5 * 3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.2 * 3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 123.7 * 3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 186.9 * 3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.2 * isodiff --- 1.000 0.0313 2.12 nan 9076.7 * galdiff --- 1.000 0.126 0.00 nan 17968.1 *
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:
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()
2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for isodiff : ['Normalization'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization'] 2018-03-13 08:55:53 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index'] 2018-03-13 08:55:53 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.000 1.000 2.29e-07 2.40 nan 29.1 * 3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.0 * 3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1675.8 * 3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 269.9 3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.0 3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.5 3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.2 3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 123.7 3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 186.9 3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.2 isodiff --- 1.000 0.0313 2.12 nan 9076.7 * galdiff --- 1.000 0.126 0.00 nan 17968.1 *
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.
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)
2018-03-13 08:57:33 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.000 1.000 2.29e-07 2.40 nan 29.1 * 3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.0 * 3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1675.8 * 3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 269.9 3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.0 3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.5 3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.2 3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 123.7 3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 186.9 3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.2 isodiff --- 1.000 0.0313 2.12 nan 9076.7 * galdiff --- 1.000 0.126 0.00 nan 17968.1 * 2018-03-13 08:57:33 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index'] 2018-03-13 08:57:33 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index'] 2018-03-13 08:57:33 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index'] 2018-03-13 08:57:33 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index'] 2018-03-13 08:57:33 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index'] 2018-03-13 08:57:33 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index'] 2018-03-13 08:57:33 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index'] 2018-03-13 08:57:33 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.000 1.000 2.29e-07 2.40 nan 29.1 * 3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.0 * 3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1675.8 * 3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 269.9 * 3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.0 * 3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.5 * 3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.2 * 3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 123.7 * 3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 186.9 * 3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.2 * isodiff --- 1.000 0.0313 2.12 nan 9076.7 * galdiff --- 1.000 0.126 0.00 nan 17968.1 * 2018-03-13 08:57:33 INFO GTAnalysis.fit(): Starting fit. /u/gl/mdimauro/kipac/software/anaconda/lib/python2.7/site-packages/scipy/interpolate/fitpack2.py:226: 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) 2018-03-13 08:57:48 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0 2018-03-13 08:57:48 INFO GTAnalysis.fit(): LogLike: -78036.000 DeltaLogLike: 143.590 2018-03-13 08:57:48 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.000 20.623 1.78e-06 3.16 276.72 384.7 * 3FGL J0112.9-7506 2.572 1.311 2.1e-06 2.02 152.25 144.0 * 3FGL J0023.9-7203 2.662 0.627 9.93e-06 2.72 5150.54 1829.1 * 3FGL J0029.1-7045 3.008 0.479 2.02e-06 2.37 259.37 244.4 * 3FGL J0021.6-6835 5.122 1.738 1.8e-07 3.25 7.93 39.4 * 3FGL J2351.9-7601 5.495 1.373 2.78e-06 2.01 221.06 187.3 * 3FGL J2338.7-7401 5.777 0.544 2.8e-06 1.99 240.57 170.0 * 3FGL J0146.4-6746 6.423 0.486 1.62e-06 2.25 174.99 159.8 * 3FGL J2336.5-7620 6.454 0.402 1.25e-06 2.31 108.23 136.7 * 3FGL J0002.0-6722 7.153 0.361 1.68e-06 1.91 77.30 85.2 * isodiff --- 1.008 0.0316 2.12 1360.62 9145.2 * galdiff --- 0.972 0.124 -0.01 4491.45 17606.1 * 2018-03-13 08:57:48 INFO GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/SMC_firstfit_00.xml... 2018-03-13 08:57:48 INFO GTAnalysis.write_fits(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/SMC_firstfit.fits... 2018-03-13 08:57:50 INFO GTBinnedAnalysis.write_model_map(): Generating model map for component 00. 2018-03-13 08:57:52 INFO GTAnalysis.write_roi(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/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:
print first_fit['fit_quality']
print first_fit['errors']
print first_fit['loglike']
print first_fit['values']
3 [0.06897512 0.14098837 1.32411177 0.62478644 0.05717115 0.18539581 0.07944857 0.05971143 0.11155104 0.21146844 0.11248447 0.0826967 0.12099797 0.08760999 0.15519491 0.0615716 0.09687903 0.1599308 0.10136505 2.49923201 0.1704357 0.02041181 0.02279252 0.04930773] -78035.9995577 [ 3.60516850e-01 1.91219709e+00 1.73806768e+00 3.24769612e+00 6.27231469e-01 1.24052645e+00 5.64444940e-01 4.78933136e-01 2.36532680e+00 1.31093846e+00 2.01633654e+00 4.85554010e-01 2.24771696e+00 4.02307719e-01 2.31324995e+00 5.44326655e-01 1.98899192e+00 1.37263734e+00 2.01250792e+00 2.06230598e+01 -3.15999065e+00 9.72002812e-01 -1.24469681e-02 1.00754268e+00]
print gta.roi.sources[0]['param_names']
print gta.roi.sources[0]['param_values']
print gta.roi.sources[0]['param_errors']
['Prefactor' 'Index' 'Scale' '' '' '' '' '' '' ''] [ 2.06230598e-12 -3.15999065e+00 1.00000000e+03 nan nan nan nan nan nan nan] [2.49923201e-13 1.70435698e-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.
gta.load_roi('initial')
gta.print_model()
2018-03-13 09:00:15 INFO GTAnalysis.load_roi(): Loading ROI file: /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/initial.npy 2018-03-13 09:00:15 INFO GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00. 2018-03-13 09:00:33 INFO GTAnalysis.load_roi(): Finished Loading ROI 2018-03-13 09:00:33 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 1434.2 3FGL J0112.9-7506 2.572 1.172 1.31e-06 2.17 nan 120.0 3FGL J0023.9-7203 2.662 0.714 9.3e-06 2.65 nan 1675.8 3FGL J0029.1-7045 3.008 0.506 2.49e-06 2.28 nan 269.9 3FGL J0021.6-6835 5.122 1.859 5.27e-07 2.65 nan 84.0 3FGL J2351.9-7601 5.495 1.027 3.74e-06 1.69 nan 117.5 3FGL J2338.7-7401 5.777 0.677 4.38e-06 1.89 nan 213.2 3FGL J0146.4-6746 6.423 0.420 1.03e-06 2.39 nan 123.7 3FGL J2336.5-7620 6.454 0.557 1.66e-06 2.33 nan 186.9 3FGL J0002.0-6722 7.153 0.483 2.07e-06 1.95 nan 113.2 isodiff --- 1.000 0.0313 2.12 nan 9076.7 galdiff --- 1.000 0.126 0.00 nan 17968.1
gta.load_roi('SMC_firstfit')
gta.print_model()
2018-03-13 09:00:47 INFO GTAnalysis.load_roi(): Loading ROI file: /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/SMC_firstfit.npy 2018-03-13 09:00:47 INFO GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00. 2018-03-13 09:01:05 INFO GTAnalysis.load_roi(): Finished Loading ROI 2018-03-13 09:01:05 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.000 20.623 1.78e-06 3.16 276.72 384.7 * 3FGL J0112.9-7506 2.572 1.311 2.1e-06 2.02 152.25 144.0 * 3FGL J0023.9-7203 2.662 0.627 9.93e-06 2.72 5150.54 1829.1 * 3FGL J0029.1-7045 3.008 0.479 2.02e-06 2.37 259.37 244.4 * 3FGL J0021.6-6835 5.122 1.738 1.8e-07 3.25 7.93 39.4 * 3FGL J2351.9-7601 5.495 1.373 2.78e-06 2.01 221.06 187.3 * 3FGL J2338.7-7401 5.777 0.544 2.8e-06 1.99 240.57 170.0 * 3FGL J0146.4-6746 6.423 0.486 1.62e-06 2.25 174.99 159.8 * 3FGL J2336.5-7620 6.454 0.402 1.25e-06 2.31 108.23 136.7 * 3FGL J0002.0-6722 7.153 0.361 1.68e-06 1.91 77.30 85.2 * galdiff --- 0.972 0.124 -0.01 4491.45 17606.1 * isodiff --- 1.008 0.0316 2.12 1360.62 9145.2 *
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:
TS Cube is a related method that can also be used to generate TS maps as well as cubes (TS vs. position and energy).
tsmap_postfit = gta.tsmap(prefix='TSmap_start',make_plots=True,write_fits=True,write_npy=True)
2018-03-13 09:02:00 INFO GTAnalysis.tsmap(): Generating TS map 2018-03-13 09:02:02 INFO GTAnalysis._make_tsmap_fast(): Fitting test source. 2018-03-13 09:02:26 INFO GTAnalysis.tsmap(): Finished TS map 2018-03-13 09:02:26 INFO GTAnalysis.tsmap(): Execution time: 26.63 s
%matplotlib inline
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')
Text(0.5,1,u'NPred')
Looking to the TSmap it is quite clear that the model does not fit sufficiently well the data.
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.
resid = gta.residmap('SMC_postfit',model={'SpatialModel' : 'PointSource', 'Index' : 2.0},write_fits=True,write_npy=True,make_plots=True)
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')
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')
2018-03-13 09:05:01 INFO GTAnalysis.residmap(): Generating residual maps 2018-03-13 09:05:01 INFO GTAnalysis.add_source(): Adding source residmap_testsource 2018-03-13 09:05:04 INFO GTAnalysis.delete_source(): Deleting source residmap_testsource 2018-03-13 09:05:08 INFO GTAnalysis.residmap(): Finished residual maps 2018-03-13 09:05:08 INFO GTAnalysis.residmap(): Execution time: 7.04 s
Text(0.5,1,u'Excess')
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.
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()
2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Fixing parameters for isodiff : ['Normalization'] 2018-03-13 09:06:52 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.000 20.623 1.78e-06 3.16 276.72 384.7 3FGL J0112.9-7506 2.572 1.311 2.1e-06 2.02 152.25 144.0 3FGL J0023.9-7203 2.662 0.627 9.93e-06 2.72 5150.54 1829.1 3FGL J0029.1-7045 3.008 0.479 2.02e-06 2.37 259.37 244.4 3FGL J0021.6-6835 5.122 1.738 1.8e-07 3.25 7.93 39.4 3FGL J2351.9-7601 5.495 1.373 2.78e-06 2.01 221.06 187.3 3FGL J2338.7-7401 5.777 0.544 2.8e-06 1.99 240.57 170.0 3FGL J0146.4-6746 6.423 0.486 1.62e-06 2.25 174.99 159.8 3FGL J2336.5-7620 6.454 0.402 1.25e-06 2.31 108.23 136.7 3FGL J0002.0-6722 7.153 0.361 1.68e-06 1.91 77.30 85.2 galdiff --- 0.972 0.124 -0.01 4491.45 17606.1 isodiff --- 1.008 0.0316 2.12 1360.62 9145.2 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index'] 2018-03-13 09:06:52 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization'] 2018-03-13 09:06:52 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.000 20.623 1.78e-06 3.16 276.72 384.7 * 3FGL J0112.9-7506 2.572 1.311 2.1e-06 2.02 152.25 144.0 * 3FGL J0023.9-7203 2.662 0.627 9.93e-06 2.72 5150.54 1829.1 * 3FGL J0029.1-7045 3.008 0.479 2.02e-06 2.37 259.37 244.4 3FGL J0021.6-6835 5.122 1.738 1.8e-07 3.25 7.93 39.4 3FGL J2351.9-7601 5.495 1.373 2.78e-06 2.01 221.06 187.3 3FGL J2338.7-7401 5.777 0.544 2.8e-06 1.99 240.57 170.0 3FGL J0146.4-6746 6.423 0.486 1.62e-06 2.25 174.99 159.8 3FGL J2336.5-7620 6.454 0.402 1.25e-06 2.31 108.23 136.7 3FGL J0002.0-6722 7.153 0.361 1.68e-06 1.91 77.30 85.2 galdiff --- 0.972 0.124 -0.01 4491.45 17606.1 * isodiff --- 1.008 0.0316 2.12 1360.62 9145.2 * 2018-03-13 09:06:52 INFO GTAnalysis.localize(): Running localization for SMC WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] 2018-03-13 09:07:38 INFO GTAnalysis._localize(): Localization succeeded. 2018-03-13 09:07:38 INFO GTAnalysis._localize(): Updating source SMC to localized position. 2018-03-13 09:07:38 INFO GTAnalysis.delete_source(): Deleting source SMC 2018-03-13 09:07:38 INFO GTAnalysis.add_source(): Adding source SMC 2018-03-13 09:08:04 INFO GTAnalysis._localize(): Localization completed with new position: ( ra, dec) = ( 14.4499 +/- 0.0735, -72.6676 +/- 0.0683) (glon,glat) = ( 302.2682 +/- 0.0753, -44.4524 +/- 0.0663) offset = 0.0835 r68 = 0.0853 r95 = 0.1376 r99 = 0.1707 2018-03-13 09:08:04 INFO GTAnalysis._localize(): LogLike: -78032.740 DeltaLogLike: 3.259 2018-03-13 09:08:04 INFO GTAnalysis.localize(): Finished localization. 2018-03-13 09:08:10 INFO GTAnalysis.localize(): Execution time: 78.06 s 2018-03-13 09:08:10 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.083 20.950 1.77e-06 3.18 288.19 386.8 * 3FGL J0112.9-7506 2.572 1.311 2.1e-06 2.02 152.25 144.0 * 3FGL J0023.9-7203 2.662 0.627 9.93e-06 2.72 5150.54 1829.1 * 3FGL J0029.1-7045 3.008 0.479 2.02e-06 2.37 259.37 244.4 3FGL J0021.6-6835 5.122 1.738 1.8e-07 3.25 7.93 39.4 3FGL J2351.9-7601 5.495 1.373 2.78e-06 2.01 221.06 187.3 3FGL J2338.7-7401 5.777 0.544 2.8e-06 1.99 240.57 170.0 3FGL J0146.4-6746 6.423 0.486 1.62e-06 2.25 174.99 159.8 3FGL J2336.5-7620 6.454 0.402 1.25e-06 2.31 108.23 136.7 3FGL J0002.0-6722 7.153 0.361 1.68e-06 1.91 77.30 85.2 galdiff --- 0.972 0.124 -0.01 4491.45 17606.1 * isodiff --- 1.008 0.0316 2.12 1360.62 9145.2 *
The SMC is relocalized at 0.07deg.
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.268226533 -44.4524360596 0.08528579471406204 0.13763414643974695 0.17066426620183411 0.09458478815924073 0.03343522651941691 3.25905231918
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.
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()
2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Prefactor', 'Index'] 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index'] 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta'] 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Prefactor', 'Index'] 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Fixing parameters for isodiff : ['Normalization'] 2018-03-13 09:10:34 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.083 20.950 1.77e-06 3.18 288.19 386.8 3FGL J0112.9-7506 2.572 1.311 2.1e-06 2.02 152.25 144.0 3FGL J0023.9-7203 2.662 0.627 9.93e-06 2.72 5150.54 1829.1 3FGL J0029.1-7045 3.008 0.479 2.02e-06 2.37 259.37 244.4 3FGL J0021.6-6835 5.122 1.738 1.8e-07 3.25 7.93 39.4 3FGL J2351.9-7601 5.495 1.373 2.78e-06 2.01 221.06 187.3 3FGL J2338.7-7401 5.777 0.544 2.8e-06 1.99 240.57 170.0 3FGL J0146.4-6746 6.423 0.486 1.62e-06 2.25 174.99 159.8 3FGL J2336.5-7620 6.454 0.402 1.25e-06 2.31 108.23 136.7 3FGL J0002.0-6722 7.153 0.361 1.68e-06 1.91 77.30 85.2 galdiff --- 0.972 0.124 -0.01 4491.45 17606.1 isodiff --- 1.008 0.0316 2.12 1360.62 9145.2 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Prefactor', 'Index'] 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta'] 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index'] 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index'] 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index'] 2018-03-13 09:10:34 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization'] 2018-03-13 09:10:34 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.083 20.950 1.77e-06 3.18 288.19 386.8 * 3FGL J0112.9-7506 2.572 1.311 2.1e-06 2.02 152.25 144.0 * 3FGL J0023.9-7203 2.662 0.627 9.93e-06 2.72 5150.54 1829.1 * 3FGL J0029.1-7045 3.008 0.479 2.02e-06 2.37 259.37 244.4 * 3FGL J0021.6-6835 5.122 1.738 1.8e-07 3.25 7.93 39.4 3FGL J2351.9-7601 5.495 1.373 2.78e-06 2.01 221.06 187.3 3FGL J2338.7-7401 5.777 0.544 2.8e-06 1.99 240.57 170.0 3FGL J0146.4-6746 6.423 0.486 1.62e-06 2.25 174.99 159.8 3FGL J2336.5-7620 6.454 0.402 1.25e-06 2.31 108.23 136.7 3FGL J0002.0-6722 7.153 0.361 1.68e-06 1.91 77.30 85.2 galdiff --- 0.972 0.124 -0.01 4491.45 17606.1 * isodiff --- 1.008 0.0316 2.12 1360.62 9145.2 * 2018-03-13 09:10:34 INFO GTAnalysis.extension(): Running extension fit for SMC 2018-03-13 09:10:53 INFO GTAnalysis._extension(): Fitting extended-source model. 2018-03-13 09:11:07 INFO GTAnalysis._extension(): Generating TS map. 2018-03-13 09:11:52 INFO GTAnalysis._extension(): Testing point-source model. 2018-03-13 09:12:26 INFO GTAnalysis._extension(): Best-fit extension: 1.1948 + 0.0606 - 0.0592 2018-03-13 09:12:26 INFO GTAnalysis._extension(): TS_ext: 439.901 2018-03-13 09:12:26 INFO GTAnalysis._extension(): Extension UL: 1.2968 2018-03-13 09:12:26 INFO GTAnalysis._extension(): LogLike: -77813.055 DeltaLogLike: 219.686 2018-03-13 09:12:26 INFO GTAnalysis.extension(): Finished extension fit. /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy/fermipy/plotting.py:1439: RuntimeWarning: invalid value encountered in greater m = ext['ebin_ts_ext'] > 4.0 /u/gl/mdimauro/kipac/software/anaconda/lib/python2.7/site-packages/matplotlib/scale.py:111: RuntimeWarning: invalid value encountered in less_equal out[a <= 0] = -1000 2018-03-13 09:12:34 INFO GTAnalysis.extension(): Execution time: 120.03 s 2018-03-13 09:12:34 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.083 47.779 9.68e-06 2.47 727.57 1323.9 * 3FGL J0112.9-7506 2.572 1.311 2.1e-06 2.02 152.25 144.0 * 3FGL J0023.9-7203 2.662 0.627 9.93e-06 2.72 5150.54 1829.1 * 3FGL J0029.1-7045 3.008 0.479 2.02e-06 2.37 259.37 244.4 * 3FGL J0021.6-6835 5.122 1.738 1.8e-07 3.25 7.93 39.4 3FGL J2351.9-7601 5.495 1.373 2.78e-06 2.01 221.06 187.3 3FGL J2338.7-7401 5.777 0.544 2.8e-06 1.99 240.57 170.0 3FGL J0146.4-6746 6.423 0.486 1.62e-06 2.25 174.99 159.8 3FGL J2336.5-7620 6.454 0.402 1.25e-06 2.31 108.23 136.7 3FGL J0002.0-6722 7.153 0.361 1.68e-06 1.91 77.30 85.2 galdiff --- 0.972 0.124 -0.01 4491.45 17606.1 * isodiff --- 1.008 0.0316 2.12 1360.62 9145.2 *
In this specific case SMC is found to be extended with TSext=371 and with an angular extension of 1.19\pm0.07deg.
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.19481832399 0.06058810038300022 0.05922762264108816 0.05990786151204419 1.19481832399 1.2967768993 439.900505393
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:
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.
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')
2018-03-13 09:14:13 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index'] 2018-03-13 09:14:13 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index'] 2018-03-13 09:14:13 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index'] 2018-03-13 09:14:13 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index'] 2018-03-13 09:14:13 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index'] 2018-03-13 09:14:13 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index'] 2018-03-13 09:14:13 INFO GTAnalysis.find_sources(): Starting. 2018-03-13 09:14:13 INFO GTAnalysis.tsmap(): Generating TS map 2018-03-13 09:14:36 INFO GTAnalysis._make_tsmap_fast(): Fitting test source. 2018-03-13 09:14:57 INFO GTAnalysis.tsmap(): Finished TS map 2018-03-13 09:15:00 INFO GTAnalysis.tsmap(): Execution time: 46.53 s 2018-03-13 09:15:00 INFO GTAnalysis._build_src_dicts_from_peaks(): Found source name: PS J0000.6-7353 ts: 44.720868 2018-03-13 09:15:00 INFO GTAnalysis._build_src_dicts_from_peaks(): Found source name: PS J0040.7-7158 ts: 42.125491 2018-03-13 09:15:00 INFO GTAnalysis.add_source(): Adding source PS J0000.6-7353 2018-03-13 09:15:23 INFO GTAnalysis.free_source(): Fixing parameters for PS J0000.6-7353 : ['Prefactor'] 2018-03-13 09:15:23 INFO GTAnalysis.add_source(): Adding source PS J0040.7-7158 2018-03-13 09:15:44 INFO GTAnalysis.free_source(): Fixing parameters for PS J0040.7-7158 : ['Prefactor'] 2018-03-13 09:15:44 INFO GTAnalysis._find_sources_iterate(): Performing spectral fit for PS J0000.6-7353. 2018-03-13 09:15:44 INFO GTAnalysis.free_source(): Freeing parameters for PS J0000.6-7353 : ['Prefactor', 'Index'] 2018-03-13 09:15:44 INFO GTAnalysis.fit(): Starting fit. 2018-03-13 09:16:03 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0 2018-03-13 09:16:03 INFO GTAnalysis.fit(): LogLike: -77744.736 DeltaLogLike: 22.995 2018-03-13 09:16:03 INFO GTAnalysis._find_sources_iterate(): {'Index': {'error': 0.184642555571382, 'value': -2.1660178032796793}, 'Prefactor': {'error': 6.843783415525688e-14, 'value': 2.1361559145568064e-13}, 'Scale': {'error': nan, 'value': 1000.0}} 2018-03-13 09:16:03 INFO GTAnalysis.free_source(): Fixing parameters for PS J0000.6-7353 : ['Prefactor', 'Index'] 2018-03-13 09:16:03 INFO GTAnalysis._find_sources_iterate(): Performing spectral fit for PS J0040.7-7158. 2018-03-13 09:16:03 INFO GTAnalysis.free_source(): Freeing parameters for PS J0040.7-7158 : ['Prefactor', 'Index'] 2018-03-13 09:16:03 INFO GTAnalysis.fit(): Starting fit. 2018-03-13 09:16:22 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0 2018-03-13 09:16:22 INFO GTAnalysis.fit(): LogLike: -77743.932 DeltaLogLike: 0.805 2018-03-13 09:16:22 INFO GTAnalysis._find_sources_iterate(): {'Index': {'error': 0.19170865613130725, 'value': -2.238433246474525}, 'Prefactor': {'error': 8.011028793195936e-14, 'value': 2.6215126267762433e-13}, 'Scale': {'error': nan, 'value': 1000.0}} 2018-03-13 09:16:22 INFO GTAnalysis.free_source(): Fixing parameters for PS J0040.7-7158 : ['Prefactor', 'Index'] 2018-03-13 09:16:22 INFO GTAnalysis.find_sources(): Found 2 sources in iteration 0. 2018-03-13 09:16:22 INFO GTAnalysis.tsmap(): Generating TS map 2018-03-13 09:16:44 INFO GTAnalysis._make_tsmap_fast(): Fitting test source. 2018-03-13 09:17:05 INFO GTAnalysis.tsmap(): Finished TS map 2018-03-13 09:17:08 INFO GTAnalysis.tsmap(): Execution time: 46.20 s 2018-03-13 09:17:09 INFO GTAnalysis._build_src_dicts_from_peaks(): Found source name: PS J0103.0-7052 ts: 26.876002 2018-03-13 09:17:09 INFO GTAnalysis._build_src_dicts_from_peaks(): Found source name: PS J0046.3-7048 ts: 25.508696 2018-03-13 09:17:09 INFO GTAnalysis.add_source(): Adding source PS J0103.0-7052 2018-03-13 09:17:31 INFO GTAnalysis.free_source(): Fixing parameters for PS J0103.0-7052 : ['Prefactor'] 2018-03-13 09:17:31 INFO GTAnalysis.add_source(): Adding source PS J0046.3-7048 2018-03-13 09:17:53 INFO GTAnalysis.free_source(): Fixing parameters for PS J0046.3-7048 : ['Prefactor'] 2018-03-13 09:17:53 INFO GTAnalysis._find_sources_iterate(): Performing spectral fit for PS J0103.0-7052. 2018-03-13 09:17:53 INFO GTAnalysis.free_source(): Freeing parameters for PS J0103.0-7052 : ['Prefactor', 'Index'] 2018-03-13 09:17:53 INFO GTAnalysis.fit(): Starting fit. 2018-03-13 09:18:12 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0 2018-03-13 09:18:12 INFO GTAnalysis.fit(): LogLike: -77712.184 DeltaLogLike: 4.474 2018-03-13 09:18:12 INFO GTAnalysis._find_sources_iterate(): {'Index': {'error': 0.27417400739407566, 'value': -2.7124639590250013}, 'Prefactor': {'error': 1.0309671512023029e-13, 'value': 3.520441598515751e-13}, 'Scale': {'error': nan, 'value': 1000.0}} 2018-03-13 09:18:12 INFO GTAnalysis.free_source(): Fixing parameters for PS J0103.0-7052 : ['Prefactor', 'Index'] 2018-03-13 09:18:12 INFO GTAnalysis._find_sources_iterate(): Performing spectral fit for PS J0046.3-7048. 2018-03-13 09:18:12 INFO GTAnalysis.free_source(): Freeing parameters for PS J0046.3-7048 : ['Prefactor', 'Index'] 2018-03-13 09:18:12 INFO GTAnalysis.fit(): Starting fit. 2018-03-13 09:18:31 INFO GTAnalysis.fit(): Fit returned successfully. Quality: 3 Status: 0 2018-03-13 09:18:31 INFO GTAnalysis.fit(): LogLike: -77712.132 DeltaLogLike: 0.052 2018-03-13 09:18:31 INFO GTAnalysis._find_sources_iterate(): {'Index': {'error': 0.21711986634268787, 'value': -1.9855444452158932}, 'Prefactor': {'error': 4.587648680868577e-14, 'value': 9.997463097614407e-14}, 'Scale': {'error': nan, 'value': 1000.0}} 2018-03-13 09:18:31 INFO GTAnalysis.free_source(): Fixing parameters for PS J0046.3-7048 : ['Prefactor', 'Index'] 2018-03-13 09:18:31 INFO GTAnalysis.find_sources(): Found 2 sources in iteration 1. 2018-03-13 09:18:31 INFO GTAnalysis.tsmap(): Generating TS map 2018-03-13 09:18:56 INFO GTAnalysis._make_tsmap_fast(): Fitting test source. 2018-03-13 09:19:18 INFO GTAnalysis.tsmap(): Finished TS map 2018-03-13 09:19:20 INFO GTAnalysis.tsmap(): Execution time: 49.83 s 2018-03-13 09:19:20 INFO GTAnalysis.find_sources(): Found 0 sources in iteration 2. 2018-03-13 09:19:20 INFO GTAnalysis.find_sources(): Done. 2018-03-13 09:19:20 INFO GTAnalysis.find_sources(): Execution time: 307.02 s
gta.print_model()
gta.write_roi('SMC_relext_TS25',make_plots=True,save_model_map=True)
2018-03-13 09:20:42 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.083 47.942 9.77e-06 2.46 698.09 1331.1 * PS J0040.7-7158 1.523 2.622 8.5e-07 2.24 48.32 86.4 PS J0103.0-7052 1.912 3.520 4.88e-07 2.71 36.24 82.7 PS J0046.3-7048 2.137 1.000 6.5e-07 1.99 27.36 41.6 3FGL J0112.9-7506 2.572 1.322 2.14e-06 2.01 157.80 145.4 * 3FGL J0023.9-7203 2.662 0.602 9.81e-06 2.70 5132.30 1795.5 * 3FGL J0029.1-7045 3.008 0.477 2.05e-06 2.36 267.02 244.7 * PS J0000.6-7353 4.263 2.136 8.28e-07 2.17 53.69 74.6 3FGL J0021.6-6835 5.122 2.285 2.2e-07 3.30 11.97 49.0 * 3FGL J2351.9-7601 5.495 1.426 2.82e-06 2.03 236.66 197.5 * 3FGL J2338.7-7401 5.777 0.566 2.83e-06 2.00 255.23 176.9 * 3FGL J0146.4-6746 6.423 0.528 1.65e-06 2.27 191.87 170.0 * 3FGL J2336.5-7620 6.454 0.445 1.28e-06 2.35 119.29 147.2 * 3FGL J0002.0-6722 7.153 0.395 1.7e-06 1.94 86.65 92.5 * galdiff --- 0.947 0.122 -0.02 5149.26 17203.7 * isodiff --- 0.914 0.0286 2.12 1182.94 8292.9 * 2018-03-13 09:20:42 INFO GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/SMC_relext_TS25_00.xml... 2018-03-13 09:20:43 INFO GTAnalysis.write_fits(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/SMC_relext_TS25.fits... 2018-03-13 09:20:52 INFO GTBinnedAnalysis.write_model_map(): Generating model map for component 00. 2018-03-13 09:20:59 INFO GTAnalysis.write_roi(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/SMC_relext_TS25.npy...
tsmap_postfit = gta.tsmap(prefix='TSmap_relext_TS25',make_plots=True,write_fits=True,write_npy=True)
2018-03-13 09:21:16 INFO GTAnalysis.tsmap(): Generating TS map 2018-03-13 09:21:43 INFO GTAnalysis._make_tsmap_fast(): Fitting test source. 2018-03-13 09:22:09 INFO GTAnalysis.tsmap(): Finished TS map 2018-03-13 09:22:13 INFO GTAnalysis.tsmap(): Execution time: 56.80 s
fig = plt.figure(figsize=(14,6))
ROIPlotter(tsmap_postfit['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_postfit['npred'],roi=gta.roi).plot(vmin=0,vmax=100,subplot=122,cmap='magma')
plt.gca().set_title('NPred')
Text(0.5,1,u'NPred')
resid = gta.residmap('TSmap_relext_TS26',model={'SpatialModel' : 'PointSource', 'Index' : 2.0},write_fits=True,write_npy=True,make_plots=True)
2018-03-12 01:20:51 INFO GTAnalysis.residmap(): Generating residual maps 2018-03-12 01:20:51 INFO GTAnalysis.add_source(): Adding source residmap_testsource 2018-03-12 01:20:54 INFO GTAnalysis.delete_source(): Deleting source residmap_testsource 2018-03-12 01:20:59 INFO GTAnalysis.residmap(): Finished residual maps 2018-03-12 01:20:59 INFO GTAnalysis.residmap(): Execution time: 7.56 s
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')
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')
Text(0.5,1,u'Excess')
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.
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)
2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0021.6-6835 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2351.9-7601 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2338.7-7401 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0146.4-6746 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J2336.5-7620 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0002.0-6722 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Fixing parameters for isodiff : ['Normalization'] 2018-03-13 09:22:31 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.083 47.942 9.77e-06 2.46 698.09 1331.1 PS J0040.7-7158 1.523 2.622 8.5e-07 2.24 48.32 86.4 PS J0103.0-7052 1.912 3.520 4.88e-07 2.71 36.24 82.7 PS J0046.3-7048 2.137 1.000 6.5e-07 1.99 27.36 41.6 3FGL J0112.9-7506 2.572 1.322 2.14e-06 2.01 157.80 145.4 3FGL J0023.9-7203 2.662 0.602 9.81e-06 2.70 5132.30 1795.5 3FGL J0029.1-7045 3.008 0.477 2.05e-06 2.36 267.02 244.7 PS J0000.6-7353 4.263 2.136 8.28e-07 2.17 53.69 74.6 3FGL J0021.6-6835 5.122 2.285 2.2e-07 3.30 11.97 49.0 3FGL J2351.9-7601 5.495 1.426 2.82e-06 2.03 236.66 197.5 3FGL J2338.7-7401 5.777 0.566 2.83e-06 2.00 255.23 176.9 3FGL J0146.4-6746 6.423 0.528 1.65e-06 2.27 191.87 170.0 3FGL J2336.5-7620 6.454 0.445 1.28e-06 2.35 119.29 147.2 3FGL J0002.0-6722 7.153 0.395 1.7e-06 1.94 86.65 92.5 galdiff --- 0.947 0.122 -0.02 5149.26 17203.7 isodiff --- 0.914 0.0286 2.12 1182.94 8292.9 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Freeing parameters for SMC : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Freeing parameters for PS J0040.7-7158 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Freeing parameters for PS J0103.0-7052 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Freeing parameters for PS J0046.3-7048 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203 : ['norm', 'alpha', 'beta'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045 : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Freeing parameters for galdiff : ['Prefactor', 'Index'] 2018-03-13 09:22:31 INFO GTAnalysis.free_source(): Freeing parameters for isodiff : ['Normalization'] 2018-03-13 09:22:31 INFO GTAnalysis.print_model(): sourcename offset norm eflux index ts npred free -------------------------------------------------------------------------------- SMC 0.083 47.942 9.77e-06 2.46 698.09 1331.1 * PS J0040.7-7158 1.523 2.622 8.5e-07 2.24 48.32 86.4 * PS J0103.0-7052 1.912 3.520 4.88e-07 2.71 36.24 82.7 * PS J0046.3-7048 2.137 1.000 6.5e-07 1.99 27.36 41.6 * 3FGL J0112.9-7506 2.572 1.322 2.14e-06 2.01 157.80 145.4 * 3FGL J0023.9-7203 2.662 0.602 9.81e-06 2.70 5132.30 1795.5 * 3FGL J0029.1-7045 3.008 0.477 2.05e-06 2.36 267.02 244.7 * PS J0000.6-7353 4.263 2.136 8.28e-07 2.17 53.69 74.6 3FGL J0021.6-6835 5.122 2.285 2.2e-07 3.30 11.97 49.0 3FGL J2351.9-7601 5.495 1.426 2.82e-06 2.03 236.66 197.5 3FGL J2338.7-7401 5.777 0.566 2.83e-06 2.00 255.23 176.9 3FGL J0146.4-6746 6.423 0.528 1.65e-06 2.27 191.87 170.0 3FGL J2336.5-7620 6.454 0.445 1.28e-06 2.35 119.29 147.2 3FGL J0002.0-6722 7.153 0.395 1.7e-06 1.94 86.65 92.5 galdiff --- 0.947 0.122 -0.02 5149.26 17203.7 * isodiff --- 0.914 0.0286 2.12 1182.94 8292.9 * 2018-03-13 09:22:31 INFO GTAnalysis.sed(): Computing SED for SMC 2018-03-13 09:22:33 INFO GTAnalysis._make_sed(): Fitting SED 2018-03-13 09:22:33 INFO GTAnalysis.free_source(): Fixing parameters for SMC : ['Index'] 2018-03-13 09:22:33 INFO GTAnalysis.free_source(): Fixing parameters for PS J0040.7-7158 : ['Index'] 2018-03-13 09:22:33 INFO GTAnalysis.free_source(): Fixing parameters for PS J0103.0-7052 : ['Index'] 2018-03-13 09:22:33 INFO GTAnalysis.free_source(): Fixing parameters for PS J0046.3-7048 : ['Index'] 2018-03-13 09:22:33 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506 : ['Index'] 2018-03-13 09:22:33 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203 : ['alpha', 'beta'] 2018-03-13 09:22:33 INFO GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045 : ['Index'] 2018-03-13 09:22:33 INFO GTAnalysis.free_source(): Fixing parameters for galdiff : ['Index'] 2018-03-13 09:22:38 INFO GTAnalysis.sed(): Finished SED 2018-03-13 09:22:44 INFO GTAnalysis.sed(): Execution time: 12.54 s
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] [1.02016476e-09 7.86846549e-10 4.73163986e-10 3.26288567e-10 1.97347624e-10 1.82338234e-10 1.17613474e-10 5.91452927e-11 4.61522831e-11 3.93363181e-11 4.13944563e-12 1.08267301e-11 7.83815348e-18 1.70283486e-15 1.57203824e-12 5.37361758e-12 1.48993626e-18 3.56483391e-12 7.98415926e-16 4.31703221e-19 1.72970813e-17 1.89489559e-19] [1.16947343e-06 1.19643770e-06 9.54314947e-07 8.72894789e-07 7.00280361e-07 8.58218333e-07 7.34272259e-07 4.89779078e-07 5.06936117e-07 5.73104411e-07 7.99957469e-08 2.77528351e-07 2.66504046e-13 7.67967033e-11 9.40401147e-08 4.26379975e-07 1.56811437e-13 4.97656115e-07 1.47842479e-10 1.06031605e-13 5.63511615e-12 8.18832984e-14] [4.13945472e-06 4.23489712e-06 3.37788221e-06 3.08968836e-06 2.47870431e-06 3.03773974e-06 2.59902165e-06 1.73361639e-06 1.79434525e-06 2.02855378e-06 2.83128941e-07 9.82336161e-07 9.43314659e-13 2.71828728e-10 3.32863309e-07 1.50920966e-06 5.55047959e-13 1.76149786e-06 5.23301538e-10 3.75308248e-13 1.99459923e-11 2.89833182e-13] [3.57457727e-12 2.09102337e-12 9.85639032e-13 5.24992593e-13 2.53393928e-13 1.73647623e-13 8.92539135e-14 3.93073862e-14 2.44782154e-14 1.57265044e-14 3.81202464e-15 3.92282994e-15 5.60883997e-16 3.57101727e-16 5.95546547e-16 6.88376240e-16 1.03712119e-16 2.79118964e-16 1.06075696e-16 4.44878898e-17 4.19337458e-17 2.61133133e-17] [190.89735344 187.18546457 111.19498372 89.01072571 50.8739082 62.22808002 39.34301312 14.64073365 10.75652728 11.70868956 0.22255517 1.73442852 0. 0. 0.19260381 2.48134577 0. 2.98256995 0. 0. 0. 0. ]
# 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.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')
[4.71409425e-06 4.85128874e-06 4.02094136e-06 3.77214791e-06 3.20198520e-06 3.86513404e-06 3.49981956e-06 2.70842598e-06 2.95706031e-06 3.34772891e-06 1.43144178e-06 2.57908864e-06 6.49215943e-07 7.27163568e-07 2.14463923e-06 4.34605770e-06 1.15856263e-06 5.49327998e-06 3.63567505e-06 2.70878298e-06 4.45468680e-06 4.92143383e-06]
<matplotlib.lines.Line2D at 0x7f76af404bd0>
fig = plt.figure(figsize=(14,4))
ylim=[1E-7,1E-5]
fig.add_subplot(121)
SEDPlotter(sedsmc).plot()
plt.gca().set_ylim(ylim)
fig = plt.figure(figsize=(14,4))
fig.add_subplot(121)
SEDPlotter(sedsmc).plot(showlnl=True,ylim=ylim)
plt.gca().set_ylim(ylim)
(1e-07, 1e-05)
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.
lc = gta.lightcurve('SMC', free_radius=3.0, nbins=8, multithread=True, nthread=8, use_scaled_srcmap=True)
2018-03-06 09:59:28 INFO GTAnalysis.lightcurve(): Computing Lightcurve for SMC WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs] WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs] WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs] WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs] WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs] WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs] WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs] WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs] 2018-03-06 09:59:31 INFO lightcurve_273737042_307916667 GTAnalysis._process_lc_bin(): Fitting time range 273737042 307916667 2018-03-06 09:59:31 INFO lightcurve_239557417_273737042 GTAnalysis._process_lc_bin(): Fitting time range 239557417 273737042 2018-03-06 09:59:31 INFO lightcurve_307916667_342096292 GTAnalysis._process_lc_bin(): Fitting time range 307916667 342096292 2018-03-06 09:59:31 INFO lightcurve_376275917_410455542 GTAnalysis._process_lc_bin(): Fitting time range 376275917 410455542 2018-03-06 09:59:32 INFO lightcurve_410455542_444635167 GTAnalysis._process_lc_bin(): Fitting time range 410455542 444635167 2018-03-06 09:59:32 INFO lightcurve_342096292_376275917 GTAnalysis._process_lc_bin(): Fitting time range 342096292 376275917 2018-03-06 09:59:32 INFO lightcurve_444635167_478814792 GTAnalysis._process_lc_bin(): Fitting time range 444635167 478814792 2018-03-06 09:59:32 INFO lightcurve_478814792_512994417 GTAnalysis._process_lc_bin(): Fitting time range 478814792 512994417 2018-03-06 09:59:35 INFO lightcurve_376275917_410455542 GTBinnedAnalysis._create_ltcube(): Generating local LT cube. 2018-03-06 09:59:35 INFO lightcurve_273737042_307916667 GTBinnedAnalysis._create_ltcube(): Generating local LT cube. 2018-03-06 09:59:35 INFO lightcurve_307916667_342096292 GTBinnedAnalysis._create_ltcube(): Generating local LT cube. 2018-03-06 09:59:35 INFO lightcurve_444635167_478814792 GTBinnedAnalysis._create_ltcube(): Generating local LT cube. 2018-03-06 09:59:35 INFO lightcurve_239557417_273737042 GTBinnedAnalysis._create_ltcube(): Generating local LT cube. 2018-03-06 09:59:35 INFO lightcurve_410455542_444635167 GTBinnedAnalysis._create_ltcube(): Generating local LT cube. 2018-03-06 09:59:36 INFO lightcurve_478814792_512994417 GTBinnedAnalysis._create_ltcube(): Generating local LT cube. 2018-03-06 09:59:36 INFO lightcurve_342096292_376275917 GTBinnedAnalysis._create_ltcube(): Generating local LT cube. WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: FITSFixedWarning: 'datfix' made the change 'Invalid parameter value: invalid date ' ''. [astropy.wcs.wcs] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: FITSFixedWarning: 'datfix' made the change 'Invalid parameter value: invalid date ' ''. [astropy.wcs.wcs] WARNING: FITSFixedWarning: 'datfix' made the change 'Invalid parameter value: invalid date ' ''. [astropy.wcs.wcs] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: FITSFixedWarning: 'datfix' made the change 'Invalid parameter value: invalid date ' ''. [astropy.wcs.wcs] WARNING: FITSFixedWarning: 'datfix' made the change 'Invalid parameter value: invalid date ' ''. [astropy.wcs.wcs] WARNING: FITSFixedWarning: 'datfix' made the change 'Invalid parameter value: invalid date ' ''. [astropy.wcs.wcs] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: FITSFixedWarning: 'datfix' made the change 'Invalid parameter value: invalid date ' ''. [astropy.wcs.wcs] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: FITSFixedWarning: 'datfix' made the change 'Invalid parameter value: invalid date ' ''. [astropy.wcs.wcs] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 2.0 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators] 2018-03-06 10:06:15 INFO lightcurve_307916667_342096292 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_307916667_342096292/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045']
2018-03-06 10:06:24 INFO lightcurve_478814792_512994417 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_478814792_512994417/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045'] Fitting shape 3FGL J0023.9-7203 TS: 650.747 Fitting shape 3FGL J2338.7-7401 TS: 139.308 Fitting shape SMC TS: 97.090 Fitting shape 3FGL J2336.5-7620 TS: 35.448
2018-03-06 10:06:34 INFO lightcurve_342096292_376275917 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_342096292_376275917/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045'] Fitting shape 3FGL J0029.1-7045 TS: 31.645 Fitting shape 3FGL J0146.4-6746 TS: 24.834 Fitting shape 3FGL J0112.9-7506 TS: 16.003 Fitting shape 3FGL J0023.9-7203 TS: 774.271 Fitting shape SMC TS: 107.830 Fitting shape 3FGL J0112.9-7506 TS: 55.524 Fitting shape 3FGL J2351.9-7601 TS: 36.849 Fitting shape 3FGL J2338.7-7401 TS: 24.165
2018-03-06 10:06:44 INFO lightcurve_444635167_478814792 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_444635167_478814792/base_00.xml...
Fitting shape 3FGL J2336.5-7620 TS: 16.783 Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045'] Fitting shape 3FGL J0023.9-7203 TS: 758.502
2018-03-06 10:06:47 INFO lightcurve_410455542_444635167 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_410455542_444635167/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045'] Fitting shape 3FGL J0029.1-7045 TS: 121.157 Fitting shape SMC TS: 99.041
2018-03-06 10:06:48 INFO lightcurve_376275917_410455542 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_376275917_410455542/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045'] Fitting shape 3FGL J2336.5-7620 TS: 24.979 Fitting shape 3FGL J0112.9-7506 TS: 22.872 Fitting shape 3FGL J2351.9-7601 TS: 21.466
2018-03-06 10:06:51 INFO lightcurve_239557417_273737042 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_239557417_273737042/base_00.xml... 2018-03-06 10:06:51 INFO lightcurve_307916667_342096292 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_307916667_342096292/fit_model_final_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC'] Fitting shape 3FGL J0146.4-6746 TS: 20.529 Fitting shape PS J0046.3-7048 TS: 16.553
2018-03-06 10:06:58 INFO lightcurve_307916667_342096292 GTAnalysis._process_lc_bin(): Finished time range 307916667 342096292 2018-03-06 10:06:58 INFO lightcurve_478814792_512994417 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_478814792_512994417/fit_model_final_00.xml...
Fitting shape 3FGL J0023.9-7203 TS: 709.094 Fitting shape SMC TS: 125.796 Fitting shape 3FGL J0023.9-7203 TS: 632.319 Fitting shape 3FGL J0023.9-7203 TS: 500.975 Fitting shape 3FGL J2351.9-7601 TS: 85.535 Fitting shape SMC TS: 88.057 Fitting shape SMC TS: 81.265 Fitting shape 3FGL J0146.4-6746 TS: 78.907 Fitting shape 3FGL J0029.1-7045 TS: 42.400 Fitting shape 3FGL J0146.4-6746 TS: 56.923 Fitting shape 3FGL J2338.7-7401 TS: 36.516 Fitting shape 3FGL J2338.7-7401 TS: 26.094 Fitting shape 3FGL J0029.1-7045 TS: 26.127 Fitting shape 3FGL J0002.0-6722 TS: 24.416
2018-03-06 10:07:05 INFO lightcurve_478814792_512994417 GTAnalysis._process_lc_bin(): Finished time range 478814792 512994417
Fitting shape 3FGL J0023.9-7203 TS: 528.051
2018-03-06 10:07:06 INFO lightcurve_273737042_307916667 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_273737042_307916667/base_00.xml...
Joint fit ['3FGL J0023.9-7203', 'SMC', '3FGL J0029.1-7045'] Fitting shape SMC TS: 72.762 Fitting shape 3FGL J0029.1-7045 TS: 40.064 Fitting shape 3FGL J2351.9-7601 TS: 37.347
2018-03-06 10:07:08 INFO lightcurve_342096292_376275917 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_342096292_376275917/fit_model_final_00.xml...
Fitting shape 3FGL J0002.0-6722 TS: 21.948 Fitting shape 3FGL J0112.9-7506 TS: 16.623
2018-03-06 10:07:13 INFO lightcurve_342096292_376275917 GTAnalysis._process_lc_bin(): Finished time range 342096292 376275917 2018-03-06 10:07:14 INFO lightcurve_376275917_410455542 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_376275917_410455542/fit_model_final_00.xml...
Fitting shape 3FGL J0023.9-7203 TS: 693.836
2018-03-06 10:07:15 INFO lightcurve_410455542_444635167 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_410455542_444635167/fit_model_final_00.xml...
Fitting shape SMC TS: 85.350
2018-03-06 10:07:15 INFO lightcurve_444635167_478814792 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_444635167_478814792/fit_model_final_00.xml...
Fitting shape 3FGL J2351.9-7601 TS: 46.093 Fitting shape 3FGL J2338.7-7401 TS: 25.605 Fitting shape 3FGL J0029.1-7045 TS: 25.038
2018-03-06 10:07:17 INFO lightcurve_376275917_410455542 GTAnalysis._process_lc_bin(): Finished time range 376275917 410455542
Fitting shape 3FGL J0112.9-7506 TS: 20.364 Fitting shape PS J0103.0-7052 TS: 16.484
2018-03-06 10:07:18 INFO lightcurve_410455542_444635167 GTAnalysis._process_lc_bin(): Finished time range 410455542 444635167 2018-03-06 10:07:19 INFO lightcurve_444635167_478814792 GTAnalysis._process_lc_bin(): Finished time range 444635167 478814792 2018-03-06 10:07:19 INFO lightcurve_239557417_273737042 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_239557417_273737042/fit_model_final_00.xml... 2018-03-06 10:07:21 INFO lightcurve_273737042_307916667 GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/lightcurve_273737042_307916667/fit_model_final_00.xml... 2018-03-06 10:07:21 INFO lightcurve_239557417_273737042 GTAnalysis._process_lc_bin(): Finished time range 239557417 273737042 2018-03-06 10:07:22 INFO lightcurve_273737042_307916667 GTAnalysis._process_lc_bin(): Finished time range 273737042 307916667 2018-03-06 10:07:22 INFO GTAnalysis.lightcurve(): Finished Lightcurve
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] 6.30410086488123 [3.11593816e-09 2.91989027e-09 3.22673828e-09 3.31752155e-09 3.08489595e-09 3.43246894e-09 3.72792397e-09 3.39914712e-09] [9.54362626e-06 8.13657551e-06 8.53153333e-06 8.60202096e-06 8.19314133e-06 1.34414438e-05 1.25737846e-05 1.13474413e-05] [3.88218821e-09 3.58577700e-09 3.90047178e-09 4.01305347e-09 3.77963292e-09 4.21589982e-09 4.42831291e-09 4.09962901e-09]
fig = plt.figure(figsize=(8,6))
plt.errorbar((lc['tmin']+lc['tmax'])/2., lc['flux'], yerr=lc['flux_err'], xerr=(lc['tmin']-lc['tmax'])/2., fmt="o", color="black")
plt.ylabel(r'$\Phi_{\gamma}$ [ph/cm$^2$/s]', fontsize=18)
plt.xlabel(r'$t$ [s]', fontsize=18)
plt.axis([lc['tmin'][0],lc['tmax'][len(lc['tmax'])-1],2e-9,6e-9], fontsize=18)
plt.xticks(fontsize=18)
plt.yticks(fontsize=18)
plt.grid(True)
plt.yscale('log')
plt.xscale('linear')
plt.legend(loc=1,prop={'size':16},numpoints=1, scatterpoints=1, ncol=1)
fig.tight_layout(pad=0.5)
plt.show()
No handlers could be found for logger "matplotlib.legend"