Commit 2232ee35bf54ce70b7520aee08b05b46a5302ea6

Authored by Jürgen Knödlseder
1 parent abedcd6f

Rename CUBE method to 3D

cscripts/cslightcrv.par
... ... @@ -33,10 +33,10 @@ tmin, t, a, MJD 51544.5,,,"Lightcurve start time (UTC string, JD, MJD or ME
33 33 tmax, t, a, MJD 51544.6,,,"Lightcurve stop time (UTC string, JD, MJD or MET in seconds)"
34 34 tbins, i, a, 5,1,10000, "Number of time bins"
35 35 tbinfile, f, a, NONE,,, "File defining the time binning"
36   -method, s, a, CUBE, CUBE|ONOFF,, "Analysis method"
  36 +method, s, a, 3D, 3D|ONOFF,, "Analysis method"
37 37 emin, r, a, 0.1,,, "Lower energy limit of events (TeV)"
38 38 emax, r, a, 100.0,,, "Upper energy limit of events (TeV)"
39   -enumbins, i, a, 0,0,100, "Number of energy bins for binned (0=unbinned for Cube analysis only)"
  39 +enumbins, i, a, 0,0,100, "Number of energy bins for binned (0=unbinned for 3D analysis only)"
40 40 coordsys, s, a, CEL,CEL|GAL,, "Coordinate System"
41 41 proj, s, a, CAR,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
42 42 xref, r, a, 83.63,0,360, "First coordinate of image/source region center in degrees (RA or galactic l)"
... ...
cscripts/cslightcrv.py
... ... @@ -112,7 +112,6 @@ class cslightcrv(ctools.csobservation):
112 112 if not self._onoff:
113 113 self._stacked = self._is_stacked()
114 114  
115   -
116 115 # Query the hidden parameters, just in case
117 116 self['edisp'].boolean()
118 117 self['calc_ulim'].boolean()
... ...
cscripts/csphasecrv.par
... ... @@ -31,10 +31,10 @@ outfile, f, a, phasecrv.fits,,, "Output fits file name."
31 31 phbinalg, s, a, LIN,LIN|FILE,, "Algorithm for defining phase bins"
32 32 phbins, i, a, 5,1,10000, "Number of phase bins"
33 33 phbinfile, f, a, NONE,,, "File defining the phase binning"
34   -method, s, a, CUBE, CUBE|ONOFF,, "Analysis method"
  34 +method, s, a, 3D, 3D|ONOFF,, "Analysis method"
35 35 emin, r, a, 0.1,,, "Lower energy limit of events (TeV)"
36 36 emax, r, a, 100.0,,, "Upper energy limit of events (TeV)"
37   -enumbins, i, a, 0,0,100, "Number of energy bins for binned (0=unbinned for Cube analysis only))"
  37 +enumbins, i, a, 0,0,100, "Number of energy bins for binned (0=unbinned for 3D analysis only))"
38 38 coordsys, s, a, CEL,CEL|GAL,, "Coordinate System"
39 39 proj, s, a, CAR,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method"
40 40 xref, r, a, 83.63,0,360, "First coordinate of image/source region center in degrees (RA or galactic l)"
... ...
cscripts/csphasecrv.py
... ... @@ -242,17 +242,20 @@ class csphasecrv(ctools.csobservation):
242 242  
243 243 # Store fit results
244 244 phname = str(phmin)+'-'+str(phmax)
  245 +
245 246 # If the model contains the source of interest fill results
246 247 try:
247 248 source = self._fitmodels[phname][self._srcname]
248 249 for par in pars:
249 250 result['values'][par] = source[par].value()
250 251 result['values']['e_'+par] = source[par].error()
251   - # Otherwise fills with zeros
  252 +
  253 + # ... otherwise fills with zeros
252 254 except:
253 255 for par in pars:
254 256 result['values'][par] = 0.
255 257 result['values']['e_'+par] = 0.
  258 +
256 259 # Append result to list of dictionaries
257 260 results.append(result)
258 261  
... ...
cscripts/obsutils.py
... ... @@ -761,9 +761,10 @@ def get_stacked_obs(cls, obs):
761 761 # Return new oberservation container
762 762 return new_obs
763 763  
764   -# ================================= #
  764 +
  765 +# ================================ #
765 766 # Get On/Off observation container #
766   -# ================================= #
  767 +# ================================ #
767 768 def get_onoff_obs(cls, obs):
768 769 """
769 770 Create On/Off observations container from given observations
... ... @@ -784,16 +785,17 @@ def get_onoff_obs(cls, obs):
784 785 if cls._logExplicit():
785 786 cls._log.header3('Creating On/Off observations')
786 787  
  788 + # Create On/Off observations
787 789 phagen = cscripts.csphagen(obs)
788 790 phagen['inexclusion'] = cls['inexclusion'].value()
789   - phagen['emin'] = cls['emin'].real()
790   - phagen['emax'] = cls['emax'].real()
791   - phagen['enumbins'] = cls['enumbins'].integer()
792   - phagen['ebinalg'] = 'LOG'
793   - phagen['srcshape'] = cls['srcshape'].string()
794   - phagen['coordsys'] = cls['coordsys'].string()
  791 + phagen['emin'] = cls['emin'].real()
  792 + phagen['emax'] = cls['emax'].real()
  793 + phagen['enumbins'] = cls['enumbins'].integer()
  794 + phagen['ebinalg'] = 'LOG'
  795 + phagen['srcshape'] = cls['srcshape'].string()
  796 + phagen['coordsys'] = cls['coordsys'].string()
795 797 if cls['coordsys'].string() == 'CEL':
796   - phagen['ra'] = cls['xref'].real()
  798 + phagen['ra'] = cls['xref'].real()
797 799 phagen['dec'] = cls['yref'].real()
798 800 elif cls['coordsys'].string() == 'GAL':
799 801 phagen['glon'] = cls['xref'].real()
... ... @@ -804,15 +806,16 @@ def get_onoff_obs(cls, obs):
804 806 if cls['bkgmethod'].string() == 'REFLECTED':
805 807 phagen['bkgregmin'] = cls['bkgregmin'].integer()
806 808 phagen['maxoffset'] = cls['maxoffset'].real()
807   - phagen['stack'] = True
808   - phagen['etruemin'] = cls['etruemin'].real()
809   - phagen['etruemax'] = cls['etruemax'].real()
  809 + phagen['stack'] = True
  810 + phagen['etruemin'] = cls['etruemin'].real()
  811 + phagen['etruemax'] = cls['etruemax'].real()
810 812 phagen['etruebins'] = cls['etruebins'].integer()
811   - phagen['chatter'] = cls['chatter'].integer()
812   - phagen['clobber'] = cls['clobber'].boolean()
813   - phagen['debug'] = cls['debug'].boolean()
  813 + phagen['chatter'] = cls['chatter'].integer()
  814 + phagen['clobber'] = cls['clobber'].boolean()
  815 + phagen['debug'] = cls['debug'].boolean()
814 816 phagen.run()
815 817  
  818 + # Clone resulting observation container
816 819 onoff_obs = phagen.obs().copy()
817 820  
818 821 # On/Off observations are created with CSTAT as default statistic
... ... @@ -823,4 +826,5 @@ def get_onoff_obs(cls, obs):
823 826 for observation in onoff_obs:
824 827 observation.statistic(cls['statistic'].string())
825 828  
  829 + # Return On/Off oberservation container
826 830 return onoff_obs
... ...
doc/source/users/reference_manual/cslightcrv.rst
... ... @@ -69,8 +69,8 @@ General parameters
69 69 ``tbinfile [file]``
70 70 File defining the time binning.
71 71  
72   -``method <CUBE|ONOFF> [string]``
73   - Selects between CUBE analysis (3D spatial/energy likelihood) and ONOFF
  72 +``method <3D|ONOFF> [string]``
  73 + Selects between 3D analysis (3D spatial/energy likelihood) and ONOFF
74 74 analysis (1D likelihood with background from Off regions).
75 75  
76 76 ``emin [real]``
... ...
doc/source/users/reference_manual/csphasecrv.rst
... ... @@ -63,8 +63,8 @@ General parameters
63 63 ``phbinfile [file]``
64 64 File defining the phase binning.
65 65  
66   -``method <CUBE|ONOFF> [string]``
67   - Selects between CUBE analysis (3D spatial/energy likelihood) and ONOFF
  66 +``method <3D|ONOFF> [string]``
  67 + Selects between 3D analysis (3D spatial/energy likelihood) and ONOFF
68 68 analysis (1D likelihood with background from Off regions).
69 69  
70 70 ``emin [real]``
... ...
doc/source/users/tutorials/howto/howto_lightcurve.rst
... ... @@ -37,7 +37,7 @@ The time interval is linearly divided into 20 time bins.
37 37 Lightcurve start time (UTC string, JD, MJD or MET in seconds) [MJD 51544.5] MJD 59235.5
38 38 Lightcurve stop time (UTC string, JD, MJD or MET in seconds) [MJD 51544.6] MJD 59236.0
39 39 Number of time bins (1-10000) [5] 20
40   - Analysis method (CUBE|ONOFF) [CUBE] CUBE
  40 + Analysis method (3D|ONOFF) [3D]
41 41 Lower energy limit of events (TeV) [0.1]
42 42 Upper energy limit of events (TeV) [100.0]
43 43 Number of energy bins for binned (0=unbinned for Cube analysis only) (0-100) [0]
... ...
src/support/ctool.cpp
... ... @@ -1193,6 +1193,7 @@ bool ctool::is_stacked(void)
1193 1193 return stacked;
1194 1194 }
1195 1195  
  1196 +
1196 1197 /***********************************************************************//**
1197 1198 * @brief Query user parameters for On/Off analysis
1198 1199 *
... ... @@ -1200,44 +1201,47 @@ bool ctool::is_stacked(void)
1200 1201 *
1201 1202 * Queries the parameter "method", and if this is "ONOFF" signal that an On/
1202 1203 * Off analysis is requested. In that case, all necessary input parameters of
1203   - * csphagen are queried: "inexclusion", "srcshape", "rad", "bkgmethod",
1204   - * "bkgregmin", "maxoffset", "stack", "etruemin", "etruemax", "etruebins"
  1204 + * csphagen are queried: "inexclusion", "emin", "emax", "enumbins",
  1205 + * "coordsys", "xref", "yref", "srcshape", "rad", "bkgmethod", "bkgregmin",
  1206 + * "maxoffset", "etruemin", "etruemax", and "etruebins".
1205 1207 *
1206 1208 * Using this method assures that the parameters are always queried in the
1207 1209 * same order.
1208 1210 ***************************************************************************/
1209 1211 bool ctool::is_onoff(void)
1210 1212 {
1211   - // initialise onoff flag
1212   - bool onoff = false;
1213   - // query analysis method chosen
1214   - if ((*this)["method"].string() == "ONOFF"){
1215   - //modify onoff flag
1216   - onoff = true;
1217   - //query csphagen parameters
1218   - (*this)["inexclusion"].filename();
1219   - (*this)["emin"].real();
1220   - (*this)["emax"].real();
1221   - (*this)["enumbins"].integer();
1222   - (*this)["coordsys"].string();
1223   - (*this)["xref"].real();
1224   - (*this)["yref"].real();
1225   - if ((*this)["srcshape"].string() == "CIRCLE"){
1226   - (*this)["rad"].real();
1227   - }
1228   - if ((*this)["bkgmethod"].string() == "REFLECTED"){
1229   - (*this)["bkgregmin"].integer();
1230   - }
1231   - (*this)["maxoffset"].real();
1232   - (*this)["etruemin"].real();
1233   - (*this)["etruemax"].real();
1234   - (*this)["etruebins"].integer();
1235   - }
  1213 + // Set onoff flag
  1214 + bool onoff = ((*this)["method"].string() == "ONOFF");
  1215 +
  1216 + // Query analysis method chosen
  1217 + if (onoff) {
  1218 +
  1219 + // Query csphagen parameters
  1220 + (*this)["inexclusion"].filename();
  1221 + (*this)["emin"].real();
  1222 + (*this)["emax"].real();
  1223 + (*this)["enumbins"].integer();
  1224 + (*this)["coordsys"].string();
  1225 + (*this)["xref"].real();
  1226 + (*this)["yref"].real();
  1227 + if ((*this)["srcshape"].string() == "CIRCLE"){
  1228 + (*this)["rad"].real();
  1229 + }
  1230 + if ((*this)["bkgmethod"].string() == "REFLECTED"){
  1231 + (*this)["bkgregmin"].integer();
  1232 + }
  1233 + (*this)["maxoffset"].real();
  1234 + (*this)["etruemin"].real();
  1235 + (*this)["etruemax"].real();
  1236 + (*this)["etruebins"].integer();
  1237 +
  1238 + } // endif: method was ONOFF
1236 1239  
1237 1240 // Return onoff flag
1238 1241 return onoff;
1239 1242 }
1240 1243  
  1244 +
1241 1245 /***********************************************************************//**
1242 1246 * @brief Set response for all CTA observations in container
1243 1247 *
... ...
test/test_cscript.py
... ... @@ -456,7 +456,7 @@ class Test(test):
456 456 # TODO: implement
457 457  
458 458 # Test is_onoff() method
459   - # TODO: implemen
  459 + # TODO: implement
460 460  
461 461 # Test set_response() method
462 462 # TODO: implement
... ...
test/test_cslightcrv.py
... ... @@ -77,7 +77,7 @@ class Test(test):
77 77 ' inmodel="'+self._model+'" srcname="Crab"'+ \
78 78 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
79 79 ' tbinalg="LIN" tmin="MJD 51544.50" tmax="MJD 51544.53"'+ \
80   - ' tbins=3 method="CUBE" enumbins=0 emin=0.1 emax=100.0'+ \
  80 + ' tbins=3 method="3D" enumbins=0 emin=0.1 emax=100.0'+ \
81 81 ' outfile="lightcurve_cmd1.fits"'+ \
82 82 ' logfile="cslightcrv_cmd1.log" chatter=1'
83 83  
... ... @@ -97,7 +97,7 @@ class Test(test):
97 97 ' inmodel="'+self._model+'" srcname="Crab"'+ \
98 98 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
99 99 ' tbinalg="LIN" tmin="MJD 51544.50" tmax="MJD 51544.53"'+ \
100   - ' tbins=3 method="CUBE" enumbins=0 emin=0.1 emax=100.0'+ \
  100 + ' tbins=3 method="3D" enumbins=0 emin=0.1 emax=100.0'+ \
101 101 ' outfile="lightcurve_cmd1.fits"'+ \
102 102 ' logfile="cslightcrv_cmd2.log" debug=yes'
103 103  
... ... @@ -127,7 +127,7 @@ class Test(test):
127 127 lcrv['tmin'] = 'MJD 51544.50'
128 128 lcrv['tmax'] = 'MJD 51544.53'
129 129 lcrv['tbins'] = 3
130   - lcrv['method'] = 'CUBE'
  130 + lcrv['method'] = '3D'
131 131 lcrv['enumbins'] = 0
132 132 lcrv['emin'] = 0.1
133 133 lcrv['emax'] = 100.0
... ... @@ -164,7 +164,7 @@ class Test(test):
164 164 lcrv['irf'] = self._irf
165 165 lcrv['tbinalg'] = 'FILE'
166 166 lcrv['tbinfile'] = 'cslightcrv_py2.dat'
167   - lcrv['method'] = 'CUBE'
  167 + lcrv['method'] = '3D'
168 168 lcrv['enumbins'] = 0
169 169 lcrv['emin'] = 0.1
170 170 lcrv['emax'] = 100.0
... ... @@ -194,7 +194,7 @@ class Test(test):
194 194 lcrv['caldb'] = self._caldb
195 195 lcrv['irf'] = self._irf
196 196 lcrv['tbinalg'] = 'GTI'
197   - lcrv['method'] = 'CUBE'
  197 + lcrv['method'] = '3D'
198 198 lcrv['enumbins'] = 0
199 199 lcrv['emin'] = 0.1
200 200 lcrv['emax'] = 100.0
... ... @@ -219,7 +219,7 @@ class Test(test):
219 219 lcrv['tmin'] = 'MJD 51544.50'
220 220 lcrv['tmax'] = 'MJD 51544.53'
221 221 lcrv['tbins'] = 2
222   - lcrv['method'] = 'CUBE'
  222 + lcrv['method'] = '3D'
223 223 lcrv['emin'] = 0.1
224 224 lcrv['emax'] = 100.0
225 225 lcrv['enumbins'] = 10
... ...
test/test_csphasecrv.py
... ... @@ -77,7 +77,7 @@ class Test(test):
77 77 cmd = csphasecrv+' inobs="'+self._phased_events+'"'+ \
78 78 ' inmodel="'+self._model+'" srcname="Crab"'+ \
79 79 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
80   - ' phbinalg="LIN" phbins=5 method="CUBE"'+ \
  80 + ' phbinalg="LIN" phbins=5 method="3D"'+ \
81 81 ' enumbins=0 emin=0.1 emax=100.0'+ \
82 82 ' outfile="csphasecrv_cmd1.fits"'+ \
83 83 ' logfile="csphasecrv_cmd1.log" chatter=1'
... ... @@ -97,7 +97,7 @@ class Test(test):
97 97 cmd = csphasecrv+' inobs="events_that_do_not_exist.fits"'+ \
98 98 ' inmodel="'+self._model+'" srcname="Crab"'+ \
99 99 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
100   - ' phbinalg="LIN" phbins=5 method="CUBE"'+ \
  100 + ' phbinalg="LIN" phbins=5 method="3D"'+ \
101 101 ' enumbins=0 emin=0.1 emax=100.0'+ \
102 102 ' outfile="csphasecrv_cmd2.fits"'+ \
103 103 ' logfile="csphasecrv_cmd2.log" debug=yes chatter=1'
... ... @@ -126,7 +126,7 @@ class Test(test):
126 126 pcrv['irf'] = self._irf
127 127 pcrv['phbinalg'] = 'LIN'
128 128 pcrv['phbins'] = 5
129   - pcrv['method'] = 'CUBE'
  129 + pcrv['method'] = '3D'
130 130 pcrv['enumbins'] = 0
131 131 pcrv['emin'] = 0.1
132 132 pcrv['emax'] = 100.0
... ... @@ -163,7 +163,7 @@ class Test(test):
163 163 pcrv['irf'] = self._irf
164 164 pcrv['phbinalg'] = 'FILE'
165 165 pcrv['phbinfile'] = 'csphasecrv_py2.dat'
166   - pcrv['method'] = 'CUBE'
  166 + pcrv['method'] = '3D'
167 167 pcrv['enumbins'] = 0
168 168 pcrv['emin'] = 0.1
169 169 pcrv['emax'] = 100.0
... ... @@ -194,7 +194,7 @@ class Test(test):
194 194 pcrv['irf'] = self._irf
195 195 pcrv['phbinalg'] = 'LIN'
196 196 pcrv['phbins'] = 5
197   - pcrv['method'] = 'CUBE'
  197 + pcrv['method'] = '3D'
198 198 pcrv['enumbins'] = 0
199 199 pcrv['emin'] = 0.1
200 200 pcrv['emax'] = 100.0
... ... @@ -218,7 +218,7 @@ class Test(test):
218 218 pcrv['irf'] = self._irf
219 219 pcrv['phbinalg'] = 'LIN'
220 220 pcrv['phbins'] = 2
221   - pcrv['method'] = 'CUBE'
  221 + pcrv['method'] = '3D'
222 222 pcrv['emin'] = 0.1
223 223 pcrv['emax'] = 100.0
224 224 pcrv['enumbins'] = 10
... ...