Commit 907c41e8ca57cb04672e9b910762c9cfbb67f7b6

Authored by knodlseder
1 parent df92d1f3

Add deadc keyword to set() function, and set the default deadtime correction factor to 0.95.

Showing 1 changed file with 8 additions and 9 deletions
scripts/obsutils.py
... ... @@ -2,7 +2,7 @@
2 2 # This script provides a number of functions that are useful for handling
3 3 # CTA observations.
4 4 #
5   -# Copyright (C) 2011 Jurgen Knodlseder
  5 +# Copyright (C) 2011-2012 Juergen Knoedlseder
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -20,13 +20,6 @@
20 20 # ==========================================================================
21 21 from ctools import *
22 22 from gammalib import *
23   -#from math import *
24   -#import os
25   -#import glob
26   -#import sys
27   -#import csv
28   -#import math
29   -#import random
30 23  
31 24  
32 25 # ===================== #
... ... @@ -272,7 +265,7 @@ def modmap(obs, eref=0.1, proj="TAN", coord="GAL", xval=0.0, yval=0.0, \
272 265 # ======================= #
273 266 # Set one CTA observation #
274 267 # ======================= #
275   -def set(pntdir, tstart=0.0, duration=1800.0, \
  268 +def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \
276 269 emin=0.1, emax=100.0, rad=5.0, \
277 270 irf="kb_E_50h_v3", caldb="$GAMMALIB/share/caldb/cta"):
278 271 """
... ... @@ -284,6 +277,7 @@ def set(pntdir, tstart=0.0, duration=1800.0, \
284 277 Keywords:
285 278 tstart - Start time [seconds] (default: 0.0)
286 279 duration - Duration of observation [seconds] (default: 1800.0)
  280 + deadc - Deadtime correction factor (default: 0.95)
287 281 emin - Minimum event energy [TeV] (default: 0.1)
288 282 emax - Maximum event energy [TeV] (default: 100.0)
289 283 rad - ROI radius used for analysis [deg] (default: 5.0)
... ... @@ -331,5 +325,10 @@ def set(pntdir, tstart=0.0, duration=1800.0, \
331 325 # Set instrument response
332 326 obs.response(irf, caldb)
333 327  
  328 + # Set ontime, livetime, and deadtime correction factor
  329 + obs.ontime(duration)
  330 + obs.livetime(duration*deadc)
  331 + obs.deadc(deadc)
  332 +
334 333 # Return observation
335 334 return obs
... ...