Commit b3076b37b473b09f73d2e39f1465f813f3a13d10

Authored by Jürgen Knödlseder
1 parent 434bacee

Add hidden drwmethod parameter

modules/comscripts/comobsbin.par
... ... @@ -49,7 +49,8 @@ psdmin, i, h, 0,0,110, "Minimum PSD value"
49 49 psdmax, i, h, 110,0,110, "Maximum PSD value"
50 50 zetamin, r, h, 5.0,0.0,10.0, "Minimum Earth horizon - Phibar (zeta) angle (deg)"
51 51 fpmtflag, i, h, 0,0,2, "Handling of D2 modules with failed PMT flag (0: exclude, 1: include, 2: exclude PMT)"
52   -timebin, r, h, 300.0,,, "Internal time bin for DRW computation (sec)"
  52 +drwmethod, s, h, PHIBAR,PHIBAR|VETORATE,, "DRW computation method"
  53 +timebin, r, h, 300.0,,, "Internal time bin for DRW PHIBAR computation (sec)"
53 54 d1use, s, h, 1111111,,, "D1 module usage (1: use, 0: don't use)"
54 55 d2use, s, h, 11111111111111,,, "D2 module usage (1: use, 0: don't use)"
55 56  
... ...
modules/comscripts/comobsbin.py
... ... @@ -86,6 +86,7 @@ class comobsbin(ctools.csobservation):
86 86 self['psdmax'].integer()
87 87 self['zetamin'].real()
88 88 self['fpmtflag'].integer()
  89 + self['drwmethod'].string()
89 90 self['timebin'].real()
90 91  
91 92 # Get D1 and D2 module usage strings
... ... @@ -217,6 +218,7 @@ class comobsbin(ctools.csobservation):
217 218 phases = self['phase'].string()
218 219 self._dre_suffix = suffix+phases.replace(';', '_')
219 220 self._drg_suffix = suffix
  221 + self._drw_suffix = suffix
220 222 self._drx_suffix = suffix
221 223  
222 224 # ... otherwise handle orbital phase selection
... ... @@ -245,6 +247,7 @@ class comobsbin(ctools.csobservation):
245 247 phases = self['phase'].string()
246 248 self._dre_suffix = suffix+phases.replace(';', '_')
247 249 self._drg_suffix = suffix+phases.replace(';', '_')
  250 + self._drw_suffix = suffix+phases.replace(';', '_')
248 251 self._drx_suffix = suffix+phases.replace(';', '_')
249 252  
250 253 # If PSD interval differs from standard interval then set the interval
... ... @@ -260,10 +263,11 @@ class comobsbin(ctools.csobservation):
260 263 self['psdmax'].integer())
261 264  
262 265 # If zeta angle differs from standard value then append zeta angle to DRE
263   - # and DRG suffix
  266 + # DRG and DRW suffix
264 267 if self['zetamin'].real() != 5.0:
265 268 self._dre_suffix += '_zeta%.1f' % (self['zetamin'].real())
266 269 self._drg_suffix += '_zeta%.1f' % (self['zetamin'].real())
  270 + self._drw_suffix += '_zeta%.1f' % (self['zetamin'].real())
267 271  
268 272 # If handling of D2 modules with failed PMT flag differs from standard then
269 273 # set the flag and append flag to suffix
... ... @@ -272,9 +276,10 @@ class comobsbin(ctools.csobservation):
272 276 # Set handling of D2 modules with failed PMT flag
273 277 self._select.fpmtflag(self['fpmtflag'].integer())
274 278  
275   - # Set DRE and DRG suffix
  279 + # Set DRE, DRG and DRW suffix
276 280 self._dre_suffix += '_fpmt%1d' % (self['fpmtflag'].integer())
277 281 self._drg_suffix += '_fpmt%1d' % (self['fpmtflag'].integer())
  282 + self._drw_suffix += '_fpmt%1d' % (self['fpmtflag'].integer())
278 283  
279 284 # If D1 module usage differs from standard value then set module usage
280 285 # and append usage to DRE and DRG suffix
... ... @@ -288,9 +293,10 @@ class comobsbin(ctools.csobservation):
288 293 else:
289 294 self._select.use_d1(i,False)
290 295  
291   - # Set DRE and DRG suffix
  296 + # Set DRE, DRG and DRW suffix
292 297 self._dre_suffix += '_%s' % (d1use)
293 298 self._drg_suffix += '_%s' % (d1use)
  299 + self._drw_suffix += '_%s' % (d1use)
294 300  
295 301 # If D2 module usage differs from standard value then set module usage
296 302 # and append usage to DRE and DRG suffix
... ... @@ -304,9 +310,10 @@ class comobsbin(ctools.csobservation):
304 310 else:
305 311 self._select.use_d2(i,False)
306 312  
307   - # Set DRE and DRG suffix
  313 + # Set DRE, DRG and DRW suffix
308 314 self._dre_suffix += '_%s' % (d2use)
309 315 self._drg_suffix += '_%s' % (d2use)
  316 + self._drw_suffix += '_%s' % (d2use)
310 317  
311 318 # Log selection set
312 319 self._log_string(gammalib.NORMAL, str(self._select))
... ... @@ -496,19 +503,22 @@ class comobsbin(ctools.csobservation):
496 503 drwnames = []
497 504 engindex = []
498 505  
  506 + # Get DRW method in lower case
  507 + drwmethod = gammalib.tolower(self['drwmethod'].string())
  508 +
499 509 # Generate one DRW for each energy boundary
500 510 for i in range(ebounds.size()):
501 511  
502 512 # Set DRW filename in output folder
503   - drwname = '%s/%s%s_drw%s_%6.6d-%6.6dkeV.fits' % \
504   - (self['outfolder'].string(), obs.id(), dri_prefix, self._drw_suffix,
505   - ebounds.emin(i).keV(), ebounds.emax(i).keV())
  513 + drwname = '%s/%s%s_drw-%s%s_%6.6d-%6.6dkeV.fits' % \
  514 + (self['outfolder'].string(), obs.id(), dri_prefix, drwmethod,
  515 + self._drw_suffix, ebounds.emin(i).keV(), ebounds.emax(i).keV())
506 516 drwfile = gammalib.GFilename(drwname)
507 517  
508 518 # Set DRW filename in global data store
509   - drwname_global = '%s/%s%s_drw%s_%6.6d-%6.6dkeV.fits' % \
510   - (self._global_datastore, obs.id(), dri_prefix, self._drw_suffix,
511   - ebounds.emin(i).keV(), ebounds.emax(i).keV())
  519 + drwname_global = '%s/%s%s_drw-%s%s_%6.6d-%6.6dkeV.fits' % \
  520 + (self._global_datastore, obs.id(), dri_prefix, drwmethod,
  521 + self._drw_suffix, ebounds.emin(i).keV(), ebounds.emax(i).keV())
512 522 drwfile_global = gammalib.GFilename(drwname_global)
513 523  
514 524 # Write header
... ... @@ -553,7 +563,8 @@ class comobsbin(ctools.csobservation):
553 563  
554 564 # Compute DRWs
555 565 drws.compute_drws(obs, self._select, self['zetamin'].real(),
556   - self['timebin'].real())
  566 + self['timebin'].real(),
  567 + drwmethod)
557 568  
558 569 # Phibar normalise DRWs to DREs
559 570 for i in range(drws.size()):
... ...