From 734b34828efb2718e8b6dd34633bb9b779f222c3 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Sun, 22 Oct 2017 21:44:26 +0200 Subject: [PATCH] Add "statistic" parameter to all likelihood scripts (#2237) --- ChangeLog | 4 ++-- NEWS | 36 ++++++++++++++++++++++++++---------- cscripts/cslightcrv.par | 1 + cscripts/cslightcrv.py | 82 +++++++++++++++++++++++++++++++++------------------------------------------------- cscripts/csphasecrv.par | 1 + cscripts/csphasecrv.py | 47 +++++++++++++++++++++-------------------------- cscripts/cspull.par | 31 ++++++++++++++++--------------- cscripts/cspull.py | 38 +++++++++++++++++--------------------- cscripts/cssens.par | 25 +++++++++++++------------ cscripts/cssens.py | 40 ++++++++++++++++++---------------------- cscripts/cstsdist.par | 27 ++++++++++++++------------- cscripts/cstsdist.py | 57 +++++++++++++++++++-------------------------------------- doc/source/admin/release_history/1.5.rst | 9 +++++++++ doc/source/users/reference_manual/cslightcrv.rst | 33 +++++++++++++++++++++------------ doc/source/users/reference_manual/csphasecrv.rst | 37 +++++++++++++++++++++++-------------- doc/source/users/reference_manual/cspull.rst | 65 ++++++++++++++++++++++++++++++++++++++--------------------------- doc/source/users/reference_manual/cssens.rst | 60 ++++++++++++++++++++++++++++++++++++------------------------ doc/source/users/reference_manual/cstsdist.rst | 55 ++++++++++++++++++++++++++++++++----------------------- 18 files changed, 340 insertions(+), 308 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e03971..94957e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,9 @@ -2017-10-21 +2017-10-22 * Version 1.5.0 released ======================== - Add "statistic" parameter to all likelihood tools (#2237) + Add "statistic" parameter to all likelihood tools and scripts (#2237) Rename ctlike "stat" parameter to "statistic" (#2237) Enable handling of On/Off observations in csspec (#2231) Add csphagen script (#2208) diff --git a/NEWS b/NEWS index c15edcc..44c11bf 100644 --- a/NEWS +++ b/NEWS @@ -164,6 +164,10 @@ None cslightcrv - Generate light curve --------------------------------- +The script now derived from the cslikelihood base class. A "statistic" +parameter was added to allow setting the optimizer statistic for the light +curve generation (#2237). + Use t-type parameters for "tmin" and "tmax" to all specifying times in various formats (#1864). @@ -185,8 +189,8 @@ None csmodelsois - Puts selected sources in diffuse model cube --------------------------------------------------------- -Add csmodelsois script that replaces selected models in a model container by -a diffuse map cube (#2180). +Add script that replaces selected models in a model container by a diffuse +map cube (#2180). csobs2caldb - Generate calibration database entry for an IACT observation @@ -211,17 +215,22 @@ None csphagen - Generate On/Off observations --------------------------------------- -The script csphagen was added to allow the generation of PHA, ARF and RMF datasets -for classical On/Off IACT analysis (#2208). +The script was added to allow the generation of PHA, ARF and RMF datasets for classical On/Off IACT analysis (#2208). csphasecrv - Generate phase curve --------------------------------- -None +The script now derived from the cslikelihood base class. A "statistic" +parameter was added to allow setting the optimizer statistic for the light +curve generation (#2237). cspull - Generate pull distributions ------------------------------------ +The script now derived from the cslikelihood base class. A "statistic" +parameter was added to allow setting the optimizer statistic for the pull +distribution generation (#2237). + Use t-type parameters for "tmin" and "tmax" to all specifying times in various formats (#1864). @@ -238,18 +247,20 @@ None cssens - Computes sensitivity curve ----------------------------------- -None +The script now derived from the cslikelihood base class. A "statistic" +parameter was added to allow setting the optimizer statistic for the sensitivity +computation (#2237). csspec - Generates Spectral Energy Distribution ----------------------------------------------- -The csspec script now derived from the cslikelihood base class. A "statistic" +The script now derived from the cslikelihood base class. A "statistic" parameter was added to allow setting the optimizer statistic for the spectrum generation (#2237). -The csspec script now can also handle On/Off spectra for SED generation (#2231). +The script now can also handle On/Off spectra for SED generation (#2231). -The csspec script now can also handle non-CTA data. For that purpose a "method" +The script now can also handle non-CTA data. For that purpose a "method" parameter has been introduced that allows to selected between slicing of the data (method="SLICE"), which is only supported for CTA observations, and replacing of the spectral model by a node function (method="NODES"). If method="AUTO" the tool @@ -264,6 +275,10 @@ None cstsdist - Computes Test Statistic distribution ----------------------------------------------- +The script now derived from the cslikelihood base class. A "statistic" +parameter was added to allow setting the optimizer statistic for the Test +Statistic distribution generation (#2237). + Use t-type parameters for "tmin" and "tmax" to all specifying times in various formats (#1864). @@ -275,7 +290,8 @@ None cstsmapsplit - Prepare split Test Statistic computation ------------------------------------------------------- -None +A "statistic" parameter was added to allow setting the optimizer statistic for +the TS map generation (#2237). csviscube - Generate visibility cube diff --git a/cscripts/cslightcrv.par b/cscripts/cslightcrv.par index 93823df..3cf4918 100644 --- a/cscripts/cslightcrv.par +++ b/cscripts/cslightcrv.par @@ -42,6 +42,7 @@ yref, r, a, 22.01,-90,90, "Second coordinate of image center in degrees (DE nxpix, i, a, 200,,, "Size of the X axis in pixels" nypix, i, a, 200,,, "Size of the Y axis in pixels" binsz, r, a, 0.02,,, "Pixel size (deg/pixel)" +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" calc_ts, b, h, yes,,, "Compute TS value for each bin?" calc_ulim, b, h, yes,,, "Compute upper limit for each bin?" fix_srcs, b, h, yes,,, "Fix other sky model parameters?" diff --git a/cscripts/cslightcrv.py b/cscripts/cslightcrv.py index b032b00..245700a 100755 --- a/cscripts/cslightcrv.py +++ b/cscripts/cslightcrv.py @@ -28,7 +28,7 @@ from cscripts import ioutils # ================ # # cslightcrv class # # ================ # -class cslightcrv(ctools.cscript): +class cslightcrv(ctools.cslikelihood): """ Generates a lightcurve @@ -68,9 +68,8 @@ class cslightcrv(ctools.cscript): """ Constructor """ - # Set name - self._name = 'cslightcrv' - self._version = ctools.__version__ + # Initialise application by calling the appropriate class constructor + self._init_cslikelihood('cslightcrv', ctools.__version__, argv) # Initialise some members self._srcname = '' @@ -78,12 +77,6 @@ class cslightcrv(ctools.cscript): self._stacked = False self._fits = gammalib.GFits() - # Initialise observation container from constructor arguments. - self._obs, argv = self._set_input_obs(argv) - - # Initialise script by calling the appropriate class constructor. - self._init_cscript(argv) - # Return return @@ -95,11 +88,14 @@ class cslightcrv(ctools.cscript): """ # Setup observations (require response and allow event list, don't # allow counts cube) - self._setup_observations(self._obs, True, True, False) + self._setup_observations(self.obs(), True, True, False) + + # Set observation statistic + self._set_obs_statistic(gammalib.toupper(self['statistic'].string())) # Set models if there are none in the container - if self._obs.models().size() == 0: - self._obs.models(self['inmodel'].filename()) + if self.obs().models().size() == 0: + self.obs().models(self['inmodel'].filename()) # Get source name self._srcname = self['srcname'].string() @@ -188,7 +184,7 @@ class cslightcrv(ctools.cscript): elif algorithm == 'GTI': # Append the GTIs of all observations - for obs in self._obs: + for obs in self.obs(): for i in range(obs.events().gti().size()): gti.append(obs.events().gti().tstart(i), obs.events().gti().tstop(i)) @@ -209,7 +205,7 @@ class cslightcrv(ctools.cscript): names = [] # Collect list of free parameter names - for par in self._obs.models()[self._srcname]: + for par in self.obs().models()[self._srcname]: if par.is_free(): names.append(par.name()) @@ -221,12 +217,10 @@ class cslightcrv(ctools.cscript): Adjust model parameters dependent on user parameters """ # Write header - if self._logTerse(): - self._log('\n') - self._log.header1('Adjust model parameters') + self._log_header1(gammalib.TERSE, 'Adjust model parameters') # Adjust model parameters dependent on input user parameters - for model in self._obs.models(): + for model in self.obs().models(): # Set TS flag for all models to false. The source of interest will # be set to true later @@ -237,8 +231,7 @@ class cslightcrv(ctools.cscript): classname = model.classname() # Log model name - if self._logNormal(): - self._log.header3(model.name()) + self._log_header3(gammalib.NORMAL, model.name()) # If the model is the source of interest and the 'calc_ts' parameter # is true then enable the TS computation for the source @@ -254,9 +247,7 @@ class cslightcrv(ctools.cscript): for par in model: if par.is_free(): par.fix() - if self._logNormal(): - self._log(gammalib.parformat(par.name())) - self._log('fixed\n') + self._log_value(gammalib.NORMAL, par.name(), 'fixed') # Return return @@ -287,7 +278,8 @@ class cslightcrv(ctools.cscript): ioutils.append_result_column(table, results, 'e_MJD', 'days', 'e_mjd') # Append parameter columns - ioutils.append_model_par_column(table, self._obs.models()[self._srcname], + ioutils.append_model_par_column(table, + self.obs().models()[self._srcname], results) # Append Test Statistic column "TS" @@ -327,8 +319,7 @@ class cslightcrv(ctools.cscript): if self['calc_ulim'].boolean(): # Write header in logger - if self._logExplicit(): - self._log.header3('Computing upper limit') + self._log_header3(gammalib.EXPLICIT, 'Computing upper limit') # Create copy of observations cpy_obs = obs.copy() @@ -358,8 +349,7 @@ class cslightcrv(ctools.cscript): ul_flux = ulimit.flux_ulimit() ul_eflux = ulimit.eflux_ulimit() except: - if self._logTerse(): - self._log('Upper limit calculation failed.\n') + self._log_string(gammalib.TERSE, 'Upper limit calculation failed.') ul_diff = -1.0 ul_flux = -1.0 ul_eflux = -1.0 @@ -414,14 +404,14 @@ class cslightcrv(ctools.cscript): self._get_parameters() # Write observation into logger - self._log_observations(gammalib.NORMAL, self._obs, 'Observation') + self._log_observations(gammalib.NORMAL, self.obs(), 'Observation') # Get time boundaries tmin = self._tbins.tstart(0) tmax = self._tbins.tstop(self._tbins.size()-1) # Select events - select = ctools.ctselect(self._obs) + select = ctools.ctselect(self.obs()) select['emin'] = self['emin'].real() select['emax'] = self['emax'].real() select['tmin'] = tmin.convert(self._time_reference()) @@ -432,22 +422,18 @@ class cslightcrv(ctools.cscript): select.run() # Extract observations - self._obs = select.obs().copy() + self.obs(select.obs().copy()) # Write observation into logger - if self._logTerse(): - self._log('\n') - self._log.header1(gammalib.number('Selected observation',len(self._obs))) - self._log(str(self._obs)) - self._log('\n') + self._log_header1(gammalib.TERSE, + gammalib.number('Selected observation', + len(self.obs()))) # Adjust model parameters dependent on user parameters self._adjust_model_pars() # Write header - if self._logTerse(): - self._log('\n') - self._log.header1('Generate lightcurve') + self._log_header1(gammalib.TERSE, 'Generate lightcurve') # Initialise list of result dictionaries results = [] @@ -463,8 +449,8 @@ class cslightcrv(ctools.cscript): tmax = self._tbins.tstop(i) # Write time bin into header - if self._logTerse(): - self._log.header2('MJD '+str(tmin.mjd())+'-'+str(tmax.mjd())) + self._log_header2(gammalib.TERSE, 'MJD %f - %f ' % + (tmin.mjd(), tmax.mjd())) # Compute time bin center and time width twidth = 0.5 * (tmax - tmin) # in seconds @@ -481,11 +467,10 @@ class cslightcrv(ctools.cscript): 'values': {}} # Log information - if self._logExplicit(): - self._log.header3('Selecting events') + self._log_header3(gammalib.EXPLICIT, 'Selecting events') # Select events - select = ctools.ctselect(self._obs) + select = ctools.ctselect(self.obs()) select['emin'] = self['emin'].real() select['emax'] = self['emax'].real() select['tmin'] = tmin.convert(self._time_reference()) @@ -505,8 +490,7 @@ class cslightcrv(ctools.cscript): obs = self._bin_observation(obs) # Header - if self._logExplicit(): - self._log.header3('Fitting the data') + self._log_header3(gammalib.EXPLICIT, 'Fitting the data') # Do maximum likelihood model fitting like = ctools.ctlike(obs) @@ -626,7 +610,7 @@ class cslightcrv(ctools.cscript): # Set default name is user name is empty if not name: - user_name = self._name + user_name = self._name() else: user_name = name @@ -661,7 +645,7 @@ class cslightcrv(ctools.cscript): Set model container """ # Copy models - self._obs.models(models) + self.obs().models(models) # Return return diff --git a/cscripts/csphasecrv.par b/cscripts/csphasecrv.par index fea2837..aac533a 100644 --- a/cscripts/csphasecrv.par +++ b/cscripts/csphasecrv.par @@ -40,6 +40,7 @@ yref, r, a, 22.01,-90,90, "Second coordinate of image center in degrees (DE nxpix, i, a, 200,,, "Size of the X axis in pixels" nypix, i, a, 200,,, "Size of the Y axis in pixels" binsz, r, a, 0.02,,, "Pixel size (deg/pixel)" +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" # # Standard parameters diff --git a/cscripts/csphasecrv.py b/cscripts/csphasecrv.py index 66ba450..57a1906 100755 --- a/cscripts/csphasecrv.py +++ b/cscripts/csphasecrv.py @@ -28,7 +28,7 @@ from cscripts import ioutils # ================ # # csphasecrv class # # ================ # -class csphasecrv(ctools.cscript): +class csphasecrv(ctools.cslikelihood): """ Generates spectra in phase bins @@ -56,9 +56,8 @@ class csphasecrv(ctools.cscript): """ Constructor """ - # Set name - self._name = 'csphasecrv' - self._version = ctools.__version__ + # Initialise application by calling the appropriate class constructor + self._init_cslikelihood('csphasecrv', ctools.__version__, argv) # Initialise some members. Phases are stored in a nested list # [[ph1min,ph1max], [ph2min,ph2max],..] @@ -68,12 +67,6 @@ class csphasecrv(ctools.cscript): self._fits = gammalib.GFits() self._fitmodels = {} - # Initialise observation container from constructor arguments. - self._obs, argv = self._set_input_obs(argv) - - # Initialise script by calling the appropriate class constructor. - self._init_cscript(argv) - # Return return @@ -84,11 +77,14 @@ class csphasecrv(ctools.cscript): """ # Setup observations (require response and allow event list, don't # allow counts cube) - self._setup_observations(self._obs, True, True, False) + self._setup_observations(self.obs(), True, True, False) + + # Set observation statistic + self._set_obs_statistic(gammalib.toupper(self['statistic'].string())) # Set models if there are none in the container - if self._obs.models().size() == 0: - self._obs.models(self['inmodel'].filename()) + if self.obs().models().size() == 0: + self.obs().models(self['inmodel'].filename()) # Get source name self._srcname = self['srcname'].string() @@ -101,7 +97,7 @@ class csphasecrv(ctools.cscript): # Query the hidden parameters, just in case self['edisp'].boolean() - + # Read ahead output parameters if self._read_ahead(): self['outfile'].filename() @@ -176,7 +172,7 @@ class csphasecrv(ctools.cscript): names = [] # Collect list of free parameter names - for par in self._obs.models()[self._srcname]: + for par in self.obs().models()[self._srcname]: if par.is_free(): names.append(par.name()) @@ -209,7 +205,7 @@ class csphasecrv(ctools.cscript): ioutils.append_result_column(table, results, 'PHASE_MAX', '', 'phmax') # Append parameter columns - ioutils.append_model_par_column(table, self._obs.models()[self._srcname], + ioutils.append_model_par_column(table, self.obs().models()[self._srcname], results) # Return table @@ -323,10 +319,10 @@ class csphasecrv(ctools.cscript): self._get_parameters() # Write observation into logger - self._log_observations(gammalib.NORMAL, self._obs, 'Observation') + self._log_observations(gammalib.NORMAL, self.obs(), 'Observation') # Store and clear observations to split them into phase bins - orig_obs = self._obs.copy() + orig_obs = self.obs().copy() # Dictionary to save phase fitted models self._fitmodels = {} @@ -338,8 +334,8 @@ class csphasecrv(ctools.cscript): for phbin in self._phbins: # Write time bin into header - if self._logTerse(): - self._log.header2('PHASE '+str(phbin[0])+'-'+str(phbin[1])) + self._log_header2(gammalib.TERSE, 'PHASE %f - %f' % + (phbin[0], phbin[1])) # Select events select = ctools.ctselect(orig_obs) @@ -363,12 +359,10 @@ class csphasecrv(ctools.cscript): # and compute the stacked response functions and setup # an observation container with a single stacked observation. if self._stacked: - #obs = self._bin_observation(select.obs()) obs = obsutils.get_stacked_obs(self, select.obs()) # Header - if self._logExplicit(): - self._log.header3('Fitting the data') + self._log_header3(gammalib.EXPLICIT, 'Fitting the data') # Do maximum likelihood model fitting like = ctools.ctlike(obs) @@ -378,11 +372,12 @@ class csphasecrv(ctools.cscript): # Renormalize models to phase selection # TODO move the scaling from the temporal to the spectral component for model in like.obs().models(): - scaled_norm = model['Normalization'].value()/(phbin[1] - phbin[0]) + scaled_norm = model['Normalization'].value()/(phbin[1]-phbin[0]) model['Normalization'].value(scaled_norm) # Store fit model - self._fitmodels[str(phbin[0])+'-'+str(phbin[1])] = like.obs().models().copy() + self._fitmodels[str(phbin[0])+'-'+str(phbin[1])] = \ + like.obs().models().copy() # Create FITS file self._create_fits() @@ -424,7 +419,7 @@ class csphasecrv(ctools.cscript): # Set default name is user name is empty if not name: - user_name = self._name + user_name = self._name() else: user_name = name diff --git a/cscripts/cspull.par b/cscripts/cspull.par index 6059c2a..be6bb59 100644 --- a/cscripts/cspull.par +++ b/cscripts/cspull.par @@ -27,21 +27,22 @@ outfile, f, a, pull.dat,,, "Output pull distribution file" # # Script parameters #================== -ntrials, i, a, 10,,, "Number of trials" -ra, r, a, 83.6331,0,360, "RA of pointing (degrees)" -dec, r, a, 22.0145,-90,90, "Dec of pointing (degrees)" -rad, r, h, 5.0,0,180, "Radius of ROI (degrees)" -coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)" -proj, s, a, TAN,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method" -emin, r, a, 0.1,,, "Lower energy limit (TeV)" -emax, r, a, 100.0,,, "Upper energy limit (TeV)" -enumbins, i, a, 0,,, "Number of energy bins (0=unbinned)" -tmin, t, a, 2020-01-01T00:00:00,,, "Start time (UTC string, JD, MJD or MET in seconds)" -tmax, t, a, 2020-01-01T00:30:00,,, "Stop time (UTC string, JD, MJD or MET in seconds)" -npix, i, a, 200,,, "Number of pixels for binned" -binsz, r, a, 0.05,,, "Pixel size for binned (degrees/pixel)" -profile, b, h, no,,, "Use likelihood profile method for errors?" -seed, i, h, 1,,, "Initial random number generator seed" +ntrials, i, a, 10,,, "Number of trials" +ra, r, a, 83.6331,0,360, "RA of pointing (degrees)" +dec, r, a, 22.0145,-90,90, "Dec of pointing (degrees)" +rad, r, h, 5.0,0,180, "Radius of ROI (degrees)" +coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)" +proj, s, a, TAN,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method" +emin, r, a, 0.1,,, "Lower energy limit (TeV)" +emax, r, a, 100.0,,, "Upper energy limit (TeV)" +enumbins, i, a, 0,,, "Number of energy bins (0=unbinned)" +tmin, t, a, 2020-01-01T00:00:00,,, "Start time (UTC string, JD, MJD or MET in seconds)" +tmax, t, a, 2020-01-01T00:30:00,,, "Stop time (UTC string, JD, MJD or MET in seconds)" +npix, i, a, 200,,, "Number of pixels for binned" +binsz, r, a, 0.05,,, "Pixel size for binned (degrees/pixel)" +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" +profile, b, h, no,,, "Use likelihood profile method for errors?" +seed, i, h, 1,,, "Initial random number generator seed" # # Standard parameters diff --git a/cscripts/cspull.py b/cscripts/cspull.py index 062a945..4a466cc 100755 --- a/cscripts/cspull.py +++ b/cscripts/cspull.py @@ -28,7 +28,7 @@ from cscripts import ioutils # ============ # # cspull class # # ============ # -class cspull(ctools.cscript): +class cspull(ctools.cslikelihood): """ Generates pull distributions for a model """ @@ -37,9 +37,8 @@ class cspull(ctools.cscript): """ Constructor """ - # Set name - self._name = 'cspull' - self._version = ctools.__version__ + # Initialise application by calling the appropriate class constructor + self._init_cslikelihood('cspull', ctools.__version__, argv) # Initialise some members self._edisp = False @@ -53,12 +52,6 @@ class cspull(ctools.cscript): self._seed = 1 self._chatter = 2 - # Initialise observation container from constructor arguments - self._obs, argv = self._set_input_obs(argv) - - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) - # Return return @@ -69,13 +62,16 @@ class cspull(ctools.cscript): Get parameters from parfile """ # If there are no observations in container then get some ... - if self._obs.size() == 0: - self._obs = self._get_observations() + if self.obs().size() == 0: + self.obs(self._get_observations()) # ... otherwise add response information and energy boundaries # in case they are missing else: - self._setup_observations(self._obs) + self._setup_observations(self.obs()) + + # Set observation statistic + self._set_obs_statistic(gammalib.toupper(self['statistic'].string())) # Get number of energy bins self._enumbins = self['enumbins'].integer() @@ -88,8 +84,8 @@ class cspull(ctools.cscript): self._proj = self['proj'].string() # Set models if we have none - if self._obs.models().size() == 0: - self._obs.models(self['inmodel'].filename()) + if self.obs().models().size() == 0: + self.obs().models(self['inmodel'].filename()) # Read other parameters self._ntrials = self['ntrials'].integer() @@ -168,7 +164,7 @@ class cspull(ctools.cscript): emax = None # Simulate events - obs = obsutils.sim(self._obs, + obs = obsutils.sim(self.obs(), emin=emin, emax=emax, nbins=self._enumbins, @@ -190,7 +186,7 @@ class cspull(ctools.cscript): # Write simulation results self._log_header3(gammalib.NORMAL, 'Simulation') - for run in self._obs: + for run in self.obs(): self._log_value(gammalib.NORMAL, 'Input observation %s' % run.id(), self._obs_string(run)) for run in obs: @@ -200,7 +196,7 @@ class cspull(ctools.cscript): # Fit model if self['profile'].boolean(): - models = self._obs.models() + models = self.obs().models() for model in models: like = ctools.cterror(obs) like['srcname'] = model.name() @@ -256,7 +252,7 @@ class cspull(ctools.cscript): # (fitted - true) / error # In case that the error is 0 the pull is set to 99 fitted_value = par.value() - real_value = self._obs.models()[i][k].value() + real_value = self.obs().models()[i][k].value() error = par.error() if error != 0.0: pull = (fitted_value - real_value) / error @@ -292,7 +288,7 @@ class cspull(ctools.cscript): self._get_parameters() # Write observation into logger - self._log_observations(gammalib.NORMAL, self._obs, 'Input observation') + self._log_observations(gammalib.NORMAL, self.obs(), 'Input observation') # Write header self._log_header1(gammalib.TERSE, 'Generate pull distribution') @@ -320,7 +316,7 @@ class cspull(ctools.cscript): Set model container """ # Set model container - self._obs.models(models) + self.obs().models(models) # Return return diff --git a/cscripts/cssens.par b/cscripts/cssens.par index ec14a9f..aec0553 100644 --- a/cscripts/cssens.par +++ b/cscripts/cssens.par @@ -28,18 +28,19 @@ outfile, f, h, sensitivity.dat,,, "Output sensitivity ASCII file" # # Script parameters #================== -offset, r, h, 0.0,,, "Source offset angle (deg)" -duration, r, a, 180000.0,,, "Effective exposure time (s)" -rad, r, a, 5.0,,, "Radius of ROI (deg)" -emin, r, a, 0.03163,,, "Lower energy limit (TeV)" -emax, r, a, 125.8925,,, "Upper energy limit (TeV)" -bins, i, a, 18,,, "Number of energy bins for differential sensitivity computation" -enumbins, i, h, 0,,, "Number of energy bins for binned analysis (0=unbinned)" -npix, i, h, 200,,, "Number of pixels for binned analysis" -binsz, r, h, 0.05,,, "Pixel size for binned analysis (deg/pixel)" -type, s, h, Differential,Differential|Integral,, "Sensitivity type" -sigma, r, h, 5.0,,, "Significance threshold (Gaussian sigma)" -max_iter, i, h, 50,,, "Maximum number of iterations" +offset, r, h, 0.0,,, "Source offset angle (deg)" +duration, r, a, 180000.0,,, "Effective exposure time (s)" +rad, r, a, 5.0,,, "Radius of ROI (deg)" +emin, r, a, 0.03163,,, "Lower energy limit (TeV)" +emax, r, a, 125.8925,,, "Upper energy limit (TeV)" +bins, i, a, 18,,, "Number of energy bins for differential sensitivity computation" +enumbins, i, h, 0,,, "Number of energy bins for binned analysis (0=unbinned)" +npix, i, h, 200,,, "Number of pixels for binned analysis" +binsz, r, h, 0.05,,, "Pixel size for binned analysis (deg/pixel)" +type, s, h, Differential,Differential|Integral,, "Sensitivity type" +sigma, r, h, 5.0,,, "Significance threshold (Gaussian sigma)" +max_iter, i, h, 50,,, "Maximum number of iterations" +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" # # Standard parameters diff --git a/cscripts/cssens.py b/cscripts/cssens.py index d25f258..a1981e8 100755 --- a/cscripts/cssens.py +++ b/cscripts/cssens.py @@ -30,7 +30,7 @@ from cscripts import ioutils # ============ # # cssens class # # ============ # -class cssens(ctools.cscript): +class cssens(ctools.cslikelihood): """ Computes the CTA sensitivity @@ -47,9 +47,8 @@ class cssens(ctools.cscript): """ Constructor. """ - # Set name - self._name = 'cssens' - self._version = ctools.__version__ + # Initialise application by calling the appropriate class constructor + self._init_cslikelihood('cssens', ctools.__version__, argv) # Initialise class members self._ebounds = gammalib.GEbounds() @@ -59,12 +58,6 @@ class cssens(ctools.cscript): self._dec = None self._log_clients = False - # Initialise observation container from constructor arguments - self._obs, argv = self._set_input_obs(argv) - - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) - # Return return @@ -75,12 +68,15 @@ class cssens(ctools.cscript): Get user parameters from parfile """ # Set observation if not done before - if self._obs.size() == 0: - self._obs = self._set_obs(self['emin'].real(), self['emax'].real()) + if self.obs().size() == 0: + self.obs(self._set_obs(self['emin'].real(), self['emax'].real())) + + # Set observation statistic + self._set_obs_statistic(gammalib.toupper(self['statistic'].string())) # Set models if we have none - if self._obs.models().size() == 0: - self._obs.models(self['inmodel'].filename()) + if self.obs().models().size() == 0: + self.obs().models(self['inmodel'].filename()) # Get source name self._srcname = self['srcname'].string() @@ -186,7 +182,7 @@ class cssens(ctools.cscript): Maximum energy """ # Loop over all observations in container - for i, obs in enumerate(self._obs): + for i, obs in enumerate(self.obs()): # Get energy boundaries of the observation obs_ebounds = self._obs_ebounds[i] @@ -337,11 +333,11 @@ class cssens(ctools.cscript): models = test_model.copy() crab_prefactor = models[self._srcname]['Prefactor'].value() * crab_unit models[self._srcname]['Prefactor'].value(crab_prefactor * test_crab_flux) - self._obs.models(models) + self.obs().models(models) # Simulate events for the models. "sim" holds an observation # container with observations containing the simulated events. - sim = obsutils.sim(self._obs, nbins=enumbins, seed=iterations, + sim = obsutils.sim(self.obs(), nbins=enumbins, seed=iterations, binsz=binsz, npix=npix, log=self._log_clients, debug=self['debug'].boolean(), @@ -488,7 +484,7 @@ class cssens(ctools.cscript): self._log_string(gammalib.TERSE, str(par)) # Restore energy boundaries of observation container - for i, obs in enumerate(self._obs): + for i, obs in enumerate(self.obs()): obs.events().ebounds(self._obs_ebounds[i]) # Store result @@ -583,7 +579,7 @@ class cssens(ctools.cscript): # Loop over observations and store a deep copy of the energy # boundaries for later use - for obs in self._obs: + for obs in self.obs(): self._obs_ebounds.append(obs.events().ebounds().copy()) # Initialise script @@ -593,14 +589,14 @@ class cssens(ctools.cscript): results = [] # Set test source model for this observation - models = modutils.test_source(self._obs.models(), self._srcname, + models = modutils.test_source(self.obs().models(), self._srcname, ra=self._ra, dec=self._dec) # Write observation into logger - self._log_observations(gammalib.NORMAL, self._obs, 'Observation') + self._log_observations(gammalib.NORMAL, self.obs(), 'Input observation') # Write models into logger - self._log_models(gammalib.NORMAL, models, 'Model') + self._log_models(gammalib.TERSE, models, 'Input model') # Get sensitivity type sensitivity_type = self['type'].string() diff --git a/cscripts/cstsdist.par b/cscripts/cstsdist.par index 9f45e57..8a023fd 100644 --- a/cscripts/cstsdist.par +++ b/cscripts/cstsdist.par @@ -32,19 +32,20 @@ outfile, f, a, ts.dat,,, "Output Test Statistic distribution file" # # Script parameters #================== -ntrials, i, a, 10,,, "Number of trials" -ra, r, a, 83.63,0,360, "RA of pointing (degrees)" -dec, r, a, 22.01,-90,90, "Dec of pointing (degrees)" -rad, r, h, 5.0,0,180, "Radius of ROI (degrees)" -coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)" -proj, s, a, TAN,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method" -emin, r, a, 0.1,,, "Lower energy limit (TeV)" -emax, r, a, 100.0,,, "Upper energy limit (TeV)" -enumbins, i, a, 0,,, "Number of energy bins (0=unbinned)" -tmin, t, a, 2020-01-01T00:00:00,,, "Start time (UTC string, JD, MJD or MET in seconds)" -tmax, t, a, 2020-01-01T00:30:00,,, "Stop time (UTC string, JD, MJD or MET in seconds)" -npix, i, a, 200,,, "Number of pixels for binned" -binsz, r, a, 0.05,,, "Pixel size for binned (degrees/pixel)" +ntrials, i, a, 10,,, "Number of trials" +ra, r, a, 83.63,0,360, "RA of pointing (degrees)" +dec, r, a, 22.01,-90,90, "Dec of pointing (degrees)" +rad, r, h, 5.0,0,180, "Radius of ROI (degrees)" +coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)" +proj, s, a, TAN,AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN,, "Projection method" +emin, r, a, 0.1,,, "Lower energy limit (TeV)" +emax, r, a, 100.0,,, "Upper energy limit (TeV)" +enumbins, i, a, 0,,, "Number of energy bins (0=unbinned)" +tmin, t, a, 2020-01-01T00:00:00,,, "Start time (UTC string, JD, MJD or MET in seconds)" +tmax, t, a, 2020-01-01T00:30:00,,, "Stop time (UTC string, JD, MJD or MET in seconds)" +npix, i, a, 200,,, "Number of pixels for binned" +binsz, r, a, 0.05,,, "Pixel size for binned (degrees/pixel)" +statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization statistic" # # Standard parameters diff --git a/cscripts/cstsdist.py b/cscripts/cstsdist.py index 4954a04..46c754a 100755 --- a/cscripts/cstsdist.py +++ b/cscripts/cstsdist.py @@ -29,7 +29,7 @@ from cscripts import ioutils # ============== # # cstsdist class # # ============== # -class cstsdist(ctools.cscript): +class cstsdist(ctools.cslikelihood): """ Generates Test Statistic distribution for a model """ @@ -39,20 +39,13 @@ class cstsdist(ctools.cscript): """ Constructor. """ - # Set name - self._name = 'cstsdist' - self._version = ctools.__version__ + # Initialise application by calling the appropriate class constructor + self._init_cslikelihood('cstsdist', ctools.__version__, argv) # Initialise some members self._srcname = '' self._log_clients = False - # Initialise observation container from constructor arguments - self._obs, argv = self._set_input_obs(argv) - - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) - # Return return @@ -63,8 +56,11 @@ class cstsdist(ctools.cscript): Get parameters from parfile and setup the observation """ # Set observation if not done before - if self._obs.size() == 0: - self._obs = self._get_observations() + if self.obs().size() == 0: + self.obs(self._get_observations()) + + # Set observation statistic + self._set_obs_statistic(gammalib.toupper(self['statistic'].string())) # Get source name self._srcname = self['srcname'].string() @@ -77,8 +73,8 @@ class cstsdist(ctools.cscript): self['proj'].string() # Set models if we have none - if self._obs.models().size() == 0: - self._obs.models(self['inmodel'].filename()) + if self.obs().models().size() == 0: + self.obs().models(self['inmodel'].filename()) # Query parameters self['edisp'].boolean() @@ -107,8 +103,7 @@ class cstsdist(ctools.cscript): Result dictionary """ # Write header - if self._logExplicit(): - self._log.header2('Trial '+str(seed+1)) + self._log_header2(gammalib.EXPLICIT, 'Trial %d' % (seed+1)) # Set default binned parameters coordsys = 'CEL' @@ -124,7 +119,7 @@ class cstsdist(ctools.cscript): proj = self['proj'].string() # Simulate events - sim = obsutils.sim(self._obs, + sim = obsutils.sim(self.obs(), nbins = self['enumbins'].integer(), seed = seed, proj = proj, @@ -226,30 +221,16 @@ class cstsdist(ctools.cscript): self._get_parameters() # Set test source model for this observation - self.models(modutils.test_source(self._obs.models(), self._srcname)) - - # Write models into logger - if self._logTerse(): - self._log('\n') - self._log.header1('Models') - self._log(str(self._obs.models())) - self._log('\n') + self.models(modutils.test_source(self.obs().models(), self._srcname)) # Write observation into logger - if self._logTerse(): - self._log('\n') - self._log.header1(gammalib.number('Observation',len(self._obs))) - self._log(str(self._obs)) - self._log('\n') - if self._logExplicit(): - for obs in self._obs: - self._log(str(obs)) - self._log('\n') + self._log_observations(gammalib.NORMAL, self.obs(), 'Input observation') + + # Write models into logger + self._log_models(gammalib.TERSE, self.obs().models(), 'Input model') # Write header - if self._logTerse(): - self._log('\n') - self._log.header1('Generate TS distribution') + self._log_header1(gammalib.TERSE, 'Generate TS distribution') # Loop over trials for seed in range(self['ntrials'].integer()): @@ -274,7 +255,7 @@ class cstsdist(ctools.cscript): Model container """ # Copy models - self._obs.models(models) + self.obs().models(models) # Return return diff --git a/doc/source/admin/release_history/1.5.rst b/doc/source/admin/release_history/1.5.rst index 88fe5b2..22d7ae7 100644 --- a/doc/source/admin/release_history/1.5.rst +++ b/doc/source/admin/release_history/1.5.rst @@ -23,6 +23,11 @@ Bug fixes Improvements ------------ +* [`2237 `_] - + Add ``statistic`` parameters to :ref:`ctbutterfly`, :ref:`cterror`, + :ref:`cttsmap`, :ref:`ctulimit`, :ref:`cslightcrv, :ref:`csphasecrv`, + :ref:`cspull`, :ref:`cssens`, :ref:`csspec`, :ref:`cstsdist` and + :ref:`cstsmapsplit` * [`2231 `_] - Enable handling of On/Off observations in :ref:`csspec` * [`2207 `_] - @@ -50,3 +55,7 @@ Clean up * [`2237 `_] - Rename :ref:`ctlike` ``stat`` parameter to ``statistic`` +* [`2237 `_] - + Derive :ref:`cslightcrv, :ref:`csphasecrv`, :ref:`cspull`, :ref:`cssens`, + :ref:`csspec` and :ref:`cttsdist` scripts from ``cslikelihood`` base + class diff --git a/doc/source/users/reference_manual/cslightcrv.rst b/doc/source/users/reference_manual/cslightcrv.rst index bd7ae9d..932da9c 100644 --- a/doc/source/users/reference_manual/cslightcrv.rst +++ b/doc/source/users/reference_manual/cslightcrv.rst @@ -38,7 +38,7 @@ General parameters ``caldb [string]`` Calibration database. - + ``irf [string]`` Instrumental response function. @@ -65,34 +65,42 @@ General parameters ``emin [real]`` Lower energy limit of events (in TeV). - + ``emax [real]`` Upper energy limit of events (in TeV). - + ``enumbins [integer]`` Number of energy bins per light curve bin (0=unbinned). ``coordsys [string]`` Coordinate system (CEL - celestial, GAL - galactic). - + ``proj [string]`` Projection method. ``xref [real]`` Right Ascension / Galactic longitude of image centre (J2000, in degrees). - + ``yref [real]`` Declination / Galactic latitude of image centre (J2000, in degrees). ``nxpix [integer]`` Size of the Right Ascension / Galactic longitude axis (in pixels). - + ``nypix [integer]`` Size of the Declination / Galactic latitude axis (in pixels). - + ``binsz [real]`` Pixel size (in degrees/pixel). +``(statistic = DEFAULT) [string]`` + Optimization statistic. ``DEFAULT`` uses the default statistic for all + observations, which is ``CSTAT`` or the statistic specified in the + observation definition XML file. ``CSTAT`` uses the C statistic for + all observations, ``WSTAT`` uses the W statistic for all On/Off + observations, and ``CHI2`` uses the Chi squared statistic for all + binned or stacked observations. + ``(calc_ts = yes) [boolean]`` Compute TS value for each time bin? @@ -115,20 +123,21 @@ Standard parameters ``(chatter = 2) [integer]`` Verbosity of the executable: ``chatter = 0``: no information will be logged - + ``chatter = 1``: only errors will be logged - + ``chatter = 2``: errors and actions will be logged - + ``chatter = 3``: report about the task execution - + ``chatter = 4``: detailed report about the task execution ``(clobber = yes) [boolean]`` Specifies whether an existing light curve output file should be overwritten. ``(debug = no) [boolean]`` - Enables debug mode. In debug mode the executable will dump any log file output to the console. + Enables debug mode. In debug mode the executable will dump any log file + output to the console. ``(mode = ql) [string]`` Mode of automatic parameters (default is "ql", i.e. "query and learn"). diff --git a/doc/source/users/reference_manual/csphasecrv.rst b/doc/source/users/reference_manual/csphasecrv.rst index 34bfba0..ad3d124 100644 --- a/doc/source/users/reference_manual/csphasecrv.rst +++ b/doc/source/users/reference_manual/csphasecrv.rst @@ -35,7 +35,7 @@ General parameters ``caldb [string]`` Calibration database. - + ``irf [string]`` Instrumental response function. @@ -57,34 +57,42 @@ General parameters ``emin [real]`` Lower energy limit of events (in TeV). - + ``emax [real]`` Upper energy limit of events (in TeV). - + ``enumbins [integer]`` Number of energy bins per phase bin (0=unbinned). ``coordsys [string]`` Coordinate system (CEL - celestial, GAL - galactic). - + ``proj [string]`` Projection method. ``xref [real]`` Right Ascension / Galactic longitude of image centre (J2000, in degrees). - + ``yref [real]`` Declination / Galactic latitude of image centre (J2000, in degrees). ``nxpix [integer]`` Size of the Right Ascension / Galactic longitude axis (in pixels). - + ``nypix [integer]`` Size of the Declination / Galactic latitude axis (in pixels). - + ``binsz [real]`` Pixel size (in degrees/pixel). +``(statistic = DEFAULT) [string]`` + Optimization statistic. ``DEFAULT`` uses the default statistic for all + observations, which is ``CSTAT`` or the statistic specified in the + observation definition XML file. ``CSTAT`` uses the C statistic for + all observations, ``WSTAT`` uses the W statistic for all On/Off + observations, and ``CHI2`` uses the Chi squared statistic for all + binned or stacked observations. + Standard parameters ------------------- @@ -95,21 +103,22 @@ Standard parameters ``(chatter = 2) [integer]`` Verbosity of the executable: ``chatter = 0``: no information will be logged - + ``chatter = 1``: only errors will be logged - + ``chatter = 2``: errors and actions will be logged - + ``chatter = 3``: report about the task execution - + ``chatter = 4``: detailed report about the task execution ``(clobber = yes) [boolean]`` Specifies whether an existing light curve output file should be overwritten. - + ``(debug = no) [boolean]`` - Enables debug mode. In debug mode the executable will dump any log file output to the console. - + Enables debug mode. In debug mode the executable will dump any log file + output to the console. + ``(mode = ql) [string]`` Mode of automatic parameters (default is "ql", i.e. "query and learn"). diff --git a/doc/source/users/reference_manual/cspull.rst b/doc/source/users/reference_manual/cspull.rst index 5a4737c..1fbcfe2 100644 --- a/doc/source/users/reference_manual/cspull.rst +++ b/doc/source/users/reference_manual/cspull.rst @@ -40,31 +40,28 @@ General parameters ``inmodel [file]`` Input model XML file. - -``outfile [file]`` - ASCII file containing the individual pull values. - + ``caldb [string]`` Calibration database. - + ``irf [string]`` Instrumental response function. -``(deadc = 0.98) [real]`` - Average deadtime correction factor. - ``(edisp = no) [boolean]`` Apply energy dispersion to response computation? -``(profile = no) [boolean]`` - Use likelihood profile method for errors? +``(deadc = 0.98) [real]`` + Average deadtime correction factor. + +``outfile [file]`` + ASCII file containing the individual pull values. ``ntrials [integer]`` Number of samples for generating the pull distribution. - + ``ra [real]`` Right Ascension of CTA pointing (J2000, in degrees). - + ``dec [real]`` Declination of CTA pointing (J2000, in degrees). @@ -73,31 +70,45 @@ General parameters ``coordsys [string]`` Coordinate system (CEL - celestial, GAL - galactic). - + ``proj [string]`` Projection method. - + ``emin [real]`` Lower energy limit of events (in TeV). - + ``emax [real]`` Upper energy limit of events (in TeV). - + ``enumbins [integer]`` Number of energy bins (0=unbinned). - + ``tmin [time]`` Start time (UTC string, JD, MJD or MET in seconds). - + ``tmax [time]`` Stop time (UTC string, JD, MJD or MET in seconds). - + ``npix [integer]`` Number of pixels for binned analysis. - + ``binsz [real]`` Pixel size for binned analysis. +``(statistic = DEFAULT) [string]`` + Optimization statistic. ``DEFAULT`` uses the default statistic for all + observations, which is ``CSTAT`` or the statistic specified in the + observation definition XML file. ``CSTAT`` uses the C statistic for + all observations, ``WSTAT`` uses the W statistic for all On/Off + observations, and ``CHI2`` uses the Chi squared statistic for all + binned or stacked observations. + +``(profile = no) [boolean]`` + Use likelihood profile method for errors? + +``(seed = 1) [integer]`` + Initial random number generator seed. + Standard parameters ------------------- @@ -105,22 +116,22 @@ Standard parameters ``(chatter = 2) [integer]`` Verbosity of the executable: ``chatter = 0``: no information will be logged - + ``chatter = 1``: only errors will be logged - + ``chatter = 2``: errors and actions will be logged - + ``chatter = 3``: report about the task execution - + ``chatter = 4``: detailed report about the task execution - + ``(clobber = yes) [boolean]`` Specifies whether an existing output file should be overwritten. - + ``(debug = no) [boolean]`` Enables debug mode. In debug mode the executable will dump any log file output to the console. - + ``(mode = ql) [string]`` Mode of automatic parameters (default is "ql", i.e. "query and learn"). diff --git a/doc/source/users/reference_manual/cssens.rst b/doc/source/users/reference_manual/cssens.rst index 57be9a4..4ea9a95 100644 --- a/doc/source/users/reference_manual/cssens.rst +++ b/doc/source/users/reference_manual/cssens.rst @@ -52,54 +52,65 @@ General parameters Name of the source in the source model XML file which should be used for sensitivity computation. -``(offset = 0.0) [real]`` - Offset angle of source in field of view (in degrees). - ``caldb [string]`` Calibration database. - + ``irf [string]`` Instrumental response function. +``(edisp = no) [boolean]`` + Apply energy dispersion to response computation? + ``(deadc = 0.95) [real]`` Average deadtime correction factor. - + ``outfile [file]`` ASCII file containing the sensitivity values. - + +``(offset = 0.0) [real]`` + Offset angle of source in field of view (in degrees). + ``duration [real]`` Effective exposure time (in seconds). - + ``rad [real]`` Radius of Region of Interest (RoI) (in degrees). - + ``emin [real]`` Lower energy limit for sensitivity computation (in TeV). - + ``emax [real]`` Upper energy limit for sensitivity computation (in TeV). ``bins [integer]`` Number of energy bins for sensitivity computation. - + ``(enumbins = 0) [integer]`` Number of energy bins (0=unbinned). - + ``(npix = 200) [integer]`` Number of pixels for binned analysis. - + ``(binsz = 0.05) [real]`` Pixel size for binned analysis. - + ``(type = Differential) [string]`` Sensitivity type. - + ``(sigma = 5.0) [real]`` Significance threshold. - + ``(max_iter = 50) [integer]`` Maximum number of iterations. - + +``(statistic = DEFAULT) [string]`` + Optimization statistic. ``DEFAULT`` uses the default statistic for all + observations, which is ``CSTAT`` or the statistic specified in the + observation definition XML file. ``CSTAT`` uses the C statistic for + all observations, ``WSTAT`` uses the W statistic for all On/Off + observations, and ``CHI2`` uses the Chi squared statistic for all + binned or stacked observations. + Standard parameters ------------------- @@ -107,21 +118,22 @@ Standard parameters ``(chatter = 2) [integer]`` Verbosity of the executable: ``chatter = 0``: no information will be logged - + ``chatter = 1``: only errors will be logged - + ``chatter = 2``: errors and actions will be logged - + ``chatter = 3``: report about the task execution - + ``chatter = 4``: detailed report about the task execution - + ``(clobber = yes) [boolean]`` Specifies whether an existing output file should be overwritten. - + ``(debug = no) [boolean]`` - Enables debug mode. In debug mode the executable will dump any log file output to the console. - + Enables debug mode. In debug mode the executable will dump any log file + output to the console. + ``(mode = ql) [string]`` Mode of automatic parameters (default is "ql", i.e. "query and learn"). diff --git a/doc/source/users/reference_manual/cstsdist.rst b/doc/source/users/reference_manual/cstsdist.rst index a6d4155..6e14e55 100644 --- a/doc/source/users/reference_manual/cstsdist.rst +++ b/doc/source/users/reference_manual/cstsdist.rst @@ -42,9 +42,6 @@ General parameters Name of the source in the source model XML file which should be used for Test Statistics computation. -``outfile [file]`` - Output ASCII file containing the TS distribution values. - ``expcube [file]`` Input exposure cube file. @@ -59,22 +56,25 @@ General parameters ``caldb [string]`` Calibration database. - + ``irf [string]`` Instrumental response function. - -``(deadc = 0.98) [real]`` - Average deadtime correction factor. ``(edisp = no) [boolean]`` Apply energy dispersion to response computation. +``(deadc = 0.98) [real]`` + Average deadtime correction factor. + +``outfile [file]`` + Output ASCII file containing the TS distribution values. + ``ntrials [integer]`` Number of Monte Carlo samples. ``ra [real]`` Right Ascension of CTA pointing (J2000, in degrees). - + ``dec [real]`` Declination of CTA pointing (J2000, in degrees). @@ -83,31 +83,39 @@ General parameters ``coordsys [string]`` Coordinate system (CEL - celestial, GAL - galactic). - + ``proj [string]`` Projection method. ``emin [real]`` Lower energy limit (in TeV). - + ``emax [real]`` Upper energy limit (in TeV). - + ``enumbins [integer]`` Number of energy bins (0=unbinned). - + ``tmin [time]`` Start time (UTC string, JD, MJD or MET in seconds). - + ``tmax [time]`` Stop time (UTC string, JD, MJD or MET in seconds). - + ``npix [integer]`` Number of pixels for binned analysis. - + ``binsz [real]`` Pixel size for binned analysis. +``(statistic = DEFAULT) [string]`` + Optimization statistic. ``DEFAULT`` uses the default statistic for all + observations, which is ``CSTAT`` or the statistic specified in the + observation definition XML file. ``CSTAT`` uses the C statistic for + all observations, ``WSTAT`` uses the W statistic for all On/Off + observations, and ``CHI2`` uses the Chi squared statistic for all + binned or stacked observations. + Standard parameters ------------------- @@ -115,21 +123,22 @@ Standard parameters ``(chatter = 2) [integer]`` Verbosity of the executable: ``chatter = 0``: no information will be logged - + ``chatter = 1``: only errors will be logged - + ``chatter = 2``: errors and actions will be logged - + ``chatter = 3``: report about the task execution - + ``chatter = 4``: detailed report about the task execution - + ``(clobber = yes) [boolean]`` Specifies whether an existing output file should be overwritten. - + ``(debug = no) [boolean]`` - Enables debug mode. In debug mode the executable will dump any log file output to the console. - + Enables debug mode. In debug mode the executable will dump any log file + output to the console. + ``(mode = ql) [string]`` Mode of automatic parameters (default is "ql", i.e. "query and learn"). -- libgit2 0.21.4