Configuring the model, running g-tools and output files and infos

This tutorial shows how to configure the model and how to run Fermipy-LAT g-tools with Fermipy. Many parts of this tutorial are taken directly from the documentation page of Fermipy: fermipy.readthedocs. I suggest to visit it to find further informations.

Configuring the model

The model can be configured with a configuration file or directly running Fermipy with your script.

The configuration file defines the data selection and analysis parameters. The configuration file has a hierarchical structure that groups parameters into dictionaries that are keyed to a section name (data, binning, etc.).

When creating a class instance, the configuration is initialized by passing either a configuration dictionary or configuration file path to the class constructor. Keyword arguments can be passed to the constructor to override configuration parameters in the input dictionary. In the following example the config dictionary defines values for the parameters emin and emax. By passing a dictionary for the selection keyword argument, the value of emax in the keyword argument (10000) overrides the value of emax in the input dictionary.

# config = { 'selection' : { 'emin' : 100, 'emax' : 1000 } } gta = GTAnalysis(config,selection={'emax' : 10000})

The configuration file can be created also with a yaml file. Below I report a sample of configuration applied for an analysis of the SMC:

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:

DATA

The data section defines the input data files for the analysis (FT1, FT2, and livetime cube). evfile and scfile can either be individual files or group of files. The optional ltcube option can be used to choose a pre-generated livetime cube. If ltcube is null a livetime cube will be generated at runtime with gtltcube.

Below an example of the data part:

data : evfile : ft1.lst scfile : ft2.fits ltcube : null

The options for the data component are the following:

  • cacheft1: Cache FT1 files when performing binned analysis. If false then only the counts cube is retained.
  • evfile: Path to FT1 file or list of FT1 files.
  • ltcube: Path to livetime cube. If none a livetime cube will be generated with gtmktime.
  • scfile: Path to FT2 (spacecraft) file.

BINNING

Options in the binning section control the spatial and spectral binning of the data.

binning: # Binning roiwidth : 10.0 npix : null binsz : 0.1 # spatial bin size in deg binsperdec : 8 # nb energy bins per decade projtype : WCS

The roiwidth is the ROI width, npix specifies the number of pixels, binsz indicates the pixel size, binsperdec is the number of energy bins per decade and projtype is the type of projection and can be WCS and HEALPIX.

Other options are:

  • coordsys: for the coordinate system Galactic or Celestial (CEL or GAL),
  • hpx_order: is the healpix order, hpx_ordering_scheme is the HEALPix Ordering Scheme,
  • proj: is the Spatial projection for WCS mode, Width of the ROI in degrees.
  • roiwidth: is the number of pixels in each spatial dimension will be set from roiwidth / binsz (rounded up).

COMPONENTS

The components section can be used to define analysis configurations for independent subselections of the data. Each subselection will have its own binned likelihood instance that is combined in a global likelihood function for the ROI (implemented with the SummedLikelihood class in pyLikelihood). The components section is optional and when set to null (the default) only a single likelihood component will be created with the parameters of the root analysis configuration.

The component section is defined as a list of dictionaries where each element sets analysis parameters for a different subcomponent of the analysis. The component configurations follow the same structure and accept the same parameters as the root analysis configuration. Parameters not defined in a given element will default to the values set in the root analysis configuration.

The following example illustrates how to define a Front/Back analysis with two components. Files associated to each component will be given a suffix according to their order in the list (e.g. file_00.fits, file_01.fits, etc.).

# Component section for Front/Back analysis - { selection : { evtype : 1 } } # Front - { selection : { evtype : 2 } } # Back

The following example illustrates how to define an analysis divided in four components. Each of them has a different zmax and uses a different evtype and isotropic template.

components: - model: {isodiff: $FERMI_DIFFUSE_DIR/iso_P8R2_SOURCE_V6_PSF0_v06.txt} selection: {evtype: 4, zmax: 80} data: {ltcube: ltcube_00.fits} - model: {isodiff: $FERMI_DIFFUSE_DIR/iso_P8R2_SOURCE_V6_PSF1_v06.txt} selection: {evtype: 8, zmax: 85} data: {ltcube: ltcube_01.fits} - model: {isodiff: $FERMI_DIFFUSE_DIR/iso_P8R2_SOURCE_V6_PSF2_v06.txt} selection: {evtype: 16, zmax: 95} data: {ltcube: ltcube_02.fits} - model: {isodiff: $FERMI_DIFFUSE_DIR/iso_P8R2_SOURCE_V6_PSF3_v06.txt} selection: {evtype: 32, zmax: 100} data: {ltcube: ltcube_03.fits}

EXTENSION

The options in extension control the default behavior of the extension method. For more information about using this method see the Extension Fitting page. The main options are the following:

  • fit_ebin: Perform a fit for the angular extension in each analysis energy bin.
  • fit_position: Perform a simultaneous fit to the source position and extension.
  • fix_shape: Fix spectral shape parameters of the source of interest. If True then only the normalization parameter will be fit.
  • free_background: Leave background parameters free when performing the fit. If True then any parameters that are currently free in the model will be fit simultaneously with the source of interest.
  • free_radius: Free normalizations of background sources within this angular distance in degrees from the source of interest. If None then no sources will be freed.
  • sqrt_ts_threshold: Threshold on sqrt(TS_ext) that will be applied when update is True. If None then nothreshold is applied.
  • width: Sequence of values in degrees for the likelihood scan over spatial extension (68% containment radius). If this argument is None then the scan points will be determined from width_min/width_max/width_nstep.
  • width_max: Maximum value in degrees for the likelihood scan over spatial extent.
  • width_min: Minimum value in degrees for the likelihood scan over spatial extent.
  • width_nstep: Number of scan points between width_min and width_max. Scan points will be spaced evenly on a logarithmic scale between width_min and width_max.

There is a notebook dedicated to this analysis.

FILEIO

The fileio section collects options related to file bookkeeping. The outdir option sets the root directory of the analysis instance where all output files will be written. If outdir is null then the output directory will be automatically set to the directory in which the configuration file is located. Enabling the usescratch option will stage all output data files to a temporary scratch directory created under scratchdir.

Sample fileio Configuration

fileio: outdir : null logfile : null usescratch : False scratchdir : '/scratch'

The options for the fileio are the following:

  • logfile: Path to log file. If None then log will be written to fermipy.log.
  • outdir: Path of the output directory. If none this will default to the directory containing the configuration file.
  • outdir_regex: Stage files to the output directory that match at least one of the regular expressions in this list. This option only takes effect when usescratch is True.
  • savefits: Save intermediate FITS files.
  • scratchdir: Path to the scratch directory. If usescratch is True then a temporary working directory will be created under this directory.
  • usescratch: Run analysis in a temporary working directory under scratchdir.
  • workdir: Path to the working directory.
  • workdir_regex: Stage files to the working directory that match at least one of the regular expressions in this list. This option only takes effect when usescratch is True.

GTLIKE

Options in the gtlike section control the setup of the likelihood analysis include the IRF name (irfs).

A subsample of options for the gtlike section is listed below:

  • edisp: Enable the correction for energy dispersion.
  • edisp_disable: Provide a list of sources for which the edisp correction should be disabled.
  • use_external_srcmap: Use an external precomputed source map file.
  • use_scaled_srcmap: Generate source map by scaling an external srcmap file.
  • wmap: Likelihood weights map.

The Likelihood wights map is created and used in order to account for example for the uncertainty in the interstellar emission.

MODEL

The model section collects options that control the inclusion of point-source and diffuse components in the model. galdiff and isodiff set the templates for the Galactic IEM and isotropic diffuse respectively. catalogs defines a list of catalogs that will be merged to form a master analysis catalog from which sources will be drawn. Valid entries in this list can be FITS files or XML model files. sources can be used to insert additional point-source or extended components beyond those defined in the master catalog. src_radius and src_roiwidth set the maximum distance from the ROI center at which sources in the master catalog will be included in the ROI model.

Sample for the Model section:

model : # Diffuse components galdiff : '$FERMI_DIR/refdata/fermi/galdiffuse/gll_iem_v06.fits' isodiff : '$FERMI_DIR/refdata/fermi/galdiffuse/iso_P8R2_SOURCE_V6_v06.txt' # List of catalogs to be used in the model. catalogs : - '3FGL' - 'extra_sources.xml' sources : - { 'name' : 'SourceA', 'ra' : 60.0, 'dec' : 30.0, 'SpectrumType' : PowerLaw } - { 'name' : 'SourceB', 'ra' : 58.0, 'dec' : 35.0, 'SpectrumType' : PowerLaw } # Include catalog sources within this distance from the ROI center src_radius : null # Include catalog sources within a box of width roisrc. src_roiwidth : 15.0

In the sample above the official IEM and isotropic template are used together with the 3FGL catalog given with a fits file and by an additional catalog given with an xml file following the notation of the Fermi Science Tools fermi.fssc.spectralmodel. Then two sources named as SourceA and SourceB are added.

To define two or more galactic diffuse components you can optionally define the galdiff and isodiff parameters as lists. A separate component will be generated for each element in the list with the name galdiffXX or isodiffXX where XX is an integer position in the list.

model: galdiff : - '$FERMI_DIFFUSE_DIR/diffuse_component0.fits' - '$FERMI_DIFFUSE_DIR/diffuse_component1.fits'

To explicitly set the name of a component you can define any element as a dictionary containing name and file fields:

model: galdiff : - { 'name' : 'component0', 'file' : '$FERMI_DIFFUSE_DIR/diffuse_component0.fits' } - { 'name' : 'component1', 'file' : '$FERMI_DIFFUSE_DIR/diffuse_component1.fits' }

The list of sources for inclusion in the ROI model is set by defining a list of catalogs with the catalogs parameter. Catalog files can be in either XML or FITS format. Sources from the catalogs in this list that satisfy either the src_roiwidth or src_radius selections are added to the ROI model. If a source is defined in multiple catalogs the source definition from the last file in the catalogs list takes precedence.

model: src_radius: 5.0 src_roiwidth: 10.0 catalogs : - 'gll_psc_v16.fit' - 'extra_sources.xml'

Fermipy supports four spatial models which are defined with the SpatialModel property:

  • PointSource : A point source (SkyDirFunction).
  • RadialGaussian : A symmetric 2D Gaussian with width parameter ‘Sigma’.
  • RadialDisk : A symmetric 2D Disk with radius ‘Radius’.
  • SpatialMap : An arbitrary 2D shape with morphology defined by a FITS template.

The spatial extension of RadialDisk and RadialGaussian can be controlled with the SpatialWidth parameter which sets the 68% containment radius in degrees. Note for ST releases prior to 11-01-01, RadialDisk and RadialGaussian sources will be represented with the SpatialMap type.

model: sources : - { name: 'PointSource', glon : 120.0, glat : 0.0, SpectrumType : 'PowerLaw', Index : 2.0, Scale : 1000, Prefactor : !!float 1e-11, SpatialModel: 'PointSource' } - { name: 'DiskSource', glon : 120.0, glat : 0.0, SpectrumType : 'PowerLaw', Index : 2.0, Scale : 1000, Prefactor : !!float 1e-11, SpatialModel: 'RadialDisk', SpatialWidth: 1.0 } - { name: 'GaussSource', glon : 120.0, glat : 0.0, SpectrumType : 'PowerLaw', Index : 2.0, Scale : 1000, Prefactor : !!float 1e-11, SpatialModel: 'RadialGaussian', SpatialWidth: 1.0 } - { name: 'MapSource', glon : 120.0, glat : 0.0, SpectrumType : 'PowerLaw', Index : 2.0, Scale : 1000, Prefactor : !!float 1e-11, SpatialModel: 'SpatialMap', Spatial_Filename : 'template.fits' }

OPTIMIZER

This section provides informations for the setup used for the optimization. The list of options are the following:

  • init_lambda: Initial value of damping parameter for step size calculation when using the NEWTON fitter. A value of zero disables damping.
  • max_iter: Maximum number of iterations for the Newtons method fitter.
  • min_fit_quality: Set the minimum fit quality.
  • optimizer: Set the optimization algorithm to use when maximizing the likelihood function.
  • retries: Set the number of times to retry the fit when the fit quality is less than min_fit_quality.
  • tol: Set the optimizer tolerance.
  • verbosity

PLOTTING

This section selects the options to be used to make the plots:

  • cmap: Set the colormap for 2D plots. Default magma
  • cmap_resid: Set the colormap for 2D residual plots.
  • figsize: Set the default figure size.
  • format: format of images
  • interactive: Enable interactive mode. If True then plots will be drawn after each plotting command.
  • label_ts_threshold: TS threshold for labeling sources in sky maps. If None then no sources will be labeled.

SELECTION

The selection section collects parameters related to the data selection and target definition. The majority of the parameters in this section are arguments to gtselect and gtmktime. The ROI center can be set with the target parameter by providing the name of a source defined in one of the input catalogs (defined in the model section). Alternatively the ROI center can be defined by giving explicit sky coordinates with ra and dec or glon and glat.

selection: # gtselect parameters emin : 100 emax : 100000 zmax : 90 evclass : 128 evtype : 3 tmin : 239557414 tmax : 428903014 # gtmktime parameters filter : 'DATA_QUAL>0 && LAT_CONFIG==1' roicut : 'no' # Set the ROI center to the coordinates of this source target : 'mkn421'

A sample of options for this section are the following:

  • emax/emin: Maximum/Minimum Energy (MeV)
  • evclass: Event class selection.
  • evtype: Event type selection.
  • filter: Filter string for gtmktime selection.
  • logemax/logemin: Maximum/Minimum Energy (log10(MeV))
  • phasemax/phasemin: Maximum/Minimum pulsar phase
  • radius: Radius of data selection. If none this will be automatically set from the ROI size.
  • target: Choose an object on which to center the ROI. This option takes precendence over ra/dec or glon/glat.
  • tmax/tmin: Maximum/Minimum time (MET).
  • zmax: Maximum zenith angle.

Running g-tools

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

With the commands below we import the packages needed to run the script.


In [1]:
%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
from IPython.display import Image

Then we untar the file ../data/SMC_data.tar.gz. This will copy the config.yaml and ft1 file in the notebook directory.


In [2]:
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

In [3]:
gta = GTAnalysis('config.yaml')
matplotlib.interactive(True)
gta.setup()


2018-03-31 09:02:08 INFO    GTAnalysis.__init__(): 
--------------------------------------------------------------------------------
fermipy version 0.16.0+175.ge34f 
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-03-31 09:02:11 INFO    GTAnalysis.setup(): Running setup.
2018-03-31 09:02:11 INFO    GTBinnedAnalysis.setup(): Running setup for component 00
2018-03-31 09:02:11 INFO    GTBinnedAnalysis._select_data(): Skipping data selection.
2018-03-31 09:02:11 INFO    GTBinnedAnalysis.setup(): Using external LT cube.
2018-03-31 09:02:13 INFO    GTBinnedAnalysis._create_expcube(): Skipping gtexpcube.
2018-03-31 09:02:13 INFO    GTBinnedAnalysis._create_srcmaps(): Skipping gtsrcmaps.
2018-03-31 09:02:13 INFO    GTBinnedAnalysis.setup(): Finished setup for component 00
2018-03-31 09:02:13 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-03-31 09:02:35 INFO    GTAnalysis.setup(): Initializing source properties
2018-03-31 09:03:30 INFO    GTAnalysis.setup(): Finished setup.

The setup() method performs the data preparation and response calculations needed for the analysis (selecting the data, creating counts and exposure maps, etc.). Depending on the data selection and binning of the analysis this will often be the slowest step in the analysis sequence. The output of setup() is cached in the analysis working directory so subsequent calls to setup() will run much faster.

The g-tools performed with gta.setup() are the following:

In order to have a summary of the source model you can use the command:


In [4]:
gta.print_model()


2018-03-31 09:03:55 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 table above contains:

  • sourcename as given in the catalog
  • offset from the center of the roi. Sources are ranked with respect to this parameter
  • normalization of the SED
  • energy flux of the source
  • index of the SED with a PowerLaw SED
  • Test Statistics
  • npred is the number of sources associated to the source
  • free column that tells if the SED parameter of the sources are free (if the column is filled with an asterix) or fixed without no asterix.

Source dictionary

First of all, let's make a fit using gta.fit tool. 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.


In [5]:
gta.free_sources()
fitresult=gta.fit()


2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0059.0-7242e    : ['Prefactor', 'Index']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506     : ['Prefactor', 'Index']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203     : ['norm', 'alpha', 'beta']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045     : ['Prefactor', 'Index']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0021.6-6835     : ['Prefactor', 'Index']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J2351.9-7601     : ['Prefactor', 'Index']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J2338.7-7401     : ['Prefactor', 'Index']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0146.4-6746     : ['Prefactor', 'Index']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J2336.5-7620     : ['Prefactor', 'Index']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0002.0-6722     : ['Prefactor', 'Index']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for isodiff               : ['Normalization']
2018-03-31 09:04:41 INFO    GTAnalysis.free_source(): Freeing parameters for galdiff               : ['Prefactor', 'Index']
2018-03-31 09:04:41 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-31 09:04:57 INFO    GTAnalysis.fit(): Fit returned successfully. Quality:   3 Status:   0
2018-03-31 09:04:57 INFO    GTAnalysis.fit(): LogLike:   -77883.041 DeltaLogLike:       80.036 

In [6]:
gta.print_model()


2018-03-31 09:04:57 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7    *
3FGL J0023.9-7203      2.662   0.590  9.68e-06   2.70   4889.10      1771.0    *
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7    *
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4    *
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5    *
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2    *
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3    *
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9    *
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7    *
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

Now you see that the ts column is filled and the free column has all asterix because we have freed the sources.

Fermipy gives the possibility to access many informations on the sources in the model. Below a few examples.

NAME AND CHARACTERISTICS OF THE SOURCE


In [8]:
print gta.roi.sources[0]['name'] #name of the source
print gta.roi.sources[0]['Source_Name'] #name of the source
print gta.roi.sources[0]['SpatialModel'] #spatial model
print gta.roi.sources[0]['SpatialWidth'] #spatial size parameter
print gta.roi.sources[0]['SpatialType'] #spatial size parameter
print gta.roi.sources[0]['SourceType'] #Source type
print gta.roi.sources[0]['SpectrumType'] #Spectrum type string
print gta.roi.sources[0]['Spatial_Filename'] #Path to spatial template
print gta.roi.sources[0]['Spectrum_Filename'] #Path to the SED source template
print gta.roi.sources[0]['correlation'] #Dictionary of correlation coefficients.
print gta.roi.sources[0]['model_counts'] #Vector of predicted counts for this source


3FGL J0059.0-7242e
3FGL J0059.0-7242e
SpatialMap
None
SpatialMap
DiffuseSource
PowerLaw
$FERMIPY_DATA_DIR/catalogs/Extended_archive_v15/Templates/SMC.fits
None
{'3FGL J2336.5-7620': 0.021540975517969452, '3FGL J0029.1-7045': -0.018737972377049942, 'isodiff': -0.011270554190343823, 'galdiff': -0.16130718991869766, '3FGL J2338.7-7401': 0.01187470654461815, '3FGL J0059.0-7242e': 0.9999999999999998, '3FGL J0112.9-7506': -0.010991866042965983, '3FGL J0146.4-6746': 0.01590697189126327, '3FGL J0023.9-7203': -0.02136376358912324, '3FGL J0021.6-6835': 0.01579921758235634, '3FGL J0002.0-6722': 0.011830993863816544, '3FGL J2351.9-7601': 0.00401017952234348}
[4.95790377e+02 3.41435355e+02 2.31934703e+02 1.55836591e+02
 1.03590847e+02 6.85066795e+01 4.54694907e+01 3.03664598e+01
 2.00853639e+01 1.32773079e+01 8.77338782e+00 5.83038311e+00
 3.90279960e+00 2.59778026e+00 1.71628875e+00 1.12902221e+00
 7.43126007e-01 4.87775565e-01 3.21625630e-01 2.11836077e-01
 1.38999521e-01 8.97531536e-02]

CHARACTERISTICS OF THE POSITION OF THE SOURCE


In [9]:
print gta.roi.sources[0]['ra'] #ra
print gta.roi.sources[0]['dec'] #dec
print gta.roi.sources[0]['glon'] #glon
print gta.roi.sources[0]['glat'] #glat
print gta.roi.sources[0]['ra_err'] #error for ra
print gta.roi.sources[0]['dec_err'] #error for dec
print gta.roi.sources[0]['glon_err'] #error for glon
print gta.roi.sources[0]['glat_err'] #error for glat
print gta.roi.sources[0]['pos_err'] #error for the position in deg
print gta.roi.sources[0]['pos_r68'] #68% CL error for the position
print gta.roi.sources[0]['pos_r95'] #95% CL error for the position
print gta.roi.sources[0]['pos_r99'] #99% CL error for the position
print gta.roi.sources[0]['pos_err_semimajor'] #1-sigma uncertainty (deg) along major axis of uncertainty ellipse.
print gta.roi.sources[0]['pos_err_semiminor'] #1-sigma uncertainty (deg) along minor axis of uncertainty ellipse.
print gta.roi.sources[0]['offset_ra'] #Right ascension offset from ROI center in local celestial projection (deg).
print gta.roi.sources[0]['offset_dec'] #Declination offset from ROI center in local celestial projection (deg).
print gta.roi.sources[0]['offset_glon'] #Galactic longitude offset from ROI center in local galactic projection (deg).
print gta.roi.sources[0]['offset_glat'] #Galactic latitude offset from ROI center in local galactic projection (deg).
print gta.roi.sources[0]['offset'] #Angular offset from ROI center (deg).


14.75
-72.7
302.14493
-44.4167
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
-0.07331403829880656
0.04939684436004943
0.0750319866158955
-0.046748398465821905
0.0884039

The error for the position is nan because we have not calculated yet the relocalization. Let's run the localization for a source with gta.localize tool.


In [10]:
gta.free_sources(free=True)
gta.print_model()
gta.free_sources(skydir=gta.roi[gta.roi.sources[2].name].skydir,distance=[3.0],free=True)
gta.print_model()
localsmc = gta.localize(gta.roi.sources[2].name, update=True, make_plots=True)
gta.print_model()


2018-03-31 09:06:10 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7    *
3FGL J0023.9-7203      2.662   0.590  9.68e-06   2.70   4889.10      1771.0    *
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7    *
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4    *
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5    *
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2    *
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3    *
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9    *
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7    *
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

2018-03-31 09:06:10 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7    *
3FGL J0023.9-7203      2.662   0.590  9.68e-06   2.70   4889.10      1771.0    *
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7    *
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4    *
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5    *
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2    *
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3    *
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9    *
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7    *
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

2018-03-31 09:06:10 INFO    GTAnalysis.localize(): Running localization for 3FGL J0023.9-7203
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-31 09:06:28 INFO    GTAnalysis._localize(): Localization succeeded.
2018-03-31 09:06:28 INFO    GTAnalysis._localize(): Updating source 3FGL J0023.9-7203 to localized position.
2018-03-31 09:06:28 INFO    GTAnalysis.delete_source(): Deleting source 3FGL J0023.9-7203
2018-03-31 09:06:28 INFO    GTAnalysis.add_source(): Adding source 3FGL J0023.9-7203
2018-03-31 09:06:31 INFO    GTAnalysis._localize(): Localization completed with new position:
(  ra, dec) = (    5.9919 +/-   0.0054,  -72.0832 +/-   0.0053)
(glon,glat) = (  305.9080 +/-   0.0054,  -44.8859 +/-   0.0053)
offset =   0.0183 r68 =   0.0081 r95 =   0.0131 r99 =   0.0163
2018-03-31 09:06:31 INFO    GTAnalysis._localize(): LogLike:   -77883.001 DeltaLogLike:        0.040
2018-03-31 09:06:31 INFO    GTAnalysis.localize(): Finished localization.
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-31 09:06:35 INFO    GTAnalysis.localize(): Execution time: 25.06 s
2018-03-31 09:06:35 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7    *
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4997.47      1770.8    *
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7    *
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4    *
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5    *
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2    *
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3    *
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9    *
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7    *
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

Using the option make_plots=True a few control plots are created like 3fgl_j0023.9-7203_localize_peak.png with the result for the likelihood analysis for the besy fit position and error for the position.


In [13]:
Image(filename='3fgl_j0023.9-7203_localize_peak.png')


Out[13]:

In [14]:
print gta.roi.sources[2]['ra'] #ra
print gta.roi.sources[2]['dec'] #dec
print gta.roi.sources[2]['glon'] #glon
print gta.roi.sources[2]['glat'] #glat
print gta.roi.sources[2]['ra_err'] #error for ra
print gta.roi.sources[2]['dec_err'] #error for dec
print gta.roi.sources[2]['glon_err'] #error for glon
print gta.roi.sources[2]['glat_err'] #error for glat
print gta.roi.sources[2]['pos_err'] #error for the position in deg
print gta.roi.sources[2]['pos_r68'] #68% CL error for the position
print gta.roi.sources[2]['pos_r95'] #95% CL error for the position
print gta.roi.sources[2]['pos_r99'] #99% CL error for the position
print gta.roi.sources[2]['pos_err_semimajor'] #1-sigma uncertainty (deg) along major axis of uncertainty ellipse.
print gta.roi.sources[2]['pos_err_semiminor'] #1-sigma uncertainty (deg) along minor axis of uncertainty ellipse.
print gta.roi.sources[2]['offset_ra'] #Right ascension offset from ROI center in local celestial projection (deg).
print gta.roi.sources[2]['offset_dec'] #Declination offset from ROI center in local celestial projection (deg).
print gta.roi.sources[2]['offset_glon'] #Galactic longitude offset from ROI center in local galactic projection (deg).
print gta.roi.sources[2]['offset_glat'] #Galactic latitude offset from ROI center in local galactic projection (deg).
print gta.roi.sources[2]['offset'] #Angular offset from ROI center (deg).


5.991891558666937
-72.08324039663697
305.90801515198206
-44.88593302102324
0.005397242484279103
0.005337532530487048
0.005397242484279103
0.005337532530487048
0.005366221368316228
0.008138277648229967
0.013133545877823873
0.016285398847939087
0.005448724558888491
0.005284967419907161
2.609705201380567
0.48092218927044694
-2.5908516158641124
-0.573805547525784
2.6537356812

SED PARAMETERS FLUX AND SCAN OF FLUX


In [15]:
print gta.roi.sources[0]['param_names'] #Names of spectral parameters.
print gta.roi.sources[0]['param_values'] #Spectral parameter values.
print gta.roi.sources[0]['param_errors'] #Spectral parameters errors.
print gta.roi.sources[0]['ts'] #Source test statistic.
print gta.roi.sources[0]['loglike'] #Log-likelihood of the model evaluated at the best-fit normalization of the source.
print gta.roi.sources[0]['flux_scan'] #Flux values for scan of source normalization.
print gta.roi.sources[0]['norm_scan'] #Normalization parameters values for scan of source normalization.
print gta.roi.sources[0]['npred'] #Number of predicted counts from this source integrated over the analysis energy range.
print gta.roi.sources[0]['flux'] #Photon flux (cm−2 s−1) integrated over analysis energy range
print gta.roi.sources[0]['flux_err'] #Photon flux uncertainty (cm−2 s−1) integrated over analysis energy range
print gta.roi.sources[0]['flux_ul95'] #95% CL upper limit on the photon Differential photon flux (cm−2 s−1 MeV−1tegrated over analysis energy range
print gta.roi.sources[0]['dnde'] #Differential photon flux (cm−2 s−1 MeV−1) evaluated at the pivot energy.


['Prefactor' 'Index' 'Scale' '' '' '' '' '' '' '']
[ 1.51191261e-11 -2.46682153e+00  6.65532043e+02             nan
             nan             nan             nan             nan
             nan             nan]
[1.25024392e-12 6.17596151e-02            nan            nan
            nan            nan            nan            nan
            nan            nan]
753.08940408
-77883.0461087
[0.00000000e+00 3.45304615e-09 3.49502174e-09 3.53699734e-09
 3.57897294e-09 3.62094854e-09 3.66292414e-09 3.70489974e-09
 3.74687534e-09 3.78885093e-09 3.83082653e-09 3.87280213e-09
 3.91477773e-09 3.95675333e-09 3.99872893e-09 4.04070453e-09
 4.08268013e-09 4.12465572e-09 4.16663132e-09 4.20860692e-09]
[0.         1.38385295 1.40067521 1.41749748 1.43431974 1.45114201
 1.46796427 1.48478654 1.5016088  1.51843106 1.53525333 1.55207559
 1.56889786 1.58572012 1.60254239 1.61936465 1.63618692 1.65300918
 1.66983145 1.68665371]
1532.23595176
3.77258581354e-09
1.6566462673e-10
4.03860906082e-09
9.1858070747e-13

In [16]:
gta.write_roi('model_test',make_plots=True,save_model_map=True)


2018-03-31 09:09:31 INFO    GTBinnedAnalysis.write_xml(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/model_test_00.xml...
2018-03-31 09:09:31 INFO    GTAnalysis.write_fits(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/model_test.fits...
2018-03-31 09:09:32 INFO    GTBinnedAnalysis.write_model_map(): Generating model map for component 00.
2018-03-31 09:09:34 INFO    GTAnalysis.write_roi(): Writing /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/model_test.npy...

Customizing your model

As we saw before you can customize your model directly in the config.yaml file. However, sometimes you want to change something in your model directly in your Python script.

You can free or fix sources using gta.free_sources. First let's fix the SED parameter of all the sources.


In [17]:
gta.free_sources(free=False)
gta.print_model()


2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0059.0-7242e    : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506     : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203     : ['norm', 'alpha', 'beta']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045     : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0021.6-6835     : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J2351.9-7601     : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J2338.7-7401     : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0146.4-6746     : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J2336.5-7620     : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0002.0-6722     : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for isodiff               : ['Normalization']
2018-03-31 09:10:09 INFO    GTAnalysis.free_source(): Fixing parameters for galdiff               : ['Prefactor', 'Index']
2018-03-31 09:10:09 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2     
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7     
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4997.47      1770.8     
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7     
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4     
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5     
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2     
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3     
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9     
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7     
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4     
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3     

Now we free all parameters:


In [18]:
gta.free_sources(free=True)
gta.print_model()


2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0059.0-7242e    : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506     : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203     : ['norm', 'alpha', 'beta']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0029.1-7045     : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0021.6-6835     : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J2351.9-7601     : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J2338.7-7401     : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0146.4-6746     : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J2336.5-7620     : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0002.0-6722     : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for isodiff               : ['Normalization']
2018-03-31 09:10:13 INFO    GTAnalysis.free_source(): Freeing parameters for galdiff               : ['Prefactor', 'Index']
2018-03-31 09:10:13 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7    *
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4997.47      1770.8    *
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7    *
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4    *
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5    *
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2    *
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3    *
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9    *
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7    *
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

Now we free all the SED parameters of sources within 3 degrees from 3FGL J0059.0-7242e:


In [19]:
gta.free_sources(free=False)
gta.free_sources(skydir=gta.roi['3FGL J0059.0-7242e'].skydir,distance=3.0)
gta.print_model()


2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0059.0-7242e    : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0112.9-7506     : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0023.9-7203     : ['norm', 'alpha', 'beta']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0029.1-7045     : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0021.6-6835     : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J2351.9-7601     : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J2338.7-7401     : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0146.4-6746     : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J2336.5-7620     : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for 3FGL J0002.0-6722     : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for isodiff               : ['Normalization']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Fixing parameters for galdiff               : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0059.0-7242e    : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0112.9-7506     : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Freeing parameters for 3FGL J0023.9-7203     : ['norm', 'alpha', 'beta']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Freeing parameters for isodiff               : ['Normalization']
2018-03-31 09:10:19 INFO    GTAnalysis.free_source(): Freeing parameters for galdiff               : ['Prefactor', 'Index']
2018-03-31 09:10:19 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7    *
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4997.47      1770.8    *
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7     
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4     
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5     
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2     
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3     
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9     
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7     
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

Now we want to delete the source 3FGL J0021.6-6835:


In [20]:
gta.delete_source('3FGL J0021.6-6835')
gta.print_model()


2018-03-31 09:10:23 INFO    GTAnalysis.delete_source(): Deleting source 3FGL J0021.6-6835
2018-03-31 09:10:23 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7    *
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4997.47      1770.8    *
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7     
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5     
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2     
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3     
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9     
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7     
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

You can also delete all the sources as a function of the npred/ts or position using the options minmax_npred/minmax_ts/skydir options. Finally, you can delete sources in a given list using the option names.


In [21]:
help(gta.delete_sources)


Help on method delete_sources in module fermipy.gtanalysis:

delete_sources(self, cuts=None, distance=None, skydir=None, minmax_ts=None, minmax_npred=None, exclude=None, square=False, names=None) method of fermipy.gtanalysis.GTAnalysis instance
    Delete sources in the ROI model satisfying the given
    selection criteria.
    
    Parameters
    ----------
    cuts : dict
        Dictionary of [min,max] selections on source properties.
    
    distance : float
        Cut on angular distance from ``skydir``.  If None then no
        selection will be applied.
    
    skydir : `~astropy.coordinates.SkyCoord`
        Reference sky coordinate for ``distance`` selection.  If
        None then the distance selection will be applied with
        respect to the ROI center.
    
    minmax_ts : list
        Select sources that have TS in the range [min,max].  If
        either min or max are None then only a lower (upper) bound
        will be applied.  If this parameter is none no selection
        will be applied.
    
    minmax_npred : list
        Select sources that have npred in the range [min,max].  If
        either min or max are None then only a lower (upper) bound
        will be applied.  If this parameter is none no selection
        will be applied.
    
    square : bool
        Switch between applying a circular or square (ROI-like)
        selection on the maximum projected distance from the ROI
        center.
    
    names : list            
        Select sources matching a name in this list.
    
    Returns
    -------
    srcs : list
        A list of `~fermipy.roi_model.Model` objects.

In the example below we delete all the sources that have an npred=[0,500]


In [22]:
gta.delete_sources(minmax_npred=[0,500])
gta.print_model()


2018-03-31 09:10:36 INFO    GTAnalysis.delete_source(): Deleting source 3FGL J0112.9-7506
2018-03-31 09:10:36 INFO    GTAnalysis.delete_source(): Deleting source 3FGL J0029.1-7045
2018-03-31 09:10:36 INFO    GTAnalysis.delete_source(): Deleting source 3FGL J2351.9-7601
2018-03-31 09:10:36 INFO    GTAnalysis.delete_source(): Deleting source 3FGL J2338.7-7401
2018-03-31 09:10:36 INFO    GTAnalysis.delete_source(): Deleting source 3FGL J0146.4-6746
2018-03-31 09:10:36 INFO    GTAnalysis.delete_source(): Deleting source 3FGL J2336.5-7620
2018-03-31 09:10:36 INFO    GTAnalysis.delete_source(): Deleting source 3FGL J0002.0-6722
2018-03-31 09:10:36 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4997.47      1770.8    *
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

We can aldo add a new source in the model using the gta.add_source function.


In [23]:
help(gta.add_source)


Help on method add_source in module fermipy.gtanalysis:

add_source(self, name, src_dict, free=None, init_source=True, save_source_maps=True, use_pylike=True, use_single_psf=False, **kwargs) method of fermipy.gtanalysis.GTAnalysis instance
    Add a source to the ROI model.  This function may be called
    either before or after `~fermipy.gtanalysis.GTAnalysis.setup`.
    
    Parameters
    ----------
    name : str
        Source name.
    
    src_dict : dict or `~fermipy.roi_model.Source` object
        Dictionary or source object defining the source properties
        (coordinates, spectral parameters, etc.).
    
    free : bool
        Initialize the source with a free normalization parameter.
    
    use_pylike : bool
        Create source maps with pyLikelihood.
    
    use_single_psf : bool 
        Use the PSF model calculated for the ROI center.  If false
        then a new model will be generated using the position of
        the source.

In the example below we add a Source called Source_PL with a PLSuperExpCutoff and pointlike and a source called Source_Gauss that is spatial extended with a PowerLaw SED and with a RadialGaussian template with an extension of 1 deg.


In [24]:
gta.add_source('Source_PL',{ 'glon' : 300., 'glat' : -46.,'SpectrumType' : 'PLSuperExpCutoff', 'Index1':-1.5, 'Index2' : 1.0,'Scale' : 1000,'Prefactor':1e-9,'SpatialModel' : 'PointSource' })
gta.add_source('Source_Gauss',{ 'glon' : 302., 'glat' : -45.,'SpectrumType' : 'PowerLaw', 'Index':2.0,'Scale' : 1000,'Prefactor':1e-9,'SpatialModel' : 'RadialGaussian', 'SpatialWidth': 1.0 })
gta.print_model()


2018-03-31 09:10:44 INFO    GTAnalysis.add_source(): Adding source Source_PL
2018-03-31 09:10:47 INFO    GTAnalysis.add_source(): Adding source Source_Gauss
2018-03-31 09:11:00 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
Source_Gauss           0.655   1.000   0.00621   2.00       nan    410827.7    *
Source_PL              2.274   1.000   0.00319   4.00       nan    471919.8    *
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4997.47      1770.8    *
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

Now I load the model saved into model_test to have back the intial model.


In [25]:
gta.load_roi('model_test')
gta.print_model()


2018-03-31 09:11:04 INFO    GTAnalysis.load_roi(): Loading ROI file: /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/model_test.npy
2018-03-31 09:11:04 INFO    GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00.
2018-03-31 09:11:23 INFO    GTAnalysis.load_roi(): Finished Loading ROI
2018-03-31 09:11:23 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7    *
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4997.47      1770.8    *
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7    *
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4    *
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5    *
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2    *
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3    *
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9    *
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7    *
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

It is also possible to modify the SED parameters using the functions gta.set_norm, gta.set_parameter, gta.set_parameter_bounds, gta.set_parameter_error .


In [26]:
help(gta.set_norm)
help(gta.set_parameter)


Help on method set_norm in module fermipy.gtanalysis:

set_norm(self, name, value, update_source=True) method of fermipy.gtanalysis.GTAnalysis instance

Help on method set_parameter in module fermipy.gtanalysis:

set_parameter(self, name, par, value, true_value=True, scale=None, bounds=None, error=None, update_source=True) method of fermipy.gtanalysis.GTAnalysis instance
    Update the value of a parameter.  Parameter bounds will
    automatically be adjusted to encompass the new parameter
    value.
    
    Parameters
    ----------
    
    name : str
        Source name.
    
    par : str
        Parameter name.
    
    value : float
        Parameter value.  By default this argument should be the
        unscaled (True) parameter value.
    
    scale : float
        Parameter scale (optional).  Value argument is interpreted
        with respect to the scale parameter if it is provided.
    
    error : float
        Parameter error (optional).  By default this argument should be the
        unscaled (True) parameter value.
    
    update_source : bool
        Update the source dictionary for the object.


In [27]:
print gta.roi['3FGL J0059.0-7242e']['param_names']
print gta.roi['3FGL J0059.0-7242e']['param_values']
print gta.roi['3FGL J0059.0-7242e']['param_errors']


['Prefactor' 'Index' 'Scale' '' '' '' '' '' '' '']
[ 1.51191261e-11 -2.46682153e+00  6.65532043e+02             nan
             nan             nan             nan             nan
             nan             nan]
[ 1.25024392e-12 -6.17596151e-02             nan             nan
             nan             nan             nan             nan
             nan             nan]

In the example below we fix the normalization to 1e-11 and the slope to 2.0.


In [28]:
gta.set_norm('3FGL J0059.0-7242e',value=1.)
gta.set_parameter('3FGL J0059.0-7242e',par='Index',value=2.0)
print gta.roi['3FGL J0059.0-7242e']['param_names']
print gta.roi['3FGL J0059.0-7242e']['param_values']
print gta.roi['3FGL J0059.0-7242e']['param_errors']


/u/gl/mdimauro/kipac/software/anaconda/lib/python2.7/site-packages/scipy/interpolate/fitpack2.py:226: UserWarning: 
A theoretically impossible result was found during the iteration
process for finding a smoothing spline with fp = s: s too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.
  warnings.warn(message)
['Prefactor' 'Index' 'Scale' '' '' '' '' '' '' '']
[1.00000000e-11 2.00000000e+00 6.65532043e+02            nan
            nan            nan            nan            nan
            nan            nan]
[ 0.  0. nan nan nan nan nan nan nan nan]

It is also possible to set the SED shape of a source using gta.set_source_spectrum tool.


In [30]:
help(gta.set_source_spectrum)


Help on method set_source_spectrum in module fermipy.gtanalysis:

set_source_spectrum(self, name, spectrum_type='PowerLaw', spectrum_pars=None, update_source=True) method of fermipy.gtanalysis.GTAnalysis instance
    Set the spectral model of a source.  This function can be
    used to change the spectral type of a source or modify its
    spectral parameters.  If called with
    spectrum_type='FileFunction' and spectrum_pars=None, the
    source spectrum will be replaced with a FileFunction with the
    same differential flux distribution as the original spectrum.
    
    Parameters
    ----------
    
    name : str
       Source name.
    
    spectrum_type : str
       Spectrum type (PowerLaw, etc.).
    
    spectrum_pars : dict
       Dictionary of spectral parameters (optional).
    
    update_source : bool
       Recompute all source characteristics (flux, TS, NPred)
       using the new spectral model of the source.


In [33]:
gta.load_roi('model_test')
gta.print_model()
gta.roi['3FGL J0059.0-7242e']['SpectrumType']


2018-03-31 09:14:18 INFO    GTAnalysis.load_roi(): Loading ROI file: /nfs/slac/kipac/fs1/u/mdimauro/software/fermipy-extra/notebooks/model_test.npy
2018-03-31 09:14:18 INFO    GTBinnedAnalysis._create_binned_analysis(): Creating BinnedAnalysis for component 00.
2018-03-31 09:14:37 INFO    GTAnalysis.load_roi(): Finished Loading ROI
2018-03-31 09:14:37 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.12       140.7    *
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4997.47      1770.8    *
3FGL J0029.1-7045      3.008   0.746   3.1e-06   2.38     89.09       378.7    *
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4    *
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.29       198.5    *
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.48       179.2    *
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.10       170.3    *
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.61       147.9    *
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7    *
isodiff                  ---   0.913    0.0286   2.12   1145.04      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5109.11     17185.3    *

Out[33]:
'PowerLaw'

In [34]:
gta.set_source_spectrum('3FGL J0059.0-7242e',spectrum_type='LogParabola')
gta.roi['3FGL J0059.0-7242e']['SpectrumType']


Out[34]:
'LogParabola'

In [35]:
gta.fit()


2018-03-31 09:15:23 INFO    GTAnalysis.fit(): Starting fit.
2018-03-31 09:15:38 INFO    GTAnalysis.fit(): Fit returned successfully. Quality:   3 Status:   0
2018-03-31 09:15:38 INFO    GTAnalysis.fit(): LogLike:   -77883.001 DeltaLogLike:        0.000 
Out[35]:
{'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.40010977e-01, -1.80903032e-03,
         -1.29673069e-03,  3.87817026e-03,  2.64332600e-03,
         -2.04198717e-03,  9.41038275e-03,  6.18965916e-04,
          1.18313905e-02,  2.62916494e-03,  4.12849233e-03,
          2.26000858e-03,  6.23891541e-03,  3.04105095e-03,
          5.05645412e-03,  3.00353477e-03,  4.90626867e-03,
          2.82449046e-03,  2.82031889e-03,  2.93014665e-03,
         -1.19680073e-02, -2.71265943e-02, -3.41242300e-02],
        [ 4.40010977e-01,  1.00000000e+00, -1.81621670e-03,
         -7.32754724e-04,  2.44740751e-03,  1.49292747e-03,
         -8.93745178e-04,  5.79304529e-03,  4.32350178e-03,
          1.14652827e-02,  8.09005714e-03,  3.14397563e-03,
          2.46443004e-03,  3.52454107e-03,  2.37096614e-03,
          4.72386017e-03,  3.46125929e-03,  2.76468822e-03,
          2.53278353e-03,  1.15894276e-03,  3.11172827e-03,
         -3.39077196e-02, -2.77540909e-02, -1.89906219e-03],
        [-1.80903032e-03, -1.81621670e-03,  1.00000000e+00,
          8.61787939e-01,  5.57550572e-03,  3.44059022e-03,
         -2.20704334e-03, -1.68151354e-02, -1.15186150e-02,
          1.56722554e-02,  1.05487303e-02,  2.77193258e-03,
          2.56573839e-03,  5.95117489e-03,  3.78280704e-03,
          4.66781225e-03,  4.01891459e-03,  3.48241472e-03,
          3.20035094e-03,  6.91485427e-04,  3.48455951e-03,
         -1.95753025e-02, -6.10088327e-02, -3.71947727e-02],
        [-1.29673069e-03, -7.32754724e-04,  8.61787939e-01,
          1.00000000e+00,  2.21844270e-03,  1.44347366e-03,
         -7.90470631e-04, -7.08738255e-03, -5.00629583e-03,
          7.50301160e-03,  8.19997549e-03,  2.34604520e-04,
          1.10416771e-03,  1.99669462e-03,  1.79391848e-03,
          1.45040587e-03,  2.02224228e-03,  4.46055027e-04,
          1.36791422e-03, -9.66890171e-04,  1.56792928e-03,
         -1.11987392e-02, -4.14265699e-02, -1.53951058e-02],
        [ 3.87817026e-03,  2.44740751e-03,  5.57550572e-03,
          2.21844270e-03,  1.00000000e+00,  9.12794676e-01,
         -7.87387195e-01, -1.12933332e-01, -7.75789895e-02,
         -2.13540610e-02, -1.62704772e-02,  2.04205710e-03,
          2.10561763e-03,  5.79314587e-03,  3.58099264e-03,
          2.64602281e-03,  2.79123264e-03,  1.24610943e-03,
          1.19157719e-03, -1.96345718e-04,  1.90464271e-03,
         -1.51143517e-03, -6.58797942e-02, -5.19246295e-02],
        [ 2.64332600e-03,  1.49292747e-03,  3.44059022e-03,
          1.44347366e-03,  9.12794676e-01,  1.00000000e+00,
         -9.53006611e-01, -5.66935236e-02, -4.82988376e-02,
         -1.41035967e-02, -1.23516314e-02,  4.24102285e-04,
          9.65151924e-04,  4.21371130e-03,  2.60739988e-03,
          7.85177633e-04,  1.50411220e-03,  5.53569374e-04,
          6.10302575e-04, -7.05319173e-04,  8.66909407e-04,
          1.10796568e-02, -5.58470765e-02, -4.97881237e-02],
        [-2.04198717e-03, -8.93745178e-04, -2.20704334e-03,
         -7.90470631e-04, -7.87387195e-01, -9.53006611e-01,
          1.00000000e+00,  3.26407713e-02,  2.44138611e-02,
          9.72780037e-03,  9.03431459e-03,  9.90441985e-05,
         -3.56367019e-04, -3.19245662e-03, -1.85352276e-03,
          2.40927129e-05, -6.85183821e-04, -3.64337719e-04,
         -2.50450372e-04,  5.82240863e-04, -2.70585849e-04,
         -1.64014563e-02,  4.18856752e-02,  4.38643321e-02],
        [ 9.41038275e-03,  5.79304529e-03, -1.68151354e-02,
         -7.08738255e-03, -1.12933332e-01, -5.66935236e-02,
          3.26407713e-02,  1.00000000e+00,  5.80487472e-01,
         -1.87595578e-02, -1.23060789e-02,  1.19052085e-02,
          7.64558006e-03,  1.27493248e-02,  7.06093880e-03,
          1.36421567e-02,  8.84446196e-03,  1.02288328e-02,
          7.10200432e-03,  5.64930029e-03,  8.29629772e-03,
         -6.92002424e-02, -6.61472086e-02, -3.83361561e-02],
        [ 6.18965916e-04,  4.32350178e-03, -1.15186150e-02,
         -5.00629583e-03, -7.75789895e-02, -4.82988376e-02,
          2.44138611e-02,  5.80487472e-01,  1.00000000e+00,
         -1.33306016e-02, -9.83690603e-03,  5.25041106e-03,
          6.17726862e-03,  3.77239953e-03,  4.51690976e-03,
          9.17089932e-03,  8.34603639e-03,  2.16761030e-03,
          5.03044211e-03, -8.93480298e-04,  7.00248571e-03,
         -1.02228467e-01, -7.82270683e-02,  3.42990225e-02],
        [ 1.18313905e-02,  1.14652827e-02,  1.56722554e-02,
          7.50301160e-03, -2.13540610e-02, -1.41035967e-02,
          9.72780037e-03, -1.87595578e-02, -1.33306016e-02,
          1.00000000e+00,  8.47824788e-01, -1.09930376e-02,
         -7.48634299e-03,  1.59055343e-02,  1.11948590e-02,
          2.15383897e-02,  1.64886598e-02,  1.18746541e-02,
          1.17888253e-02,  4.00708119e-03,  1.42861194e-02,
         -1.61261963e-01, -1.47766781e-01, -1.12714296e-02],
        [ 2.62916494e-03,  8.09005714e-03,  1.05487303e-02,
          8.19997549e-03, -1.62704772e-02, -1.23516314e-02,
          9.03431459e-03, -1.23060789e-02, -9.83690603e-03,
          8.47824788e-01,  1.00000000e+00, -5.31363796e-03,
         -3.81314007e-03,  6.94723247e-03,  7.84505557e-03,
          1.35674397e-02,  1.32308281e-02,  3.24757136e-03,
          8.17782104e-03, -2.50550792e-03,  1.07313695e-02,
         -1.47850432e-01, -1.51047458e-01,  2.83374484e-02],
        [ 4.12849233e-03,  3.14397563e-03,  2.77193258e-03,
          2.34604520e-04,  2.04205710e-03,  4.24102285e-04,
          9.90441985e-05,  1.19052085e-02,  5.25041106e-03,
         -1.09930376e-02, -5.31363796e-03,  1.00000000e+00,
          6.09604262e-01,  4.22991217e-03,  2.33096454e-03,
          8.14367940e-03,  4.57041968e-03,  5.08251972e-03,
          3.42510687e-03,  3.76244490e-03,  4.37764552e-03,
         -6.18951575e-02,  3.48306679e-03,  2.57515666e-02],
        [ 2.26000858e-03,  2.46443004e-03,  2.56573839e-03,
          1.10416771e-03,  2.10561763e-03,  9.65151924e-04,
         -3.56367019e-04,  7.64558006e-03,  6.17726862e-03,
         -7.48634299e-03, -3.81314007e-03,  6.09604262e-01,
          1.00000000e+00,  2.86373426e-03,  2.07338410e-03,
          5.47517823e-03,  3.76054540e-03,  2.79451239e-03,
          2.61953324e-03,  1.45883310e-03,  3.37000180e-03,
         -4.70426189e-02, -1.68863278e-02,  1.54644100e-02],
        [ 6.23891541e-03,  3.52454107e-03,  5.95117489e-03,
          1.99669462e-03,  5.79314587e-03,  4.21371130e-03,
         -3.19245662e-03,  1.27493248e-02,  3.77239953e-03,
          1.59055343e-02,  6.94723247e-03,  4.22991217e-03,
          2.86373426e-03,  1.00000000e+00,  7.32648960e-01,
          5.84270803e-03,  4.15812081e-03,  5.32235340e-03,
          3.68420001e-03,  2.27864484e-03,  3.82471168e-03,
         -1.56427340e-02, -5.36847541e-02, -4.76668130e-02],
        [ 3.04105095e-03,  2.37096614e-03,  3.78280704e-03,
          1.79391848e-03,  3.58099264e-03,  2.60739988e-03,
         -1.85352276e-03,  7.06093880e-03,  4.51690976e-03,
          1.11948590e-02,  7.84505557e-03,  2.33096454e-03,
          2.07338410e-03,  7.32648960e-01,  1.00000000e+00,
          3.80466597e-03,  3.14837825e-03,  2.63601650e-03,
          2.45828768e-03,  6.37329113e-04,  2.75366311e-03,
         -1.98045470e-02, -4.16937207e-02, -2.11093803e-02],
        [ 5.05645412e-03,  4.72386017e-03,  4.66781225e-03,
          1.45040587e-03,  2.64602281e-03,  7.85177633e-04,
          2.40927129e-05,  1.36421567e-02,  9.17089932e-03,
          2.15383897e-02,  1.35674397e-02,  8.14367940e-03,
          5.47517823e-03,  5.84270803e-03,  3.80466597e-03,
          1.00000000e+00,  7.52998489e-01, -4.19339831e-05,
          1.46617404e-04, -3.57858050e-02, -5.78234433e-02,
         -9.11410155e-02, -1.80565433e-02,  3.29270656e-02],
        [ 3.00353477e-03,  3.46125929e-03,  4.01891459e-03,
          2.02224228e-03,  2.79123264e-03,  1.50411220e-03,
         -6.85183821e-04,  8.84446196e-03,  8.34603639e-03,
          1.64886598e-02,  1.32308281e-02,  4.57041968e-03,
          3.76054540e-03,  4.15812081e-03,  3.14837825e-03,
          7.52998489e-01,  1.00000000e+00, -4.44307202e-04,
          2.51184832e-04, -1.75598835e-02, -3.99710132e-02,
         -6.05610510e-02, -3.55894924e-02,  1.29882217e-02],
        [ 4.90626867e-03,  2.76468822e-03,  3.48241472e-03,
          4.46055027e-04,  1.24610943e-03,  5.53569374e-04,
         -3.64337719e-04,  1.02288328e-02,  2.16761030e-03,
          1.18746541e-02,  3.24757136e-03,  5.08251972e-03,
          2.79451239e-03,  5.32235340e-03,  2.63601650e-03,
         -4.19339831e-05, -4.44307202e-04,  1.00000000e+00,
          2.69314517e-01, -4.70052066e-04, -1.81469896e-03,
         -3.16592750e-02, -1.13876227e-02, -8.64561610e-03],
        [ 2.82449046e-03,  2.53278353e-03,  3.20035094e-03,
          1.36791422e-03,  1.19157719e-03,  6.10302575e-04,
         -2.50450372e-04,  7.10200432e-03,  5.03044211e-03,
          1.17888253e-02,  8.17782104e-03,  3.42510687e-03,
          2.61953324e-03,  3.68420001e-03,  2.45828768e-03,
          1.46617404e-04,  2.51184832e-04,  2.69314517e-01,
          1.00000000e+00, -9.34001434e-04, -1.02728602e-03,
         -3.70742103e-02, -2.70291621e-02, -7.68125765e-05],
        [ 2.82031889e-03,  1.15894276e-03,  6.91485427e-04,
         -9.66890171e-04, -1.96345718e-04, -7.05319173e-04,
          5.82240863e-04,  5.64930029e-03, -8.93480298e-04,
          4.00708119e-03, -2.50550792e-03,  3.76244490e-03,
          1.45883310e-03,  2.27864484e-03,  6.37329113e-04,
         -3.57858050e-02, -1.75598835e-02, -4.70052066e-04,
         -9.34001434e-04,  1.00000000e+00, -3.61087988e-01,
         -2.18834017e-02,  2.27156673e-02,  1.14068621e-02],
        [ 2.93014665e-03,  3.11172827e-03,  3.48455951e-03,
          1.56792928e-03,  1.90464271e-03,  8.66909407e-04,
         -2.70585849e-04,  8.29629772e-03,  7.00248571e-03,
          1.42861194e-02,  1.07313695e-02,  4.37764552e-03,
          3.37000180e-03,  3.82471168e-03,  2.75366311e-03,
         -5.78234433e-02, -3.99710132e-02, -1.81469896e-03,
         -1.02728602e-03, -3.61087988e-01,  1.00000000e+00,
         -5.53725022e-02, -2.64941078e-02,  1.36263348e-02],
        [-1.19680073e-02, -3.39077196e-02, -1.95753025e-02,
         -1.11987392e-02, -1.51143517e-03,  1.10796568e-02,
         -1.64014563e-02, -6.92002424e-02, -1.02228467e-01,
         -1.61261963e-01, -1.47850432e-01, -6.18951575e-02,
         -4.70426189e-02, -1.56427340e-02, -1.98045470e-02,
         -9.11410155e-02, -6.05610510e-02, -3.16592750e-02,
         -3.70742103e-02, -2.18834017e-02, -5.53725022e-02,
          1.00000000e+00,  5.00425333e-03, -6.93525545e-01],
        [-2.71265943e-02, -2.77540909e-02, -6.10088327e-02,
         -4.14265699e-02, -6.58797942e-02, -5.58470765e-02,
          4.18856752e-02, -6.61472086e-02, -7.82270683e-02,
         -1.47766781e-01, -1.51047458e-01,  3.48306679e-03,
         -1.68863278e-02, -5.36847541e-02, -4.16937207e-02,
         -1.80565433e-02, -3.55894924e-02, -1.13876227e-02,
         -2.70291621e-02,  2.27156673e-02, -2.64941078e-02,
          5.00425333e-03,  1.00000000e+00,  6.08696397e-01],
        [-3.41242300e-02, -1.89906219e-03, -3.71947727e-02,
         -1.53951058e-02, -5.19246295e-02, -4.97881237e-02,
          4.38643321e-02, -3.83361561e-02,  3.42990225e-02,
         -1.12714296e-02,  2.83374484e-02,  2.57515666e-02,
          1.54644100e-02, -4.76668130e-02, -2.11093803e-02,
          3.29270656e-02,  1.29882217e-02, -8.64561610e-03,
         -7.68125765e-05,  1.14068621e-02,  1.36263348e-02,
         -6.93525545e-01,  6.08696397e-01,  1.00000000e+00]]),
 'covariance': array([[ 5.05948071e-03,  4.34320701e-03, -1.81484607e-04,
         -5.19547582e-05,  1.52672650e-05,  3.55204282e-05,
         -1.17089926e-05,  7.28819889e-05,  6.08955107e-06,
          1.05209245e-04,  1.15498768e-05,  6.05894364e-05,
          1.79407483e-05,  3.84854584e-05,  2.58903501e-05,
          3.32019871e-05,  3.27364997e-05,  2.18260196e-05,
          1.92918544e-05,  3.28010369e-05,  2.09375000e-05,
         -1.72406892e-05, -4.56261686e-05, -1.18965985e-04],
        [ 4.34320701e-03,  1.92569761e-02, -3.55469782e-04,
         -5.72763375e-05,  1.87967054e-05,  3.91387767e-05,
         -9.99818820e-06,  8.75308057e-05,  8.29841706e-05,
          1.98904202e-04,  6.93349461e-05,  9.00172363e-05,
          3.81670008e-05,  4.24161470e-05,  3.93804479e-05,
          6.05140352e-05,  7.35994865e-05,  2.39944307e-05,
          3.37499405e-05,  2.62961650e-05,  4.33788672e-05,
         -9.52955094e-05, -9.10724058e-05, -1.29163618e-05],
        [-1.81484607e-04, -3.55469782e-04,  1.98921604e+00,
          6.84642658e-01,  4.35217794e-04,  9.16744727e-04,
         -2.50937397e-04, -2.58226793e-03, -2.24701932e-03,
          2.76336100e-03,  9.18856542e-04,  8.06633210e-04,
          4.03860002e-04,  7.27911003e-04,  6.38581627e-04,
          6.07742194e-04,  8.68553067e-04,  3.07179132e-04,
          4.33430504e-04,  1.59463170e-04,  4.93709356e-04,
         -5.59151206e-04, -2.03469561e-03, -2.57116446e-03],
        [-5.19547582e-05, -5.72763375e-05,  6.84642658e-01,
          3.17281780e-01,  6.91595539e-05,  1.53605201e-04,
         -3.58939998e-05, -4.34678738e-04, -3.90035957e-04,
          5.28351969e-04,  2.85260519e-04,  2.72653702e-05,
          6.94120872e-05,  9.75368684e-05,  1.20944612e-04,
          7.54183713e-05,  1.74542969e-04,  1.57138009e-05,
          7.39881765e-05, -8.90504456e-05,  8.87220428e-05,
         -1.27753117e-04, -5.51781708e-04, -4.25022787e-04],
        [ 1.52672650e-05,  1.87967054e-05,  4.35217794e-04,
          6.91595539e-05,  3.06311147e-03,  9.54396839e-03,
         -3.51304165e-03, -6.80555421e-04, -5.93869592e-04,
         -1.47749842e-04, -5.56145260e-05,  2.33185607e-05,
          1.30058399e-05,  2.78054840e-05,  2.37217150e-05,
          1.35188584e-05,  2.36714052e-05,  4.31328174e-06,
          6.33263525e-06, -1.77680276e-06,  1.05895478e-05,
         -1.69414560e-06, -8.62182873e-05, -1.40851598e-04],
        [ 3.55204282e-05,  3.91387767e-05,  9.16744727e-04,
          1.53605201e-04,  9.54396839e-03,  3.56902003e-02,
         -1.45138943e-02, -1.16618620e-03, -1.26205052e-03,
         -3.33096078e-04, -1.44113731e-04,  1.65309405e-05,
          2.03492153e-05,  6.90357207e-05,  5.89580875e-05,
          1.36932787e-05,  4.35412939e-05,  6.54058795e-06,
          1.10713502e-05, -2.17869566e-05,  1.64524547e-05,
          4.23916781e-05, -2.49482848e-04, -4.61006686e-04],
        [-1.17089926e-05, -9.99818820e-06, -2.50937397e-04,
         -3.58939998e-05, -3.51304165e-03, -1.45138943e-02,
          6.49870913e-03,  2.86506130e-04,  2.72217216e-04,
          9.80377520e-05,  4.49795707e-05,  1.64738478e-06,
         -3.20618478e-06, -2.23189186e-05, -1.78843322e-05,
          1.79293394e-07, -8.46383629e-06, -1.83691021e-06,
         -1.93872461e-06,  7.67454464e-06, -2.19129640e-06,
         -2.67778539e-05,  7.98444672e-05,  1.73313360e-04],
        [ 7.28819889e-05,  8.75308057e-05, -2.58226793e-03,
         -4.34678738e-04, -6.80555421e-04, -1.16618620e-03,
          2.86506130e-04,  1.18555010e-02,  8.74215248e-03,
         -2.55356960e-04, -8.27534670e-05,  2.67454199e-04,
          9.29068830e-05,  1.20387594e-04,  9.20203027e-05,
          1.37122279e-04,  1.47563171e-04,  6.96556387e-05,
          7.42543294e-05,  1.00575222e-04,  9.07458515e-05,
         -1.52597486e-04, -1.70308857e-04, -2.04585802e-04],
        [ 6.08955107e-06,  8.29841706e-05, -2.24701932e-03,
         -3.90035957e-04, -5.93869592e-04, -1.26205052e-03,
          2.72217216e-04,  8.74215248e-03,  1.91307122e-02,
         -2.30505060e-04, -8.40292795e-05,  1.49834331e-04,
          9.53541394e-05,  4.52499231e-05,  7.47770345e-05,
          1.17096127e-04,  1.76885587e-04,  1.87506798e-05,
          6.68117146e-05, -2.02063064e-05,  9.72971897e-05,
         -2.86363212e-04, -2.55851744e-04,  2.32516771e-04],
        [ 1.05209245e-04,  1.98904202e-04,  2.76336100e-03,
          5.28351969e-04, -1.47749842e-04, -3.33096078e-04,
          9.80377520e-05, -2.55356960e-04, -2.30505060e-04,
          1.56289676e-02,  6.54602716e-03, -2.83553699e-04,
         -1.04450942e-04,  1.72443966e-04,  1.67511654e-04,
          2.48566965e-04,  3.15861801e-04,  9.28445372e-05,
          1.41519592e-04,  8.19086320e-05,  1.79416308e-04,
         -4.08297663e-04, -4.36825230e-04, -6.90639031e-05],
        [ 1.15498768e-05,  6.93349461e-05,  9.18856542e-04,
          2.85260519e-04, -5.56145260e-05, -1.44113731e-04,
          4.49795707e-05, -8.27534670e-05, -8.40292795e-05,
          6.54602716e-03,  3.81428460e-03, -6.77097119e-05,
         -2.62825077e-05,  3.72094262e-05,  5.79914310e-05,
          7.73516319e-05,  1.25210336e-04,  1.25439840e-05,
          4.84981354e-05, -2.53010597e-05,  6.65800617e-05,
         -1.84930673e-04, -2.20589951e-04,  8.57776731e-05],
        [ 6.05894364e-05,  9.00172363e-05,  8.06633210e-04,
          2.72653702e-05,  2.33185607e-05,  1.65309405e-05,
          1.64738478e-06,  2.67454199e-04,  1.49834331e-04,
         -2.83553699e-04, -6.77097119e-05,  4.25701241e-02,
          1.40371179e-02,  7.56864964e-05,  5.75637899e-05,
          1.55109415e-04,  1.44495774e-04,  6.55845847e-05,
          6.78590034e-05,  1.26928454e-04,  9.07351465e-05,
         -2.58635978e-04,  1.69933897e-05,  2.60413254e-04],
        [ 1.79407483e-05,  3.81670008e-05,  4.03860002e-04,
          6.94120872e-05,  1.30058399e-05,  2.03492153e-05,
         -3.20618478e-06,  9.29068830e-05,  9.53541394e-05,
         -1.04450942e-04, -2.62825077e-05,  1.40371179e-02,
          1.24553228e-02,  2.77169095e-05,  2.76960933e-05,
          5.64080113e-05,  6.43094707e-05,  1.95053513e-05,
          2.80725782e-05,  2.66207011e-05,  3.77824505e-05,
         -1.06328281e-04, -4.45634152e-05,  8.45897653e-05],
        [ 3.84854584e-05,  4.24161470e-05,  7.27911003e-04,
          9.75368684e-05,  2.78054840e-05,  6.90357207e-05,
         -2.23189186e-05,  1.20387594e-04,  4.52499231e-05,
          1.72443966e-04,  3.72094262e-05,  7.56864964e-05,
          2.77169095e-05,  7.52088914e-03,  7.60486984e-03,
          4.67750017e-05,  5.52558547e-05,  2.88674581e-05,
          3.06802352e-05,  3.23107931e-05,  3.33208285e-05,
         -2.74743268e-05, -1.10090874e-04, -2.02608509e-04],
        [ 2.58903501e-05,  3.93804479e-05,  6.38581627e-04,
          1.20944612e-04,  2.37217150e-05,  5.89580875e-05,
         -1.78843322e-05,  9.20203027e-05,  7.47770345e-05,
          1.67511654e-04,  5.79914310e-05,  5.75637899e-05,
          2.76960933e-05,  7.60486984e-03,  1.43259196e-02,
          4.20380751e-05,  5.77423909e-05,  1.97323868e-05,
          2.82536688e-05,  1.24727264e-05,  3.31096474e-05,
         -4.80071555e-05, -1.18004254e-04, -1.23835086e-04],
        [ 3.32019871e-05,  6.05140352e-05,  6.07742194e-04,
          7.54183713e-05,  1.35188584e-05,  1.36932787e-05,
          1.79293394e-07,  1.37122279e-04,  1.17096127e-04,
          2.48566965e-04,  7.73516319e-05,  1.55109415e-04,
          5.64080113e-05,  4.67750017e-05,  4.20380751e-05,
          8.52177509e-03,  1.06513767e-02, -2.42103681e-07,
          1.29966509e-06, -5.40147300e-04, -5.36230459e-04,
         -1.70395729e-04, -3.94153516e-05,  1.48978993e-04],
        [ 3.27364997e-05,  7.35994865e-05,  8.68553067e-04,
          1.74542969e-04,  2.36714052e-05,  4.35412939e-05,
         -8.46383629e-06,  1.47563171e-04,  1.76885587e-04,
          3.15861801e-04,  1.25210336e-04,  1.44495774e-04,
          6.43094707e-05,  5.52558547e-05,  5.77423909e-05,
          1.06513767e-02,  2.34797360e-02, -4.25794650e-06,
          3.69590592e-06, -4.39951314e-04, -6.15282067e-04,
         -1.87940256e-04, -1.28953803e-04,  9.75446086e-05],
        [ 2.18260196e-05,  2.39944307e-05,  3.07179132e-04,
          1.57138009e-05,  4.31328174e-06,  6.54058795e-06,
         -1.83691021e-06,  6.96556387e-05,  1.87506798e-05,
          9.28445372e-05,  1.25439840e-05,  6.55845847e-05,
          1.95053513e-05,  2.88674581e-05,  1.97323868e-05,
         -2.42103681e-07, -4.25794650e-06,  3.91147434e-03,
          1.61737564e-03, -4.80676171e-06, -1.14013776e-05,
         -4.01006133e-05, -1.68410463e-05, -2.65016650e-05],
        [ 1.92918544e-05,  3.37499405e-05,  4.33430504e-04,
          7.39881765e-05,  6.33263525e-06,  1.10713502e-05,
         -1.93872461e-06,  7.42543294e-05,  6.68117146e-05,
          1.41519592e-04,  4.84981354e-05,  6.78590034e-05,
          2.80725782e-05,  3.06802352e-05,  2.82536688e-05,
          1.29966509e-06,  3.69590592e-06,  1.61737564e-03,
          9.22065526e-03, -1.46644176e-05, -9.90956897e-06,
         -7.20995589e-05, -6.13732656e-05, -3.61509901e-07],
        [ 3.28010369e-05,  2.62961650e-05,  1.59463170e-04,
         -8.90504456e-05, -1.77680276e-06, -2.17869566e-05,
          7.67454464e-06,  1.00575222e-04, -2.02063064e-05,
          8.19086320e-05, -2.53010597e-05,  1.26928454e-04,
          2.66207011e-05,  3.23107931e-05,  1.24727264e-05,
         -5.40147300e-04, -4.39951314e-04, -4.80676171e-06,
         -1.46644176e-05,  2.67345433e-02, -5.93105459e-03,
         -7.24654550e-05,  8.78269177e-05,  9.14133333e-05],
        [ 2.09375000e-05,  4.33788672e-05,  4.93709356e-04,
          8.87220428e-05,  1.05895478e-05,  1.64524547e-05,
         -2.19129640e-06,  9.07458515e-05,  9.72971897e-05,
          1.79416308e-04,  6.65800617e-05,  9.07351465e-05,
          3.77824505e-05,  3.33208285e-05,  3.31096474e-05,
         -5.36230459e-04, -6.15282067e-04, -1.14013776e-05,
         -9.90956897e-06, -5.93105459e-03,  1.00917153e-02,
         -1.12656551e-04, -6.29357702e-05,  6.70916578e-05],
        [-1.72406892e-05, -9.52955094e-05, -5.59151206e-04,
         -1.27753117e-04, -1.69414560e-06,  4.23916781e-05,
         -2.67778539e-05, -1.52597486e-04, -2.86363212e-04,
         -4.08297663e-04, -1.84930673e-04, -2.58635978e-04,
         -1.06328281e-04, -2.74743268e-05, -4.80071555e-05,
         -1.70395729e-04, -1.87940256e-04, -4.01006133e-05,
         -7.20995589e-05, -7.24654550e-05, -1.12656551e-04,
          4.10165958e-04,  2.39654093e-06, -6.88413280e-04],
        [-4.56261686e-05, -9.10724058e-05, -2.03469561e-03,
         -5.51781708e-04, -8.62182873e-05, -2.49482848e-04,
          7.98444672e-05, -1.70308857e-04, -2.55851744e-04,
         -4.36825230e-04, -2.20589951e-04,  1.69933897e-05,
         -4.45634152e-05, -1.10090874e-04, -1.18004254e-04,
         -3.94153516e-05, -1.28953803e-04, -1.68410463e-05,
         -6.13732656e-05,  8.78269177e-05, -6.29357702e-05,
          2.39654093e-06,  5.59154099e-04,  7.05461730e-04],
        [-1.18965985e-04, -1.29163618e-05, -2.57116446e-03,
         -4.25022787e-04, -1.40851598e-04, -4.61006686e-04,
          1.73313360e-04, -2.04585802e-04,  2.32516771e-04,
         -6.90639031e-05,  8.57776731e-05,  2.60413254e-04,
          8.45897653e-05, -2.02608509e-04, -1.23835086e-04,
          1.48978993e-04,  9.75446086e-05, -2.65016650e-05,
         -3.61509901e-07,  9.14133333e-05,  6.70916578e-05,
         -6.88413280e-04,  7.05461730e-04,  2.40222644e-03]]),
 'dloglike': 0.0001458001061109826,
 'edm': 0.0002503984850541394,
 'errors': array([0.07113003, 0.13876951, 1.4103957 , 0.56327771, 0.05534538,
        0.1889185 , 0.08061457, 0.10888297, 0.13831382, 0.12501587,
        0.06175989, 0.20632529, 0.11160342, 0.08672306, 0.11969093,
        0.09231346, 0.15323099, 0.06254178, 0.09602424, 0.16350701,
        0.10045753, 0.02025255, 0.02364644, 0.04901251]),
 'fit_quality': 3,
 'fit_status': 0,
 'fit_success': True,
 'indices': array([ 0,  1,  3,  4,  6,  7,  8, 10, 11, 13, 14, 17, 18, 20, 21, 23, 24,
        26, 27, 29, 30, 32, 33, 35]),
 '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': -77883.00088192237,
 'niter': 1,
 'par_names': ['Prefactor',
  'Index',
  'Prefactor',
  'Index',
  'norm',
  'alpha',
  'beta',
  'Prefactor',
  'Index',
  'norm',
  'alpha',
  '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.39538392,  1.94362954,  2.07191975,  3.25877604,  0.59012212,
         1.19264762,  0.57570313,  0.74811706,  2.37595198,  1.51185817,
         2.46682951,  1.26822259,  1.99775289,  0.52935079,  2.27543711,
         0.4487337 ,  2.3544816 ,  0.57386554,  2.01149183,  1.42865223,
         2.03646131,  0.94353891, -0.02082148,  0.91325844])}

In [36]:
print gta.roi['3FGL J0059.0-7242e']['param_names']
print gta.roi['3FGL J0059.0-7242e']['param_values']
print gta.roi['3FGL J0059.0-7242e']['param_errors']


['norm' 'alpha' 'beta' 'Eb' '' '' '' '' '' '']
[1.51185817e-11 2.46682951e+00 0.00000000e+00 6.65532043e+02
            nan            nan            nan            nan
            nan            nan]
[1.25015869e-12 6.17598948e-02            nan            nan
            nan            nan            nan            nan
            nan            nan]

As you can see above the tool gta.set_source_spectrum has modified the SED shape from PowerLaw to LogParabola.

It is also possible to set the spatial morphology of a source using gta.set_source_morphology


In [37]:
help(gta.set_source_morphology)


Help on method set_source_morphology in module fermipy.gtanalysis:

set_source_morphology(self, name, **kwargs) method of fermipy.gtanalysis.GTAnalysis instance
    Set the spatial model of a source.
    
    Parameters
    ----------
    name : str
       Source name.
    
    spatial_model : str
       Spatial model name (PointSource, RadialGaussian, etc.).
    
    spatial_pars : dict
       Dictionary of spatial parameters (optional).
    
    use_cache : bool        
       Generate the spatial model by interpolating the cached source
       map.
    
    use_pylike : bool


In [38]:
gta.set_source_morphology(name='3FGL J0029.1-7045',spatial_model='RadialGaussian',spatial_pars={'SpatialWidth': 1.0} )

In [39]:
gta.print_model()
print gta.roi['3FGL J0029.1-7045']['SpatialType']
print gta.roi['3FGL J0029.1-7045']['SpatialWidth']


2018-03-31 09:17:12 INFO    GTAnalysis.print_model(): 
sourcename            offset    norm  eflux     index        ts       npred free
--------------------------------------------------------------------------------
3FGL J0059.0-7242e     0.088   1.512  1.12e-05   2.47    753.09      1532.2    *
3FGL J0112.9-7506      2.572   1.268  2.14e-06   2.00    152.13       140.7    *
3FGL J0023.9-7203      2.654   0.590  9.68e-06   2.70   4888.53      1770.7    *
3FGL J0029.1-7045      3.008   0.748   3.1e-06   2.38     89.43       379.6    *
3FGL J0021.6-6835      5.122   2.072  2.11e-07   3.26     10.91        46.4    *
3FGL J2351.9-7601      5.495   1.429  2.81e-06   2.04    237.30       198.5    *
3FGL J2338.7-7401      5.777   0.574  2.82e-06   2.01    257.49       179.2    *
3FGL J0146.4-6746      6.423   0.529  1.65e-06   2.28    192.11       170.3    *
3FGL J2336.5-7620      6.454   0.449  1.28e-06   2.35    119.62       148.0    *
3FGL J0002.0-6722      7.153   0.395   1.7e-06   1.94     86.64        92.7    *
isodiff                  ---   0.913    0.0286   2.12   1145.15      8289.4    *
galdiff                  ---   0.944     0.122  -0.02   5108.78     17184.0    *

RadialGaussian
1.0