Commit f722fd731b4f6ea9fb5ae15f682d9c4c59d2f9b6

Authored by Andreas Specovius
Committed by Luigi Tibaldo
1 parent 35e623eb

Added new class member _excl_reg_map and new combined getter and setter for that…

… member. Also took care about pickling.
Showing 1 changed file with 45 additions and 19 deletions
cscripts/cslightcrv.py
... ... @@ -73,12 +73,13 @@ class cslightcrv(ctools.csobservation):
73 73 self._init_csobservation(self.__class__.__name__, ctools.__version__, argv)
74 74  
75 75 # Initialise some members
76   - self._srcname = ''
77   - self._tbins = gammalib.GGti()
78   - self._onoff = False
79   - self._stacked = False
80   - self._fits = gammalib.GFits()
81   - self._nthreads = 0
  76 + self._srcname = ''
  77 + self._tbins = gammalib.GGti()
  78 + self._onoff = False
  79 + self._stacked = False
  80 + self._fits = gammalib.GFits()
  81 + self._nthreads = 0
  82 + self._excl_reg_map = None # Exclusion region map for on/off analysis
82 83  
83 84 # Return
84 85 return
... ... @@ -94,13 +95,14 @@ class cslightcrv(ctools.csobservation):
94 95 Pickled instance
95 96 """
96 97 # Set pickled dictionary
97   - state = {'base' : ctools.csobservation.__getstate__(self),
98   - 'srcname' : self._srcname,
99   - 'tbins' : self._tbins,
100   - 'stacked' : self._stacked,
101   - 'onoff' : self._onoff,
102   - 'fits' : self._fits,
103   - 'nthreads' : self._nthreads}
  98 + state = {'base' : ctools.csobservation.__getstate__(self),
  99 + 'srcname' : self._srcname,
  100 + 'tbins' : self._tbins,
  101 + 'stacked' : self._stacked,
  102 + 'onoff' : self._onoff,
  103 + 'fits' : self._fits,
  104 + 'nthreads' : self._nthreads,
  105 + 'excl_reg_map' : self._excl_reg_map}
104 106  
105 107 # Return pickled dictionary
106 108 return state
... ... @@ -115,12 +117,13 @@ class cslightcrv(ctools.csobservation):
115 117 Pickled instance
116 118 """
117 119 ctools.csobservation.__setstate__(self, state['base'])
118   - self._srcname = state['srcname']
119   - self._tbins = state['tbins']
120   - self._onoff = state['onoff']
121   - self._stacked = state['stacked']
122   - self._fits = state['fits']
123   - self._nthreads = state['nthreads']
  120 + self._srcname = state['srcname']
  121 + self._tbins = state['tbins']
  122 + self._onoff = state['onoff']
  123 + self._stacked = state['stacked']
  124 + self._fits = state['fits']
  125 + self._nthreads = state['nthreads']
  126 + self._excl_reg_map = state['excl_reg_map']
124 127  
125 128 # Return
126 129 return
... ... @@ -733,6 +736,29 @@ class cslightcrv(ctools.csobservation):
733 736 # Return
734 737 return
735 738  
  739 + def exclregmap(self, regmapobj=None):
  740 + """
  741 + Access exclusion region map object
  742 +
  743 + Parameters
  744 + ----------
  745 + regmapobj : `~gammalib.GSkyRegionMap`
  746 + Excluded regions region map instance
  747 +
  748 + Returns
  749 + -------
  750 + reg : `~gammalib.GSkyRegionMap`
  751 + Excluded regions region map instance
  752 + """
  753 + # Check if exclusion map object was provided
  754 + if regmapobj is not None:
  755 +
  756 + # Set exclusion region map
  757 + self._excl_reg_map = gammalib.GSkyRegionMap(regmapobj)
  758 +
  759 + # Return
  760 + return self._excl_reg_map
  761 +
736 762  
737 763 # ======================== #
738 764 # Main routine entry point #
... ...