Skip to content

Commit

Permalink
Attempt to fix gammapy#130 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mireia Nievas authored and Mireia Nievas committed Feb 28, 2019
1 parent 510285d commit 744353c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 10 additions & 8 deletions enrico/RunGTlike.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,23 @@ def run(infile):
#Get and dump the target specific results
Result = FitRunner.GetAndPrintResults(Fit)
utils.DumpResult(Result, config)


# Make energy bins by running a *new* analysis
Nbin = config['Ebin']['NumEnergyBins']

FitRunner.config['file']['parent_config'] = infile

if config['Spectrum']['ResultParentPlots'] == "yes":
plot_sed_fromconfig(get_config(config['file']['parent_config']),ignore_missing_bins=True)

if config['Spectrum']['ResultPlots'] == 'yes' :
outXml = utils._dump_xml(config)
# the possibility of making the model map is checked inside the function
FitRunner.ModelMap(outXml)
FitRunner.config['Spectrum']['ResultParentPlots'] = "yes"
if Nbin>0:
FitRunner.config['Spectrum']['ResultParentPlots'] = "yes"
plot_sed_fromconfig(get_config(infile),ignore_missing_bins=True)

if config['Spectrum']['ResultParentPlots'] == "yes":
plot_sed_fromconfig(get_config(config['file']['parent_config']),ignore_missing_bins=True)

# Make energy bins by running a *new* analysis
Nbin = config['Ebin']['NumEnergyBins']

energybin.RunEbin(folder,Nbin,Fit,FitRunner,sedresult)

del(sedresult)
Expand Down
4 changes: 3 additions & 1 deletion enrico/lightcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ def __init__(self, config, parent_filename=""):
self.config['UpperLimit']['TSlimit'] = self.config['LightCurve']['TSLightCurve']

self.folder = self.config['out']

# Do not create plots
self.config['Spectrum']['ResultPlots'] = 'no' # no
self.config['Spectrum']['ResultParentPlots'] = 'no' # no
self.config['Ebin']['NumEnergyBins'] = 0
self.config['energy']['decorrelation_energy'] = 'yes' # no
self.config['UpperLimit']['envelope'] = 'no'
Expand Down Expand Up @@ -126,6 +127,7 @@ def PrepareLC(self,write = 'no'):
str(self.config['time']['tmin']) + "_" +
str(self.config['time']['tmax'])) + ".xml" #Name of the xml file
self.config['file']['xml'] = xmlfilename
# Do not produce spectral plots

if len(self.gtifile)==1:
self.config['time']['file']=self.gtifile[0]
Expand Down

0 comments on commit 744353c

Please sign in to comment.