Commit 0f0fab7938b5d21f05b6ace64a589f281472c6a3

Authored by Jürgen Knödlseder
1 parent 679001d7

csphagen now creates appropriate model for likelihood fitting (#2711)

ChangeLog
1   -2018-11-22
  1 +2018-11-23
2 2  
3 3 * Version 1.6.0 released
4 4 ========================
... ... @@ -8,6 +8,7 @@
8 8 Apply event bin weighting in ctmodel for stacked computation (#2721)
9 9 Enable ctbin to produce counts cubes for a joint binned analysis (#2714)
10 10 Add Jupyter notebooks for H.E.S.S. DR1 (#2712)
  11 + csphagen now creates appropriate model for likelihood fitting (#2711)
11 12 csphagen now supports any kind of background model (#2710)
12 13 Add code generator (#2709)
13 14 Add csbkgmodel script (#2694)
... ...
1 1 New Features and Important Changes in ctools 1.6.0
2 2  
3   -22 November 2018
  3 +23 November 2018
4 4  
5 5  
6 6 Introduction
... ... @@ -328,6 +328,11 @@ Use time reference of input observations if time selection is given in MET
328 328  
329 329 csphagen - Generate On/Off observations
330 330 ---------------------------------------
  331 +A "outmodel" parameter was added and the script now produces an appropriate
  332 +background model for maximum likelihood model fitting. The script now also
  333 +sets the appropriate fit statistic depending on the "use_model_bkg" parameter
  334 +(#2711).
  335 +
331 336 The script now supports any kind of background model, not only IRF background
332 337 models (#2710).
333 338  
... ...
cscripts/csphagen.par
... ... @@ -22,7 +22,8 @@ srcname, s, a, Crab,,, "Source name"
22 22 caldb, s, a, prod2,,, "Calibration database"
23 23 irf, s, a, South_0.5h,,, "Instrument response function"
24 24 inexclusion, f, h, NONE,,, "Sky map of exclusion regions"
25   -outobs, s, a, onoff_obs.xml,,, "Output observation definition XML file"
  25 +outobs, f, a, onoff_obs.xml,,, "Output observation definition XML file"
  26 +outmodel, f, a, onoff_model.xml,,, "Output model definition XML file"
26 27 prefix, s, h, onoff,,, "Prefix for output files"
27 28  
28 29 #
... ...
cscripts/csphagen.py
... ... @@ -49,7 +49,6 @@ class csphagen(ctools.csobservation):
49 49 self._src_reg = gammalib.GSkyRegions()
50 50 self._models = gammalib.GModels()
51 51 self._srcname = ''
52   - self._use_model_bkg = True
53 52 self._bkg_regs = []
54 53 self._excl_reg = None
55 54 self._has_exclusion = False
... ... @@ -78,7 +77,6 @@ class csphagen(ctools.csobservation):
78 77 'src_reg' : self._src_reg,
79 78 'models' : self._models,
80 79 'srcname' : self._srcname,
81   - 'use_model_bkg' : self._use_model_bkg,
82 80 'bkg_regs' : self._bkg_regs,
83 81 'excl_reg' : self._excl_reg,
84 82 'has_exclusion' : self._has_exclusion,
... ... @@ -105,7 +103,6 @@ class csphagen(ctools.csobservation):
105 103 self._src_reg = state['src_reg']
106 104 self._models = state['models']
107 105 self._srcname = state['srcname']
108   - self._use_model_bkg = state['use_model_bkg']
109 106 self._bkg_regs = state['bkg_regs']
110 107 self._excl_reg = state['excl_reg']
111 108 self._has_exclusion = state['has_exclusion']
... ... @@ -261,12 +258,14 @@ class csphagen(ctools.csobservation):
261 258 else:
262 259 self._has_exclusion = False
263 260  
264   - # Query remaining parametersStacking
  261 + # Query remaining parameters
  262 + self['use_model_bkg'].boolean()
265 263 self['stack'].boolean()
266 264  
267 265 # Query ahead output parameters
268 266 if (self._read_ahead()):
269   - self['outobs'].string()
  267 + self['outobs'].filename()
  268 + self['outmodel'].filename()
270 269 self['prefix'].string()
271 270  
272 271 # If there are no observations in container then get them from the
... ... @@ -292,7 +291,7 @@ class csphagen(ctools.csobservation):
292 291 model.name('Dummy')
293 292 self._models.append(model)
294 293 self._srcname = 'Dummy'
295   - self._use_model_bkg = False
  294 + self['use_model_bkg'].boolean(False)
296 295  
297 296 # Return
298 297 return
... ... @@ -361,41 +360,109 @@ class csphagen(ctools.csobservation):
361 360 # Return reflected regions
362 361 return regions
363 362  
364   - def _set_models(self, obs):
  363 + def _set_models(self, results):
365 364 """
366   - Set models in observation container
  365 + Set models for On/Off fitting
367 366  
368   - The method replaces all "CTA", "HESS", "VERITAS", and "MAGIC"
369   - background models by "CTAOnOff" background models.
  367 + The method does the following
  368 + - append "OnOff" to the instrument name of all background models
  369 + - fix all spatial and temporal parameters
370 370  
371 371 Parameters
372 372 ----------
373   - obs : `~gammalib.GObservations()`
374   - Observation container
  373 + results : list of dict
  374 + Result dictionaries
375 375  
376 376 Returns
377 377 -------
378   - obs : `~gammalib.GObservations()`
379   - Observation container
  378 + models : `~gammalib.GModels()`
  379 + Model container
380 380 """
  381 + # Write header
  382 + self._log_header1(gammalib.NORMAL, 'Set models')
  383 +
381 384 # Initialise model container
382 385 models = gammalib.GModels()
383 386  
384   - # Loop over all models and replace CTA/HESS/VERITAS/MAGIC background
385   - # models by CTAOnOff background model
386   - for model in self.obs().models():
  387 + # Initialies stacked model flag
  388 + has_stacked_model = False
  389 +
  390 + # Loop over all models in observation and append "OnOff" to instrument
  391 + # names
  392 + for model in self._models:
  393 +
  394 + # If model is a background model then append "OnOff"
387 395 if 'GCTA' in model.classname():
388   - if 'CTA' in model.instruments() or \
389   - 'HESS' in model.instruments() or \
390   - 'VERITAS' in model.instruments() or \
391   - 'MAGIC' in model.instruments():
392   - model.instruments('CTAOnOff')
  396 +
  397 + # Skip model is background model should not be used
  398 + if not self['use_model_bkg'].boolean():
  399 + self._log_string(gammalib.NORMAL, ' Skip "%s" model "%s" (%s)' % \
  400 + (model.instruments(), model.name(), model.ids()))
  401 + continue
  402 +
  403 + # Check if model corresponds to one of the relevant
  404 + # observations
  405 + is_onoff = False
  406 + for result in results:
  407 + if model.is_valid(result['instrument'], result['id']):
  408 + is_onoff = True
  409 + break
  410 +
  411 + # If stacked analysis is requested then just use for model
  412 + # and remove instrument ID
  413 + if self['stack'].boolean():
  414 +
  415 + # If there is already a model for stacked analysis then
  416 + # skip this one
  417 + if has_stacked_model:
  418 + msg = ' Skip "%s" model "%s" (%s). There is already ' \
  419 + 'a model for stacked analysis.' % \
  420 + (model.instruments(), model.name(), model.ids())
  421 + self._log_string(gammalib.NORMAL, msg)
  422 + continue
  423 +
  424 + # ... otherwise use model for stacked analysis
  425 + else:
  426 + has_stacked_model = True
  427 + model.ids('')
  428 +
  429 + # Set instrument name
  430 + model.instruments(model.instruments()+'OnOff')
  431 +
  432 + # Log model usage
  433 + self._log_string(gammalib.NORMAL, ' Use "%s" model "%s" (%s)' % \
  434 + (model.instruments(), model.name(), model.ids()))
  435 +
  436 + # Append model to container
393 437 models.append(model)
394 438  
395   - # Append model to observation container
396   - obs.models(models)
  439 + # Return model container
  440 + return models
397 441  
398   - # Return observation container
  442 + def _set_statistic(self, obs):
  443 + """
  444 + Set statistic for observation
  445 +
  446 + If the "use_model_bkg" is true then set statistic to "cstat",
  447 + otherwise set it to "wstat"
  448 +
  449 + Parameters
  450 + ----------
  451 + obs : `~gammalib.GObservation()`
  452 + Observation
  453 +
  454 + Returns
  455 + -------
  456 + obs : `~gammalib.GObservation()`
  457 + Observation
  458 + """
  459 + # Set statistic according to background model usage
  460 + if self['use_model_bkg'].boolean():
  461 + obs.statistic('cstat')
  462 + else:
  463 + obs.statistic('wstat')
  464 +
  465 + # Return observation
399 466 return obs
400 467  
401 468 def _etrue_ebounds(self):
... ... @@ -494,7 +561,7 @@ class csphagen(ctools.csobservation):
494 561 # Otherwise calculate On/Off spectra
495 562 else:
496 563 # Log current observation
497   - self._log_string(gammalib.NORMAL, 'Process observation "%s"' % \
  564 + self._log_string(gammalib.NORMAL, ' Process observation "%s"' % \
498 565 (obs.id()))
499 566  
500 567 # Set background regions for this observation
... ... @@ -503,7 +570,7 @@ class csphagen(ctools.csobservation):
503 570 # Get IRF background template usage flag
504 571 use_model_bkg = self['use_model_bkg'].boolean()
505 572 if not use_model_bkg:
506   - self._log_string(gammalib.NORMAL, 'Background model not used, '
  573 + self._log_string(gammalib.NORMAL, ' Background model not used, '
507 574 'assume constant backround rate.')
508 575  
509 576 # If there are background regions then create On/Off observation
... ... @@ -520,13 +587,14 @@ class csphagen(ctools.csobservation):
520 587 onoff.id(obs.id())
521 588  
522 589 else:
523   - self._log_string(gammalib.NORMAL, 'Observation %s not included '
  590 + self._log_string(gammalib.NORMAL, ' Observation %s not included '
524 591 'in spectra generation' % (obs.id()))
525 592  
526 593 # Construct dictionary with results
527   - result = {'onoff' : onoff,
528   - 'bkg_reg' : bkg_reg,
529   - 'id' : obs.id()}
  594 + result = {'onoff' : onoff,
  595 + 'bkg_reg' : bkg_reg,
  596 + 'instrument': obs.instrument(),
  597 + 'id' : obs.id()}
530 598  
531 599 # Return results
532 600 return result
... ... @@ -549,12 +617,15 @@ class csphagen(ctools.csobservation):
549 617 """
550 618 # Continue only if result is valid
551 619 if result['onoff'] != None:
552   -
  620 +
553 621 # If the results contain an On/Off observation
554 622 if result['onoff'].classname() == 'GCTAOnOffObservation':
555 623  
  624 + # Set statistic according to background model usage
  625 + obs = self._set_statistic(result['onoff'])
  626 +
556 627 # Append observation to observation container
557   - outobs.append(result['onoff'])
  628 + outobs.append(obs)
558 629  
559 630 # Append background regions
560 631 self._bkg_regs.append({'regions': result['bkg_reg'],
... ... @@ -598,6 +669,7 @@ class csphagen(ctools.csobservation):
598 669 # Initialise run variables
599 670 outobs = gammalib.GObservations()
600 671 self._bkg_regs = []
  672 + results = []
601 673  
602 674 # If there is more than one observation and we use multiprocessing
603 675 if self._nthreads > 1 and self.obs().size() > 1:
... ... @@ -609,7 +681,9 @@ class csphagen(ctools.csobservation):
609 681  
610 682 # Construct results
611 683 for i in range(self.obs().size()):
612   - outobs = self._unpack_result(outobs,poolresults[i][0])
  684 + result = poolresults[i][0]
  685 + outobs = self._unpack_result(outobs, result)
  686 + results.append(result)
613 687 self._log_string(gammalib.TERSE, poolresults[i][1]['log'], False)
614 688  
615 689 # Otherwise, loop through observations and generate pha, arf, rmf files
... ... @@ -618,9 +692,10 @@ class csphagen(ctools.csobservation):
618 692 # Process individual observation
619 693 result = self._process_observation(i)
620 694 outobs = self._unpack_result(outobs, result)
  695 + results.append(result)
621 696  
622 697 # Stack observations
623   - if outobs.size() > 1 and self['stack'].boolean() == True:
  698 + if outobs.size() > 1 and self['stack'].boolean():
624 699  
625 700 # Write header
626 701 self._log_header1(gammalib.NORMAL, 'Stacking %d observations' %
... ... @@ -629,12 +704,18 @@ class csphagen(ctools.csobservation):
629 704 # Stack observations
630 705 stacked_obs = gammalib.GCTAOnOffObservation(outobs)
631 706  
  707 + # Set statistic according to background model usage
  708 + stacked_obs = self._set_statistic(stacked_obs)
  709 +
632 710 # Put stacked observations in output container
633 711 outobs = gammalib.GObservations()
634 712 outobs.append(stacked_obs)
635 713  
  714 + # Create models that allow On/Off fitting
  715 + models = self._set_models(results)
  716 +
636 717 # Set models in output container
637   - outobs = self._set_models(outobs)
  718 + outobs.models(models)
638 719  
639 720 # Set observation container
640 721 self.obs(outobs)
... ... @@ -650,9 +731,10 @@ class csphagen(ctools.csobservation):
650 731 self._log_header1(gammalib.TERSE, 'Save data')
651 732  
652 733 # Get XML output filename, prefix and clobber
653   - outobs = self['outobs'].string()
654   - prefix = self['prefix'].string()
655   - clobber = self['clobber'].boolean()
  734 + outobs = self['outobs'].filename()
  735 + outmodel = self['outmodel'].filename()
  736 + prefix = self['prefix'].string()
  737 + clobber = self['clobber'].boolean()
656 738  
657 739 # Loop over all observation in container
658 740 for obs in self.obs():
... ... @@ -694,8 +776,12 @@ class csphagen(ctools.csobservation):
694 776 # Save observation definition XML file
695 777 self.obs().save(outobs)
696 778  
697   - # Log file name
698   - self._log_value(gammalib.NORMAL, 'Obs. definition XML file', outobs)
  779 + # Save model definition XML file
  780 + self.obs().models().save(outmodel)
  781 +
  782 + # Log file names
  783 + self._log_value(gammalib.NORMAL, 'Obs. definition XML file', outobs.url())
  784 + self._log_value(gammalib.NORMAL, 'Model definition XML file', outmodel.url())
699 785  
700 786 # Save ds9 On region file
701 787 regname = prefix + '_on.reg'
... ...
doc/source/admin/release_history/1.6.rst
... ... @@ -50,6 +50,8 @@ Improvements
50 50 Rename ``outcube`` to ``outobs`` parameter.
51 51 * [`2712 <https://cta-redmine.irap.omp.eu/issues/2712>`_] -
52 52 Add Jupyter notebooks for H.E.S.S. DR1
  53 +* [`2711 <https://cta-redmine.irap.omp.eu/issues/2711>`_] -
  54 + :ref:`csphagen` now creates appropriate model for likelihood fitting
53 55 * [`2685 <https://cta-redmine.irap.omp.eu/issues/2685>`_] -
54 56 Add ``ctbkgcube::cntcube()`` method
55 57 Account for varying energy thresholds in :ref:`ctbin` weight computation
... ...
doc/source/users/reference_manual/csphagen.rst
... ... @@ -66,10 +66,6 @@ script will write out:
66 66 General parameters
67 67 ------------------
68 68  
69   -
70   -``(nthreads = 0) [integer]``
71   - Number of parallel processes (0=use all available CPUs).
72   -
73 69 ``inobs [file]``
74 70 Input event list or observation definition XML file.
75 71  
... ... @@ -91,9 +87,12 @@ General parameters
91 87 Optional FITS file containing a WCS map in the first extension that defines
92 88 sky regions not to be used for background estimation (where map value != 0).
93 89  
94   -``outobs [string]``
  90 +``outobs [file]``
95 91 Output observation definition XML file.
96 92  
  93 +``outmodel [file]``
  94 + Output model XML file.
  95 +
97 96 ``(prefix = onoff) [string]``
98 97 Prefix of the file name for output PHA, ARF, RMF, XML, and DS9 region files.
99 98  
... ... @@ -203,6 +202,9 @@ General parameters
203 202 Standard parameters
204 203 -------------------
205 204  
  205 +``(nthreads = 0) [integer]``
  206 + Number of parallel processes (0=use all available CPUs).
  207 +
206 208 ``(chatter = 2) [integer]``
207 209 Verbosity of the executable:
208 210 ``chatter = 0``: no information will be logged
... ... @@ -233,4 +235,3 @@ Related tools or scripts
233 235 ------------------------
234 236  
235 237 None
236   -
... ...
test/test_csphagen.py
... ... @@ -92,7 +92,8 @@ class Test(test):
92 92 ' rad=0.2 stack="no" inexclusion="' + \
93 93 self._exclusion + \
94 94 '" bkgmethod="REFLECTED" '+ \
95   - 'outobs="csphagen_cmd1.xml" prefix="csphagen_cmd1" ' + \
  95 + 'outobs="csphagen_cmd1_obs.xml" prefix="csphagen_cmd1" ' + \
  96 + 'outmodel="csphagen_cmd1_model.xml" ' + \
96 97 'logfile="csphagen_cmd1.log" chatter=2'
97 98  
98 99 # Check if execution was successful
... ... @@ -101,7 +102,7 @@ class Test(test):
101 102  
102 103 # Check output files
103 104 self._check_output('csphagen_cmd1', self._nbins, self._nreg_with_excl)
104   - self._check_outobs('csphagen_cmd1', 1)
  105 + self._check_outobs('csphagen_cmd1_obs.xml', 1)
105 106  
106 107 # Setup csphagen command
107 108 cmd = csphagen + ' inobs="events_that_do_not_exist.fits" ' + \
... ... @@ -114,7 +115,8 @@ class Test(test):
114 115 ' rad=0.2 stack="no" inexclusion="' + \
115 116 self._exclusion + \
116 117 '" bkgmethod="REFLECTED" '+ \
117   - 'outobs="csphagen_cmd2.xml" prefix="csphagen_cmd2" ' + \
  118 + 'outobs="csphagen_cmd2_obs.xml" prefix="csphagen_cmd2" ' + \
  119 + 'outmodel="csphagen_cmd2_model.xml" ' + \
118 120 'logfile="csphagen_cmd2.log" debug=yes chatter=1'
119 121  
120 122 # Check if execution failed
... ... @@ -151,7 +153,8 @@ class Test(test):
151 153 phagen['etruemin'] = 0.05
152 154 phagen['etruemax'] = 150.0
153 155 phagen['etruebins'] = 5
154   - phagen['outobs'] = 'csphagen_py1.xml'
  156 + phagen['outobs'] = 'csphagen_py1_obs.xml'
  157 + phagen['outmodel'] = 'csphagen_py1_model.xml'
155 158 phagen['prefix'] = 'csphagen_py1'
156 159 phagen['logfile'] = 'csphagen_py1.log'
157 160 phagen['chatter'] = 1
... ... @@ -161,7 +164,7 @@ class Test(test):
161 164  
162 165 # Check output
163 166 self._check_output('csphagen_py1', self._nbins, self._nreg_with_excl)
164   - self._check_outobs('csphagen_py1', 1)
  167 + self._check_outobs('csphagen_py1_obs.xml', 1)
165 168  
166 169 # Now test without exclusion region
167 170 phagen = cscripts.csphagen()
... ... @@ -182,7 +185,8 @@ class Test(test):
182 185 phagen['etruemin'] = 0.05
183 186 phagen['etruemax'] = 150.0
184 187 phagen['etruebins'] = 5
185   - phagen['outobs'] = 'csphagen_py2.xml'
  188 + phagen['outobs'] = 'csphagen_py2_obs.xml'
  189 + phagen['outmodel'] = 'csphagen_py2_model.xml'
186 190 phagen['prefix'] = 'csphagen_py2'
187 191 phagen['logfile'] = 'csphagen_py2.log'
188 192 phagen['chatter'] = 2
... ... @@ -192,7 +196,7 @@ class Test(test):
192 196  
193 197 # Check output
194 198 self._check_output('csphagen_py2', self._nbins, self._nreg_wo_excl)
195   - self._check_outobs('csphagen_py2', 1)
  199 + self._check_outobs('csphagen_py2_obs.xml', 1)
196 200  
197 201 # Test with multiple input observations, no stacking
198 202 # Create observation container
... ... @@ -220,7 +224,8 @@ class Test(test):
220 224 phagen['etruemin'] = 0.05
221 225 phagen['etruemax'] = 150.0
222 226 phagen['etruebins'] = 5
223   - phagen['outobs'] = 'csphagen_py3.xml'
  227 + phagen['outobs'] = 'csphagen_py3_obs.xml'
  228 + phagen['outmodel'] = 'csphagen_py3_model.xml'
224 229 phagen['prefix'] = 'csphagen_py3'
225 230 phagen['logfile'] = 'csphagen_py3.log'
226 231 phagen['chatter'] = 3
... ... @@ -232,7 +237,7 @@ class Test(test):
232 237 for s in range(2):
233 238 self._check_output('csphagen_py3_' + str(s + 1), self._nbins,
234 239 self._nreg_mul[s])
235   - self._check_outobs('csphagen_py3', 2)
  240 + self._check_outobs('csphagen_py3_obs.xml', 2)
236 241  
237 242 # Setup csphagen for test with multiple input observations and stacking
238 243 phagen = cscripts.csphagen(obs)
... ... @@ -251,7 +256,8 @@ class Test(test):
251 256 phagen['etruemin'] = 0.05
252 257 phagen['etruemax'] = 150.0
253 258 phagen['etruebins'] = 5
254   - phagen['outobs'] = 'csphagen_py4.xml'
  259 + phagen['outobs'] = 'csphagen_py4_obs.xml'
  260 + phagen['outmodel'] = 'csphagen_py4_model.xml'
255 261 phagen['prefix'] = 'csphagen_py4'
256 262 phagen['logfile'] = 'csphagen_py4.log'
257 263 phagen['chatter'] = 4
... ... @@ -263,7 +269,7 @@ class Test(test):
263 269 for s in range(2):
264 270 self._check_output('csphagen_py4_stacked', self._nbins,
265 271 0, check_regions=False)
266   - self._check_outobs('csphagen_py4', 1)
  272 + self._check_outobs('csphagen_py4_obs.xml', 1)
267 273  
268 274 # Setup csphagen for test with custom On and Off regions provided
269 275 phagen = cscripts.csphagen()
... ... @@ -282,7 +288,8 @@ class Test(test):
282 288 phagen['etruemax'] = 150.0
283 289 phagen['etruebins'] = 5
284 290 phagen['stack'] = False
285   - phagen['outobs'] = 'csphagen_py5.xml'
  291 + phagen['outobs'] = 'csphagen_py5_obs.xml'
  292 + phagen['outmodel'] = 'csphagen_py5_model.xml'
286 293 phagen['prefix'] = 'csphagen_py5'
287 294 phagen['logfile'] = 'csphagen_py5.log'
288 295 phagen['chatter'] = 2
... ... @@ -292,7 +299,7 @@ class Test(test):
292 299  
293 300 # Check output
294 301 self._check_output('csphagen_py5', self._nbins, self._nreg_bkg_reg)
295   - self._check_outobs('csphagen_py5', 1)
  302 + self._check_outobs('csphagen_py5_obs.xml', 1)
296 303  
297 304 # Append off regions to observation container
298 305 for run in obs:
... ... @@ -313,7 +320,8 @@ class Test(test):
313 320 phagen['etruemin'] = 0.05
314 321 phagen['etruemax'] = 150.0
315 322 phagen['etruebins'] = 5
316   - phagen['outobs'] = 'csphagen_py6.xml'
  323 + phagen['outobs'] = 'csphagen_py6_obs.xml'
  324 + phagen['outmodel'] = 'csphagen_py6_model.xml'
317 325 phagen['prefix'] = 'csphagen_py6'
318 326 phagen['logfile'] = 'csphagen_py6.log'
319 327 phagen['chatter'] = 4
... ... @@ -325,7 +333,7 @@ class Test(test):
325 333 for s in range(2):
326 334 self._check_output('csphagen_py6_stacked', self._nbins,
327 335 0, check_regions=False)
328   - self._check_outobs('csphagen_py6', 1)
  336 + self._check_outobs('csphagen_py6_obs.xml', 1)
329 337  
330 338 # Return
331 339 return
... ... @@ -358,7 +366,8 @@ class Test(test):
358 366 phagen['etruemin'] = 0.05
359 367 phagen['etruemax'] = 150.0
360 368 phagen['etruebins'] = 5
361   - phagen['outobs'] = 'csphagen_py1_pickle.xml'
  369 + phagen['outobs'] = 'csphagen_py1_obs_pickle.xml'
  370 + phagen['outmodel'] = 'csphagen_py1_model_pickle.xml'
362 371 phagen['prefix'] = 'csphagen_py1_pickle'
363 372 phagen['logfile'] = 'csphagen_py1_pickle.log'
364 373 phagen['chatter'] = 1
... ... @@ -373,7 +382,7 @@ class Test(test):
373 382  
374 383 # Check result files
375 384 self._check_output('csphagen_py1_pickle', self._nbins, self._nreg_with_excl)
376   - self._check_outobs('csphagen_py1_pickle', 1)
  385 + self._check_outobs('csphagen_py1_obs_pickle.xml', 1)
377 386  
378 387 # Return
379 388 return
... ... @@ -544,7 +553,7 @@ class Test(test):
544 553 Check the output XML file containing ON/OFF observations
545 554 """
546 555 # Load observation container
547   - obs = gammalib.GObservations(filenameroot + '.xml')
  556 + obs = gammalib.GObservations(filenameroot)
548 557  
549 558 # Check container size
550 559 self.test_value(obs.size(), nout, 'Check for ' + str(nout) +
... ...