Commit ea2c2751288f2f1b26ff8f97fd820978e247e2fb
1 parent
57b8ed27
Add cslightcrv documentation and adapt slightly user parameters
Showing
5 changed files
with
186 additions
and
35 deletions
doc/source/reference_manual/cslightcrv.rst
0 → 100644
| 1 | +.. _cslightcrv: | |
| 2 | + | |
| 3 | +cslightcrv | |
| 4 | +========== | |
| 5 | + | |
| 6 | +Computes a lightcurve for a given source. | |
| 7 | + | |
| 8 | + | |
| 9 | +Synopsis | |
| 10 | +-------- | |
| 11 | + | |
| 12 | +Computes a lightcurve for a given source. | |
| 13 | + | |
| 14 | + | |
| 15 | +General parameters | |
| 16 | +------------------ | |
| 17 | + | |
| 18 | +``(inobs = NONE) [file]`` | |
| 19 | + Input event list, counts cube or observation definition XML file. | |
| 20 | + | |
| 21 | +``inmodel [file]`` | |
| 22 | + Input source model XML file. | |
| 23 | + | |
| 24 | +``srcname [string]`` | |
| 25 | + Name of the source in the source model XML file which should be used | |
| 26 | + for sensitivity computation. | |
| 27 | + | |
| 28 | +``outfile [file]`` | |
| 29 | + Name of the source spectrum output file. | |
| 30 | + | |
| 31 | +``expcube [file]`` | |
| 32 | + Exposure cube file (only needed for stacked analysis). | |
| 33 | + | |
| 34 | +``psfcube [file]`` | |
| 35 | + PSF cube file (only needed for stacked analysis). | |
| 36 | + | |
| 37 | +``bkgcube [file]`` | |
| 38 | + Background cube file (only needed for stacked analysis). | |
| 39 | + | |
| 40 | +``caldb [string]`` | |
| 41 | + Calibration database. | |
| 42 | + | |
| 43 | +``irf [string]`` | |
| 44 | + Instrumental response function. | |
| 45 | + | |
| 46 | +``tmin [real]`` | |
| 47 | + Lightcurve start time (in MJD). | |
| 48 | + | |
| 49 | +``tmax [real]`` | |
| 50 | + Lightcurve stop time (in MJD). | |
| 51 | + | |
| 52 | +``tbins [integer]`` | |
| 53 | + Number of time bins. | |
| 54 | + | |
| 55 | +``(tbinalg = GTI) <FILE|LIN|GTI> [string]`` | |
| 56 | + Algorithm for defining time bins. | |
| 57 | + | |
| 58 | +``tbinfile [file]`` | |
| 59 | + File defining the time binning. | |
| 60 | + | |
| 61 | +``binned [boolean]`` | |
| 62 | + Use binned analysis in each time bin. | |
| 63 | + | |
| 64 | +``enumbins [integer]`` | |
| 65 | + Number of energy bins per light curve bin (0=unbinned). | |
| 66 | + | |
| 67 | +``emin [real]`` | |
| 68 | + Lower energy limit of events (in TeV). | |
| 69 | + | |
| 70 | +``emax [real]`` | |
| 71 | + Upper energy limit of events (in TeV). | |
| 72 | + | |
| 73 | +``coordsys <CEL|GAL> [string]`` | |
| 74 | + Coordinate system (CEL - celestial, GAL - galactic). | |
| 75 | + | |
| 76 | +``proj <AIT|AZP|CAR|MER|MOL|STG|TAN> [string]`` | |
| 77 | + Projection method. | |
| 78 | + | |
| 79 | +``xref [real]`` | |
| 80 | + Right Ascension / Galactic longitude of image centre (J2000, in degrees). | |
| 81 | + | |
| 82 | +``yref [real]`` | |
| 83 | + Declination / Galactic latitude of image centre (J2000, in degrees). | |
| 84 | + | |
| 85 | +``nxpix [integer]`` | |
| 86 | + Size of the Right Ascension / Galactic longitude axis (in pixels). | |
| 87 | + | |
| 88 | +``nypix [integer]`` | |
| 89 | + Size of the Declination / Galactic latitude axis (in pixels). | |
| 90 | + | |
| 91 | +``binsz [real]`` | |
| 92 | + Pixel size (in degrees/pixel). | |
| 93 | + | |
| 94 | +``(calc_ts = yes) [boolean]`` | |
| 95 | + Compute TS value for each time bin? | |
| 96 | + | |
| 97 | +``(calc_ulim = yes) [boolean]`` | |
| 98 | + Compute upper limit for each time bin? | |
| 99 | + | |
| 100 | +``(fix_srcs = yes) [boolean]`` | |
| 101 | + Fix other sky model parameters? | |
| 102 | + | |
| 103 | +``(fix_bkg = no) [boolean]`` | |
| 104 | + Fix background model parameters? | |
| 105 | + | |
| 106 | + | |
| 107 | +Standard parameters | |
| 108 | +------------------- | |
| 109 | + | |
| 110 | +``(chatter = 2) [integer]`` | |
| 111 | + Verbosity of the executable: | |
| 112 | + chatter = 0: no information will be logged | |
| 113 | + | |
| 114 | + chatter = 1: only errors will be logged | |
| 115 | + | |
| 116 | + chatter = 2: errors and actions will be logged | |
| 117 | + | |
| 118 | + chatter = 3: report about the task execution | |
| 119 | + | |
| 120 | + chatter = 4: detailed report about the task execution | |
| 121 | + | |
| 122 | +``(clobber = yes) [boolean]`` | |
| 123 | + Specifies whether an existing output counts cube should be overwritten. | |
| 124 | + | |
| 125 | +``(debug = no) [boolean]`` | |
| 126 | + Enables debug mode. In debug mode the executable will dump any log file output to the console. | |
| 127 | + | |
| 128 | +``(mode = ql) [string]`` | |
| 129 | + Mode of automatic parameters (default is "ql", i.e. "query and learn"). | |
| 130 | + | |
| 131 | +``(logfile = cslightcrv.log) [filename]`` | |
| 132 | + Log filename. | |
| 133 | + | |
| 134 | + | |
| 135 | +Related tools | |
| 136 | +------------- | |
| 137 | + | |
| 138 | +None | ... | ... |
doc/source/reference_manual/index.rst
| ... | ... | @@ -38,6 +38,7 @@ cscripts |
| 38 | 38 | |
| 39 | 39 | cscaldb --- Lists available instrument response functions <cscaldb> |
| 40 | 40 | csobsdef --- Generates observation definition file <csobsdef> |
| 41 | + cslightcrv --- Computes lightcurve <cslightcrv> | |
| 41 | 42 | cspull --- Generates pull distribution <cspull> |
| 42 | 43 | cssens --- Computes CTA sensitivity <cssens> |
| 43 | 44 | csspec --- Computes spectral points <csspec> | ... | ... |
doc/source/reference_manual/usage.rst
| ... | ... | @@ -26,7 +26,7 @@ Examples |
| 26 | 26 | ``infile [file]`` |
| 27 | 27 | Describes an automatic (queried) file-type parameter with no default value. |
| 28 | 28 | |
| 29 | -``irf = kb_E_50h_v3 <kb_E_50h_v3|kb_H_50h_v3> [string]`` | |
| 29 | +``irf = South_50h <North_50h|South_50h> [string]`` | |
| 30 | 30 | Describes an automatic (queried) string-type parameter with two value |
| 31 | 31 | options. |
| 32 | 32 | |
| ... | ... | @@ -39,4 +39,4 @@ Examples |
| 39 | 39 | To set hidden parameters at runtime, specify them explicitly at |
| 40 | 40 | the command line; for example: |
| 41 | 41 | |
| 42 | - ``gtobssim start_time=900`` | |
| 42 | + ``ctobssim start_time=900`` | ... | ... |
scripts/cslightcrv.py
| ... | ... | @@ -107,13 +107,15 @@ class cslightcrv(ctools.cscript): |
| 107 | 107 | pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Background cube file (only needed for stacked analysis)")) |
| 108 | 108 | pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) |
| 109 | 109 | pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) |
| 110 | - pars.append(gammalib.GApplicationPar("tmin","r","a","51544.5","","days","Lightcurve Time start [MJD]")) | |
| 111 | - pars.append(gammalib.GApplicationPar("tmax","r","a","51544.6","","days","Lightcurve Time stop [MJD]")) | |
| 112 | - pars.append(gammalib.GApplicationPar("tbins","i","a","5","","","Number of time bins points")) | |
| 113 | - pars.append(gammalib.GApplicationPar("tbinalg","s", "a","GTI","FILE|LIN|GTI","", "Algorithm for defining energy bins")) | |
| 114 | - pars.append(gammalib.GApplicationPar("tbinfile","s", "a","tbins.fits","","", "File defining the time binning")) | |
| 115 | - pars.append(gammalib.GApplicationPar("binned","b","a","no","yes|no","","Use binned analysis in each energy bin")) | |
| 116 | - pars.append(gammalib.GApplicationPar("nebins","i","h","20","","","Number of energy bins per light curve point")) | |
| 110 | + pars.append(gammalib.GApplicationPar("tbinalg","s","h","GTI","FILE|LIN|GTI","", "Algorithm for defining time bins")) | |
| 111 | + pars.append(gammalib.GApplicationPar("tmin","r","a","51544.5","","days","Lightcurve start time [MJD]")) | |
| 112 | + pars.append(gammalib.GApplicationPar("tmax","r","a","51544.6","","days","Lightcurve stop time [MJD]")) | |
| 113 | + pars.append(gammalib.GApplicationPar("tbins","i","a","5","","","Number of time bins")) | |
| 114 | + pars.append(gammalib.GApplicationPar("tbinfile","f","a","tbins.fits","","", "File defining the time binning")) | |
| 115 | + #pars.append(gammalib.GApplicationPar("binned","b","a","no","yes|no","","Use binned analysis in each time bin")) | |
| 116 | + pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins per light curve bin (0=unbinned)")) | |
| 117 | + pars.append(gammalib.GApplicationPar("emin","r","a","0.1","","","Lower energy limit of events (TeV)")) | |
| 118 | + pars.append(gammalib.GApplicationPar("emax","r","a","100.0","","","Upper energy limit of events (TeV)")) | |
| 117 | 119 | pars.append(gammalib.GApplicationPar("coordsys","s","a","CEL","CEL|GAL","","Coordinate System")) |
| 118 | 120 | pars.append(gammalib.GApplicationPar("proj","s","a","CAR","AIT|AZP|CAR|MER|MOL|STG|TAN","","Projection method")) |
| 119 | 121 | pars.append(gammalib.GApplicationPar("xref","r","a","83.63","0","360","First coordinate of image center in degrees (RA or galactic l)")) |
| ... | ... | @@ -121,12 +123,10 @@ class cslightcrv(ctools.cscript): |
| 121 | 123 | pars.append(gammalib.GApplicationPar("nxpix","i","a","200","","","Size of the X axis in pixels")) |
| 122 | 124 | pars.append(gammalib.GApplicationPar("nypix","i","a","200","","","Size of the Y axis in pixels")) |
| 123 | 125 | pars.append(gammalib.GApplicationPar("binsz","r","a","0.02","","","Pixel size (deg/pixel)")) |
| 124 | - pars.append(gammalib.GApplicationPar("emin","r","a","0.1","","","Lower energy limit for binned analysis (TeV)")) | |
| 125 | - pars.append(gammalib.GApplicationPar("emax","r","a","100.0","","","Upper energy limit for binned analysis (TeV)")) | |
| 126 | - pars.append(gammalib.GApplicationPar("calc_ts","b","h","yes","yes|no","","Compute TS value in each bin")) | |
| 127 | - pars.append(gammalib.GApplicationPar("calc_ulim","b","h","yes","yes|no","","Compute upper limit in each bin")) | |
| 128 | - pars.append(gammalib.GApplicationPar("fix_srcs","b","h","yes","yes|no","","Fix other skymodel parameters")) | |
| 129 | - pars.append(gammalib.GApplicationPar("fix_bkg","b","h","no","yes|no","","Fix background parameters")) | |
| 126 | + pars.append(gammalib.GApplicationPar("calc_ts","b","h","yes","yes|no","","Compute TS value for each bin?")) | |
| 127 | + pars.append(gammalib.GApplicationPar("calc_ulim","b","h","yes","yes|no","","Compute upper limit for each bin?")) | |
| 128 | + pars.append(gammalib.GApplicationPar("fix_srcs","b","h","yes","yes|no","","Fix other sky model parameters?")) | |
| 129 | + pars.append(gammalib.GApplicationPar("fix_bkg","b","h","no","yes|no","","Fix background model parameters?")) | |
| 130 | 130 | pars.append_standard() |
| 131 | 131 | pars.append(gammalib.GApplicationPar("logfile","f","h","cslightcrv.log","","","Log filename")) |
| 132 | 132 | pars.save(parfile) |
| ... | ... | @@ -190,22 +190,33 @@ class cslightcrv(ctools.cscript): |
| 190 | 190 | # Get source name |
| 191 | 191 | self.m_srcname = self["srcname"].string() |
| 192 | 192 | |
| 193 | - # Get ebounds | |
| 193 | + # Get time boundaries | |
| 194 | 194 | self.create_tbounds() |
| 195 | 195 | |
| 196 | + # Unbinned or binned analysis? | |
| 197 | + self.m_ebins = self["enumbins"].integer() | |
| 198 | + if self.m_ebins == 0: | |
| 199 | + self.m_binned = False | |
| 200 | + else: | |
| 201 | + self.m_binned = True | |
| 202 | + | |
| 203 | + # Get energy range | |
| 204 | + self.m_emin = self["emin"].real() | |
| 205 | + self.m_emax = self["emax"].real() | |
| 206 | + | |
| 196 | 207 | # Get binning flag |
| 197 | - self.m_binned = self["binned"].boolean() | |
| 208 | + #self.m_binned = self["binned"].boolean() | |
| 198 | 209 | if self.m_binned: |
| 210 | + self.m_coordsys = self["coordsys"].string() | |
| 211 | + self.m_proj = self["proj"].string() | |
| 199 | 212 | self.m_xref = self["xref"].real() |
| 200 | 213 | self.m_yref = self["yref"].real() |
| 201 | 214 | self.m_nxpix = self["nxpix"].integer() |
| 202 | 215 | self.m_nypix = self["nypix"].integer() |
| 203 | 216 | self.m_binsz = self["binsz"].real() |
| 204 | - self.m_coordsys = self["coordsys"].string() | |
| 205 | - self.m_proj = self["proj"].string() | |
| 206 | - self.m_ebins = self["nebins"].integer() | |
| 207 | - self.m_emin = self["emin"].real() | |
| 208 | - self.m_emax = self["emax"].real() | |
| 217 | + #self.m_ebins = self["enumbins"].integer() | |
| 218 | + #self.m_emin = self["emin"].real() | |
| 219 | + #self.m_emax = self["emax"].real() | |
| 209 | 220 | |
| 210 | 221 | # Read other parameters |
| 211 | 222 | self.m_outfile = self["outfile"].filename() |
| ... | ... | @@ -367,8 +378,8 @@ class cslightcrv(ctools.cscript): |
| 367 | 378 | |
| 368 | 379 | # Select events |
| 369 | 380 | select = ctools.ctselect(self.obs) |
| 370 | - select["emin"].value("UNDEFINED") | |
| 371 | - select["emax"].value("UNDEFINED") | |
| 381 | + select["emin"].real(self.m_emin) | |
| 382 | + select["emax"].real(self.m_emax) | |
| 372 | 383 | select["tmin"].real(tmin.convert(select.time_reference())) |
| 373 | 384 | select["tmax"].real(tmax.convert(select.time_reference())) |
| 374 | 385 | select["rad"].value("UNDEFINED") | ... | ... |
test/test_cscripts.sh.in
| ... | ... | @@ -257,14 +257,16 @@ chmod +x @abs_top_srcdir@/scripts/cslightcrv.py |
| 257 | 257 | @abs_top_srcdir@/scripts/cslightcrv.py \ |
| 258 | 258 | inobs="data/crab_events.fits" \ |
| 259 | 259 | inmodel="data/crab.xml" \ |
| 260 | + srcname="Crab" \ | |
| 260 | 261 | caldb="irf" \ |
| 261 | 262 | irf="cta_dummy_irf" \ |
| 262 | - tbins=3 \ | |
| 263 | + tbinalg="LIN" \ | |
| 263 | 264 | tmin=51544.5 \ |
| 264 | 265 | tmax=51544.53 \ |
| 265 | - srcname="Crab" \ | |
| 266 | - tbinalg="LIN" \ | |
| 267 | - binned=no \ | |
| 266 | + tbins=3 \ | |
| 267 | + enumbins=0 \ | |
| 268 | + emin=0.1 \ | |
| 269 | + emax=100.0 \ | |
| 268 | 270 | outfile="lightcurve.fits" > cslightcrv.log |
| 269 | 271 | $ECHO -n "." |
| 270 | 272 | if [ -s "lightcurve.fits" ] |
| ... | ... | @@ -284,21 +286,20 @@ chmod +x @abs_top_srcdir@/scripts/cslightcrv.py |
| 284 | 286 | @abs_top_srcdir@/scripts/cslightcrv.py \ |
| 285 | 287 | inobs="data/crab_events.fits" \ |
| 286 | 288 | inmodel="data/crab.xml" \ |
| 289 | + srcname="Crab" \ | |
| 287 | 290 | caldb="irf" \ |
| 288 | 291 | irf="cta_dummy_irf" \ |
| 289 | 292 | tbinalg="GTI" \ |
| 290 | - srcname="Crab" \ | |
| 293 | + enumbins=2 \ | |
| 291 | 294 | emin=0.1 \ |
| 292 | 295 | emax=100.0 \ |
| 293 | - binned=yes \ | |
| 294 | - nxpix=10 \ | |
| 295 | - nypix=10 \ | |
| 296 | - binsz=0.1 \ | |
| 297 | - nebins=2 \ | |
| 298 | 296 | coordsys="CEL" \ |
| 297 | + proj="CAR" \ | |
| 299 | 298 | xref=83.63 \ |
| 300 | 299 | yref=22.01 \ |
| 301 | - proj="CAR" \ | |
| 300 | + nxpix=10 \ | |
| 301 | + nypix=10 \ | |
| 302 | + binsz=0.1 \ | |
| 302 | 303 | outfile="lightcurve.fits" > cslightcrv.log |
| 303 | 304 | $ECHO -n "." |
| 304 | 305 | if [ -s "lightcurve.fits" ] | ... | ... |