# Output File¶

The current state of the ROI can be written at any point by calling
`write_roi`

.

```
>>> gta.write_roi('output.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`

:

```
>>> o = np.load('output.npy').flat[0]
>>> print(o.keys())
['roi', 'config', 'sources','version']
```

The output file is organized in four top-level of dictionaries:

Key | Type | Description |
---|---|---|

`roi` |
dict | A dictionary containing information about the ROI as a whole. |

`sources` |
dict | A dictionary containing information for individual sources in the model (diffuse and point-like). Each element of this dictionary maps to a single source in the ROI model. |

`config` |
dict | The configuration dictionary of the `GTAnalysis` instance. |

`version` |
str | The version of the fermiPy package that was used to run the analysis. This is automatically generated from the git release tag. |

## ROI Dictionary¶

## Source Dictionary¶

The `sources`

dictionary contains one element per source keyed to the
source name. The following table lists the elements of the source
dictionary and their descriptions.

Key | Type | Description |
---|---|---|

`name` |
str | Name of the source. |

`SpatialModel` |
str | Spatial model. |

`SpatialWidth` |
float | Spatial size |

`SpatialType` |
str | Spatial type |

`SourceType` |
str | Source size |

`SpectrumType` |
str | Spectrum type |

`Spatial_Filename` |
str | Path to spatial template associated to this source. |

`filefunction` |
str | Path to file function associated to this source. |

`ra` |
float | Right ascension. |

`dec` |
float | Declination. |

`glon` |
float | Galactic Longitude. |

`glat` |
float | Galactic Latitude. |

`offset_ra` |
float | Angular offset from ROI center along RA. |

`offset_dec` |
float | Angular offset from ROI center along DEC |

`offset_glon` |
float | Angular offset from ROI center along GLON. |

`offset_glat` |
float | Angular offset from ROI center along GLAT. |

`offset` |
float | Angular offset from ROI center. |

`pos_sigma` |
float | 1-sigma uncertainty (deg) on the source position. |

`pos_sigma_semimajor` |
float | 1-sigma uncertainty (deg) on the source position along major axis. |

`pos_sigma_semiminor` |
float | 1-sigma uncertainty (deg) on the source position along minor axis. |

`pos_angle` |
float | Position angle (deg) of the positional uncertainty ellipse. |

`pos_r68` |
float | 68% uncertainty (deg) on the source position. |

`pos_r95` |
float | 95% uncertainty (deg) on the source position. |

`pos_r99` |
float | 99% uncertainty (deg) on the source position. |

`ts` |
float | Source test statistic. |

`loglike` |
float | Log-likelihood of the model evaluated at the best-fit normalization of the source. |

`dloglike_scan` |
`ndarray` |
Delta Log-likelihood values for likelihood scan of source normalization. |

`eflux_scan` |
`ndarray` |
Energy flux values for likelihood scan of source normalization. |

`flux_scan` |
`ndarray` |
Flux values for likelihood scan of source normalization. |

`npred` |
float | Number of predicted counts from this source integrated over the analysis energy range. |

`params` |
dict | Dictionary of spectral parameters. |

`correlation` |
dict | Dictionary of correlation coefficients. |

`model_counts` |
`ndarray` |
Vector of predicted counts for this source in each analysis energy bin. |

`sed` |
dict | Output of SED analysis. See SED Analysis for more information. |

`extension` |
dict | Output of extension analysis. See Extension Fitting for more information. |

`localize` |
dict | Output of localization analysis. See Source Localization for more information. |

`pivot_energy` |
float | Decorrelation energy. |

`flux` |
`ndarray` |
Photon flux and uncertainty (\(\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) integrated over analysis energy range |

`flux100` |
`ndarray` |
Photon flux and uncertainty (\(\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) integrated from 100 MeV to 316 GeV. |

`flux1000` |
`ndarray` |
Photon flux and uncertainty (\(\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) integrated from 1 GeV to 316 GeV. |

`flux10000` |
`ndarray` |
Photon flux and uncertainty (\(\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) integrated from 10 GeV to 316 GeV. |

`eflux` |
`ndarray` |
Energy flux and uncertainty (\(\mathrm{MeV}~\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) integrated over analysis energy range |

`eflux100` |
`ndarray` |
Energy flux and uncertainty (\(\mathrm{MeV}~\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) integrated from 100 MeV to 316 GeV. |

`eflux1000` |
`ndarray` |
Energy flux and uncertainty (\(\mathrm{MeV}~\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) integrated from 1 GeV to 316 GeV. |

`eflux10000` |
`ndarray` |
Energy flux and uncertainty (\(\mathrm{MeV}~\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) integrated from 10 GeV to 316 GeV. |

`dfde` |
`ndarray` |
Differential photon flux and uncertainty (\(\mathrm{cm}^{-2}~\mathrm{s}^{-1}~\mathrm{MeV}^{-1}\)) evaluated at the pivot energy. |

`dfde100` |
`ndarray` |
Differential photon flux and uncertainty (\(\mathrm{cm}^{-2}~\mathrm{s}^{-1}~\mathrm{MeV}^{-1}\)) evaluated at 100 MeV. |

`dfde1000` |
`ndarray` |
Differential photon flux and uncertainty (\(\mathrm{cm}^{-2}~\mathrm{s}^{-1}~\mathrm{MeV}^{-1}\)) evaluated at 1 GeV. |

`dfde10000` |
`ndarray` |
Differential photon flux and uncertainty (\(\mathrm{cm}^{-2}~\mathrm{s}^{-1}~\mathrm{MeV}^{-1}\)) evaluated at 10 GeV. |

`dfde_index` |
`ndarray` |
Logarithmic slope of the differential photon spectrum evaluated at the pivot energy. |

`dfde100_index` |
`ndarray` |
Logarithmic slope of the differential photon spectrum evaluated at 100 MeV. |

`dfde1000_index` |
`ndarray` |
Logarithmic slope of the differential photon spectrum evaluated evaluated at 1 GeV. |

`dfde10000_index` |
`ndarray` |
Logarithmic slope of the differential photon spectrum evaluated at 10 GeV. |

`e2dfde` |
`ndarray` |
E^2 times the differential photon flux and uncertainty (\(\mathrm{MeV}~\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) evaluated at the pivot energy. |

`e2dfde100` |
`ndarray` |
E^2 times the differential photon flux and uncertainty (\(\mathrm{MeV}~\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) evaluated at 100 MeV. |

`e2dfde1000` |
`ndarray` |
E^2 times the differential photon flux and uncertainty (\(\mathrm{MeV}~\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) evaluated at 1 GeV. |

`e2dfde10000` |
`ndarray` |
E^2 times the differential photon flux and uncertainty (\(\mathrm{MeV}~\mathrm{cm}^{-2}~\mathrm{s}^{-1}\)) evaluated at 10 GeV. |