forked from fermiPy/fermipy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
47 lines (28 loc) · 1020 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from fermipy.gtanalysis import GTAnalysis
import argparse
usage = "usage: %(prog)s [config file]"
description = "Run fermipy analysis chain."
parser = argparse.ArgumentParser(usage=usage,description=description)
parser.add_argument('--config', default = 'sample_config.yaml')
args = parser.parse_args()
gta = GTAnalysis(args.config)
gta.setup()
# Iteratively optimize all components in the ROI
gta.optimize()
# Fix sources w/ TS < 10
gta.free_sources(minmax_ts=[None,10],free=False)
# Free sources within 3 degrees of ROI center
gta.free_sources(distance=3.0)
# Free sources by name
gta.free_source('mkn421')
gta.free_source('galdiff')
gta.free_source('isodiff')
# Free only the normalization of a specific source
gta.free_norm('3FGL J1129.0+3705')
gta.fit()
# Compute the SED for a source
gta.sed('mkn421')
# Write the current state of the ROI model -- this will generate XML
# model files for each component as well as an output analysis
# dictionary in numpy and yaml formats
gta.write_roi('fit1')