From d315b8c8d0b6e9fa9360544ce9514f6c8cd7eb63 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Tue, 24 Nov 2015 22:05:10 +0100 Subject: [PATCH] Integrate code. --- ChangeLog | 8 ++++++++ NEWS | 18 +++++++++--------- README | 4 ++-- cscripts/Makefile.am | 4 ++-- cscripts/csmodelinfo.py | 30 +++++++++++++++--------------- cscripts/csmodelmerge.py | 27 ++++++++++++++------------- cscripts/csobsinfo.py | 79 ++++++++++++++++++++++++++++++++++++++++--------------------------------------- cscripts/cstsmapmerge.py | 66 ++++++++++++++++++++++++++++++++++-------------------------------- doc/source/reference_manual/cscaldb.rst | 2 +- doc/source/reference_manual/csmodelinfo.rst | 29 +++++++++++++++-------------- doc/source/reference_manual/csmodelmerge.rst | 18 ++++++++++-------- doc/source/reference_manual/csobsinfo.rst | 43 +++++++++++++++++++++++-------------------- doc/source/reference_manual/cstsmapmerge.rst | 17 +++++++++-------- doc/source/reference_manual/cttsmap.rst | 7 ++++--- doc/source/reference_manual/index.rst | 8 ++++---- test/test_cscripts.sh.in | 18 +++++++++--------- 16 files changed, 199 insertions(+), 179 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce3b18b..d5da85d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-11-24 Juergen Knoedlseder + + * Version 1.1.0 released + ======================== + + Add csobsinfo, csmodelinfo, csmodelmerge, cstsmapmerge (#1578) + + 2015-11-06 Juergen Knoedlseder * Version 1.0.0 released diff --git a/NEWS b/NEWS index 39ce609..28470fb 100644 --- a/NEWS +++ b/NEWS @@ -1,15 +1,15 @@ -New Features and Important Changes in ctools 1.0.0 +New Features and Important Changes in ctools 1.1.0 Author(s) : Juergen Knoedlseder -6 November 2015 +24 November 2015 1. Introduction --------------- This document briefly summarizes executable by executable the most important changes made since the last release of ctools. The code complies to GammaLib -version 1.0.0 or above. +version 1.1.0 or above. 2. Configuration @@ -79,8 +79,7 @@ None 15. ctcubemask - CTA cube filtering ----------------------------------- -Allow to ignore the spatial filtering by specifying NONE parameters for "ra", -"dec" or "rad". +None 16. ctbutterfly - Generate butterfly diagrams @@ -100,10 +99,11 @@ None 19. cscripts ------------ -The csspec script now handled correctly stacked data. Dependent on the -requested energy binning, it selects for each spectral energy bin the -relevant energy bins from the counts cube and performs a maximum likelihood -analysis. +The following scripts have been added: +- csobsinfo: dump information in observation container +- csmodelinfo: dump information in model container +- csmodelmerge: merge model containers into single container +- cstsmapmerge: merge sliced TS map into single map 20. Examples diff --git a/README b/README index 32ab148..2651741 100644 --- a/README +++ b/README @@ -1,8 +1,8 @@ ctools information ================== -Version: 0.10.0 (31 October 2015) +Version: 1.1.0 (24 November 2015) Author: Juergen Knodlseder (jurgen.knodlseder@irap.omp.eu) -GammaLib dependency: 0.11.0 +GammaLib dependency: 1.1.0 License information diff --git a/cscripts/Makefile.am b/cscripts/Makefile.am index bc1675a..f2a8d6a 100644 --- a/cscripts/Makefile.am +++ b/cscripts/Makefile.am @@ -9,8 +9,8 @@ pythonscripts = __init__.py \ # Scripts for which symbolic links will be created in bindir linkscripts = cspull cssens cstsdist cscaldb csresmap \ - cshessobs csobsdef csspec cslightcrv csobsinfo csmodelmerge \ - csinfo csmodelinfo cstsmapmerge + cshessobs csobsdef csspec cslightcrv csobsinfo \ + csinfo csmodelinfo csmodelmerge cstsmapmerge # Distribute scripts EXTRA_DIST = $(binscripts) $(pythonscripts) diff --git a/cscripts/csmodelinfo.py b/cscripts/csmodelinfo.py index 556e8e1..2356984 100755 --- a/cscripts/csmodelinfo.py +++ b/cscripts/csmodelinfo.py @@ -23,15 +23,16 @@ import ctools import sys -# =============== # -# cshessobs class # -# =============== # +# ================= # +# csmodelinfo class # +# ================= # class csmodelinfo(ctools.cscript): """ - This class dumps information about a model container into a logfile or on screen. - This might be helpful for quick access to the model container, e.g. number of sources, - background models, free and fixed parameters etc. - The tool can also dump the models into a region file to display e.g. with ds9. + This class dumps information about a model container into a logfile or + on screen. This might be helpful for quick access to the model container, + showing, e.g., number of sources, background models, free and fixed + parameters etc. The tool can also dump the models into a region file to + display e.g. with ds9. """ def __init__(self, *argv): """ @@ -39,7 +40,7 @@ class csmodelinfo(ctools.cscript): """ # Set name self.name = "csmodelinfo" - self.version = "0.1.0" + self.version = "1.1.0" # Make sure that parfile exists file = self.parfile() @@ -69,7 +70,8 @@ class csmodelinfo(ctools.cscript): def parfile(self): """ Check if parfile exists. If parfile does not exist then create a - default parfile. This kluge avoids shipping the cscript with a parfile. + default parfile. This kluge avoids shipping the cscript with a + parfile. """ # Set parfile name @@ -108,10 +110,10 @@ class csmodelinfo(ctools.cscript): Get parameters from parfile and setup the observation. """ # Get models - self.models = gammalib.GModels(self["inmodel"].filename()) + self.models = gammalib.GModels(self["inmodel"].filename()) - # Get ds9 file - self.ds9file = self["ds9file"].filename() + # Get ds9 filename + self.ds9file = self["ds9file"].filename() # Get hidden parameters for region file self.pnt_type = self["pnt_type"].string() @@ -128,7 +130,6 @@ class csmodelinfo(ctools.cscript): # Return return - def run(self): """ @@ -321,7 +322,7 @@ class csmodelinfo(ctools.cscript): def save(self): """ - Save pointings to ds9 region file if required + Save models to ds9 region file if required """ # Check if ds9 file is valid @@ -479,7 +480,6 @@ class csmodelinfo(ctools.cscript): # Return string return ds9string - def execute(self): """ Execute the script. diff --git a/cscripts/csmodelmerge.py b/cscripts/csmodelmerge.py index 3326f7d..ff67612 100755 --- a/cscripts/csmodelmerge.py +++ b/cscripts/csmodelmerge.py @@ -24,12 +24,13 @@ import sys import glob -# =============== # -# cshessobs class # -# =============== # +# ================== # +# csmodelmerge class # +# ================== # class csmodelmerge(ctools.cscript): """ - This class merges an arbitray number of model container into one output model XML file + This class merges an arbitray number of model container into one output + model XML file. """ def __init__(self, *argv): """ @@ -37,7 +38,7 @@ class csmodelmerge(ctools.cscript): """ # Set name self.name = "csmodelmerge" - self.version = "0.1.0" + self.version = "1.1.0" # Make sure that parfile exists file = self.parfile() @@ -67,7 +68,8 @@ class csmodelmerge(ctools.cscript): def parfile(self): """ Check if parfile exists. If parfile does not exist then create a - default parfile. This kluge avoids shipping the cscript with a parfile. + default parfile. This kluge avoids shipping the cscript with a + parfile. """ # Set parfile name @@ -116,7 +118,9 @@ class csmodelmerge(ctools.cscript): # Throw exception if input models cannot be decoded else: - msg = "Parameter \"inmodels\" must contain either an @ASCII file, a comma-separated or space-separated list of files or a wildcard string" + msg = "Parameter \"inmodels\" must contain either an @ASCII"+\ + " file, a comma-separated or whitespace-separated list"+\ + " of files or a wildcard string" raise gammalib.GException.invalid_argument("csmodelmerge::get_parameters", msg) # Get output file @@ -125,7 +129,6 @@ class csmodelmerge(ctools.cscript): # Return return - def run(self): """ Run the script. @@ -141,13 +144,13 @@ class csmodelmerge(ctools.cscript): if self.logTerse(): self.log_parameters() self.log("\n") - + + # Dump header if self.logTerse(): self.log("\n") self.log.header1("Merging Models") self.log("\n") - - + # Initialise output model container self.models = gammalib.GModels() @@ -172,7 +175,6 @@ class csmodelmerge(ctools.cscript): """ Save pointings to ds9 region file if required """ - # Logging if self.logExplicit(): self.log("\n") @@ -185,7 +187,6 @@ class csmodelmerge(ctools.cscript): # Return return - def execute(self): """ Execute the script. diff --git a/cscripts/csobsinfo.py b/cscripts/csobsinfo.py index fcf04fb..c438563 100755 --- a/cscripts/csobsinfo.py +++ b/cscripts/csobsinfo.py @@ -24,13 +24,13 @@ import sys # =============== # -# cshessobs class # +# csobsinfo class # # =============== # class csobsinfo(ctools.cscript): """ - This class dumps information about an observation container into a logfile or on screen. - This might be helpful for quick access to an observation container, e.g. total lifetime, - energy range etc. + This class dumps information about an observation container into a + logfile or on screen. This might be helpful for quick access to an + observation container showing, e.g., total lifetime, energy range etc. """ def __init__(self, *argv): """ @@ -38,7 +38,7 @@ class csobsinfo(ctools.cscript): """ # Set name self.name = "csobsinfo" - self.version = "0.1.0" + self.version = "1.1.0" # Make sure that parfile exists file = self.parfile() @@ -68,7 +68,8 @@ class csobsinfo(ctools.cscript): def parfile(self): """ Check if parfile exists. If parfile does not exist then create a - default parfile. This kluge avoids shipping the cscript with a parfile. + default parfile. This kluge avoids shipping the cscript with a + parfile. """ # Set parfile name @@ -104,18 +105,19 @@ class csobsinfo(ctools.cscript): # Initialise object position self.obj_dir = gammalib.GSkyDir() - + + # Get (optional) offset parameters self.m_offset = self["offset"].boolean() if self.m_offset: - ra = self["ra"].real() + ra = self["ra"].real() dec = self["dec"].real() self.obj_dir.radec_deg(ra,dec) - + + # Get (optional) DS9 filename self.ds9file = self["ds9file"].filename() # Return return - def run(self): """ @@ -135,21 +137,21 @@ class csobsinfo(ctools.cscript): # Initialise arrays to store certain values for reuse # Todo, think about using a python dictionary - self.offsets = [] - self.zeniths = [] + self.offsets = [] + self.zeniths = [] self.azimuths = [] - self.pnt_ra = [] - self.pnt_dec = [] - obs_names = [] + self.pnt_ra = [] + self.pnt_dec = [] + obs_names = [] # Initialise output to be filled - self.ebounds = gammalib.GEbounds() - self.gti = gammalib.GGti() - ontime = 0.0 - livetime = 0.0 - n_events = 0 - n_eventbins = 0 - n_obs_binned = 0 + self.ebounds = gammalib.GEbounds() + self.gti = gammalib.GGti() + ontime = 0.0 + livetime = 0.0 + n_events = 0 + n_eventbins = 0 + n_obs_binned = 0 n_obs_unbinned = 0 # Logging @@ -183,9 +185,9 @@ class csobsinfo(ctools.cscript): # Retrieve time interval obs_gti = obs.events().gti() - # Compute mean time and dead tim fraction in percent - tmean = (obs_gti.tstart() + obs_gti.tstop()) - tmean*=0.5 + # Compute mean time and dead time fraction in percent + tmean = (obs_gti.tstart() + obs_gti.tstop()) + tmean *= 0.5 deadfrac = (1.0-obs.deadc(tmean))*100.0 # Retrieve pointing and store Ra,Dec @@ -209,7 +211,7 @@ class csobsinfo(ctools.cscript): self.log.parformat("binned") if obs.eventtype() == "CountsCube": - n_eventbins += obs.events().size() + n_eventbins += obs.events().size() n_obs_binned += 1 if self.logTerse(): self.log("yes") @@ -218,7 +220,7 @@ class csobsinfo(ctools.cscript): self.log(str(obs.events().size())) self.log("\n") else: - n_events += obs.events().size() + n_events += obs.events().size() n_obs_unbinned += 1 if self.logTerse(): self.log("no") @@ -239,7 +241,7 @@ class csobsinfo(ctools.cscript): self.log("\n") # Log observation time interval - self.log.parformat("Time range [MJD]") + self.log.parformat("Time range (MJD)") if obs_gti.size() == 0: self.log("undefined") else: @@ -257,8 +259,8 @@ class csobsinfo(ctools.cscript): self.log("\n") # Log dead time fraction - self.log.parformat("Dead-time fraction [%]") - self.log("%.3f"%deadfrac) + self.log.parformat("Dead-time fraction (%)") + self.log("%.3f" % (deadfrac)) self.log("\n") # Log pointing direction @@ -271,7 +273,7 @@ class csobsinfo(ctools.cscript): offset = pnt_dir.dist_deg(self.obj_dir) self.offsets.append(offset) self.log.parformat("Offset") - self.log("%.2f"%(offset)) + self.log("%.2f" % (offset)) self.log("\n") else: self.offsets.append(-1.0) @@ -285,10 +287,10 @@ class csobsinfo(ctools.cscript): # Log Zenith and Azimuth if required if self.logExplicit(): self.log.parformat("Zenith angle") - self.log("%.2f"%(zenith)) + self.log("%.2f" % (zenith)) self.log("\n") self.log.parformat("Azimuth angle") - self.log("%.2f"%(azimuth)) + self.log("%.2f" % (azimuth)) self.log("\n\n") # Log summary @@ -315,15 +317,15 @@ class csobsinfo(ctools.cscript): # Log mean offset if possible if self.m_offset: self.log.parformat("Mean offset angle") - self.log("%.2f"%(sum(self.offsets)/len(self.offsets))) + self.log("%.2f" % (sum(self.offsets)/len(self.offsets))) self.log("\n") # Log mean azimuth and zenith angle self.log.parformat("Mean zenith angle") - self.log("%.2f"%(sum(self.zeniths)/len(self.zeniths))) + self.log("%.2f" % (sum(self.zeniths)/len(self.zeniths))) self.log("\n") self.log.parformat("Mean azimuth angle") - self.log("%.2f"%(sum(self.azimuths)/len(self.azimuths))) + self.log("%.2f" % (sum(self.azimuths)/len(self.azimuths))) self.log("\n") # Log name of observations if requested @@ -361,10 +363,10 @@ class csobsinfo(ctools.cscript): # Log ontime and livetime in different units self.log.parformat("Total ontime") - self.log("%.2f s = %.2f min = %.2f h"%(ontime, ontime/60., ontime/3600.)) + self.log("%.2f s = %.2f min = %.2f h" % (ontime, ontime/60., ontime/3600.)) self.log("\n") self.log.parformat("Total livetime") - self.log("%.2f s = %.2f min = %.2f h"%(livetime, livetime/60.0, livetime/3600.)) + self.log("%.2f s = %.2f min = %.2f h" % (livetime, livetime/60.0, livetime/3600.)) self.log("\n") # Return @@ -385,7 +387,6 @@ class csobsinfo(ctools.cscript): f.write("fk5\n") # Loop over pointings - for i in range(len(self.pnt_ra)): # Create string diff --git a/cscripts/cstsmapmerge.py b/cscripts/cstsmapmerge.py index 10ca6fe..df444d9 100755 --- a/cscripts/cstsmapmerge.py +++ b/cscripts/cstsmapmerge.py @@ -25,12 +25,12 @@ import glob import os -# =============== # -# cshessobs class # -# =============== # +# ================== # +# cstsmapmerge class # +# ================== # class cstsmapmerge(ctools.cscript): """ - This class merges an arbitray number of model container into one output model XML file + This class merges TS map files into one TS map """ def __init__(self, *argv): """ @@ -38,7 +38,7 @@ class cstsmapmerge(ctools.cscript): """ # Set name self.name = "cstsmapmerge" - self.version = "0.1.0" + self.version = "1.1.0" # Make sure that parfile exists file = self.parfile() @@ -68,7 +68,8 @@ class cstsmapmerge(ctools.cscript): def parfile(self): """ Check if parfile exists. If parfile does not exist then create a - default parfile. This kluge avoids shipping the cscript with a parfile. + default parfile. This kluge avoids shipping the cscript with a + parfile. """ # Set parfile name @@ -119,12 +120,16 @@ class cstsmapmerge(ctools.cscript): # Throw exception if input models cannot be decoded else: - msg = "Parameter \"inmmaps\" must contain either an @ASCII file, a comma-separated or space-separated list of files or a wildcard string" - sys.exit(msg) - + msg = "Parameter \"inmmaps\" must contain either an @ASCII file,"+\ + " a comma-separated or whitespace-separated list of files"+\ + " or a wildcard string" + raise gammalib.GException.invalid_argument("cstsmapmerge::get_parameters", msg) + + # Check number of files. We need at least two files. if len(self.files) <= 1: - msg = "Need at least two files to start merging, "+str(len(self.files))+" given" - sys.exit(msg) + msg = "Need at least two files to start merging, "+\ + str(len(self.files))+" files given." + raise gammalib.GException.invalid_argument("cstsmapmerge::get_parameters", msg) # Get output file self.outmap = self["outmap"].filename() @@ -136,22 +141,21 @@ class cstsmapmerge(ctools.cscript): # Return return - def init_map(self, fitsfile): - + """ + """ + # Set filename self.in_filename = fitsfile - # open FITS file - - fits = gammalib.GFits(fitsfile) - self.tsmap = gammalib.GSkyMap() + # Open FITS file + fits = gammalib.GFits(fitsfile) + self.tsmap = gammalib.GSkyMap() self.tsmap.read(fits[0]) - self.statusmap = gammalib.GSkyMap() self.statusmap.read(fits["STATUS MAP"]) # Get other maps - self.maps = [] + self.maps = [] self.mapnames = [] # Loop over extensions @@ -172,15 +176,13 @@ class cstsmapmerge(ctools.cscript): # Return return - # Add map instances to each other - # in this way the TS maps get merged + # Add map instances to each other. In this way the TS maps get merged def add(self, fitsfile): # open FITS file - fits = gammalib.GFits(fitsfile) - add_tsmap = gammalib.GSkyMap() + fits = gammalib.GFits(fitsfile) + add_tsmap = gammalib.GSkyMap() add_tsmap.read(fits[0]) - add_statusmap = gammalib.GSkyMap() add_statusmap.read(fits["STATUS MAP"]) @@ -209,11 +211,13 @@ class cstsmapmerge(ctools.cscript): for i in range(self.tsmap.npix()): if add_statusmap[i] > 0.5: - # throw exception if this bin has already been computed + # Throw exception if this bin has already been computed if self.statusmap[i] > 0.5 and not self.overwrite: - msg = "Attempt to merge bin which apparently has already been merged. File \""+fitsfile+"\" contains already merged bins." - msg += " Set hidden parameter overwrite=yes to avoid this error" - raise gammalib.GException("cstsmapmerge::add", msg) + msg = "Attempt to merge bin which apparently has already"+\ + " been merged. File \""+fitsfile+"\" contains"+\ + " already merged bins. Set hidden parameter"+\ + " overwrite=yes to avoid this error." + raise gammalib.GException.invalid_value("cstsmapmerge::add", msg) # Copy TS values self.tsmap[i] = add_tsmap[i] @@ -250,7 +254,7 @@ class cstsmapmerge(ctools.cscript): self.log("\n") # Initialise file to start with - file0 ="" + file0 = "" self.added_files = [] @@ -317,8 +321,7 @@ class cstsmapmerge(ctools.cscript): # Return return - - + def save(self): """ Save merged tsmap file and remove slices if requested @@ -373,7 +376,6 @@ class cstsmapmerge(ctools.cscript): # Return return - def execute(self): """ Execute the script. diff --git a/doc/source/reference_manual/cscaldb.rst b/doc/source/reference_manual/cscaldb.rst index 536d98c..bfbe18e 100644 --- a/doc/source/reference_manual/cscaldb.rst +++ b/doc/source/reference_manual/cscaldb.rst @@ -1 +1 @@ -.. _cscaldb: cscaldb ======= Dumps all available instrument response functions into log fil. Synopsis -------- This scripts dumps all instrument response functions that are available in the calibration database into the log file. If you want the information on the screen, add the ``debug=yes`` parameter. General parameters ------------------ None 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 counts cube 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"). Related tools ------------- None \ No newline at end of file +.. _cscaldb: cscaldb ======= Dumps all available instrument response functions into log file. Synopsis -------- This scripts dumps all instrument response functions that are available in the calibration database into the log file. If you want the information on the screen, add the ``debug=yes`` parameter. General parameters ------------------ None 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 counts cube 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"). Related tools ------------- None \ No newline at end of file diff --git a/doc/source/reference_manual/csmodelinfo.rst b/doc/source/reference_manual/csmodelinfo.rst index 801cb75..7baa7e9 100644 --- a/doc/source/reference_manual/csmodelinfo.rst +++ b/doc/source/reference_manual/csmodelinfo.rst @@ -1,27 +1,27 @@ .. _csmodelinfo: csmodelinfo -====== +=========== -Dumps information about a model container into log file or on screen +Dumps information about a model container into log file or on screen. Synopsis -------- This script provides detailled information about a given model container. -It presents the number of parameters, the number of free parameters (sub-divided by -spectral, spatial and temporal type). The tool further creates information about any -parameter that is stuck at the parameter boundaries. This might be quite useful for -debugging a fit. -Finally the tool also list the TS values of each source that was fitted, in order -have a quick overview on these quantities on the screen. +It presents the number of parameters, the number of free parameters (sub- +divided by spectral, spatial and temporal type). The tool further creates +information about any parameter that is stuck at the parameter boundaries. +This might be quite useful for debugging a fit. Finally the tool also list +the TS values of each source that was fitted, in order have a quick overview +on these quantities on the screen. -In addition the tool is also capable of exporting the input model XML container to -a region file which is compatible to be read with ds9 or other displying tools. -To create a region file, the hidden parameter "ds9file" needs to be specified. There -are quite a few further hidden parameters to steer e.g. color, font, etc of the region -file output. +In addition the tool is also capable of exporting the input model XML container +to a region file which is compatible to be read with ds9 or other displying +tools. To create a region file, the hidden parameter "ds9file" needs to be +specified. There are quite a few further hidden parameters to steer e.g. +color, font, etc of the region file output. General parameters @@ -91,10 +91,11 @@ Standard parameters ``(mode = ql) [string]`` Mode of automatic parameters (default is "ql", i.e. "query and learn"). -``(logfile = cssens.log) [filename]`` +``(logfile = csmodelinfo.log) [filename]`` Log filename. Related tools or scripts ------------------------ +None \ No newline at end of file diff --git a/doc/source/reference_manual/csmodelmerge.rst b/doc/source/reference_manual/csmodelmerge.rst index eb97285..cb92c09 100644 --- a/doc/source/reference_manual/csmodelmerge.rst +++ b/doc/source/reference_manual/csmodelmerge.rst @@ -1,25 +1,26 @@ .. _csmodelmerge: csmodelmerge -====== +============ -Merges an arbitrary number of model XML files into one file. +Merges an arbitrary number of model XML files into a single file. Synopsis -------- -This script can be used to merge several model XML file into one output file. -The files can be passed via the ``inmodels`` parameter. There are 4 options to specify +This script merges several model XML file into a single model XML file. The +files are passed via the ``inmodels`` parameter. There are 4 options to specify a list of files that should be merged: - a space-separated list of file names (e.g. model1.xml model2.xml) - a comma-separated list of file names (e.g. model1.xml,model2.xml) - a wildcard string (e.g. mymodel*.xml) - an ASCII file containing the file names, one file per line (e.g. @mymodels.txt) -Note that the "@" needs to be specified in case of an ASCII file name. It is also important to -note that models with the same name cannot be appended. The tool will throw and exception if -the provided file contain models with the same name. +Note that the "@" needs to be specified in case of an ASCII file name. It is +also important to note that models with the same name cannot be appended. The +tool will throw and exception if the provided file contain models with the same +name. General parameters @@ -56,10 +57,11 @@ Standard parameters ``(mode = ql) [string]`` Mode of automatic parameters (default is "ql", i.e. "query and learn"). -``(logfile = cssens.log) [filename]`` +``(logfile = csmodelmerge.log) [filename]`` Log filename. Related tools or scripts ------------------------ +None \ No newline at end of file diff --git a/doc/source/reference_manual/csobsinfo.rst b/doc/source/reference_manual/csobsinfo.rst index df9399a..6f47bd3 100644 --- a/doc/source/reference_manual/csobsinfo.rst +++ b/doc/source/reference_manual/csobsinfo.rst @@ -1,31 +1,33 @@ .. _csobsinfo: csobsinfo -====== +========= -Dumps information about an observation container into log file or on screen +Dumps information about an observation container into log file or on +screen. Synopsis -------- -This script provides detailled information about a given observation container. -For IACT observations usually several observations with different -configurations are combined. The script computes e.g. the overall energy -range which could be an important input for :doc:`ctbin` to create a suitable -energy range. In addition the script prints the pointing attributes like the average -zenith/azimuth angle. If the hidden boolean parameter "offset" is specified to "yes", -the script queries for the target position and computes the run-by-run offset as well -as its average. In the observation summary, the time range of the observations including -total ontime and (dead-time corrected) livetime is shown. - -The script further contains the hidden parameter "ds9file". If specified with a file -name, the tool writes out a ds9 region file including a cross for each pointing position -in the sky. - -When executed from within python, the script provides methods to return arrays containing -observation-wise parameters. This might be useful for graphical display within a script. The -following methods are implemented: +This script provides detailed information about a given observation container. +For IACT observations usually several observations with different configurations +are combined. The script computes e.g. the overall energy range which could be +an important input for :doc:`ctbin` to create a suitable energy range. In +addition the script prints the pointing attributes like the average +zenith/azimuth angle. If the hidden boolean parameter "offset" is specified to +"yes", the script queries for the target position and computes the run-by-run +offset as well as its average. In the observation summary, the time range of +the observations including total ontime and (dead-time corrected) livetime is +shown. + +The script further contains the hidden parameter "ds9file". If specified with +a file name, the tool writes out a ds9 region file including a cross for each +pointing position in the sky. + +When executed from within python, the script provides methods to return arrays +containing observation-wise parameters. This might be useful for graphical +display within a script. The following methods are implemented: - zeniths (returning all zenith angles) - azimuths (returning all azimuth angles) - offsets (returning all offset angles, provided the hidden parameter offset=yes) @@ -76,10 +78,11 @@ Standard parameters ``(mode = ql) [string]`` Mode of automatic parameters (default is "ql", i.e. "query and learn"). -``(logfile = cssens.log) [filename]`` +``(logfile = csobsinfo.log) [filename]`` Log filename. Related tools or scripts ------------------------ +None \ No newline at end of file diff --git a/doc/source/reference_manual/cstsmapmerge.rst b/doc/source/reference_manual/cstsmapmerge.rst index b527ac4..46be15d 100644 --- a/doc/source/reference_manual/cstsmapmerge.rst +++ b/doc/source/reference_manual/cstsmapmerge.rst @@ -1,19 +1,20 @@ .. _cstsmapmerge: cstsmapmerge -====== +============ Merges slices of splitted tsmap computations. Synopsis -------- -In case a TS map has been computed using the option to split the calculations into -several jobs, this tool is required to merge the output into one final map again. -Running :doc:`cttsmap` with the hidden parameters ``binmin`` and ``binmax`` specified -will result in several sliced TS maps. This script merges them into one FITS file. -The input slices can be passed via the ``inmaps`` parameter. There are 4 options to specify -a list of files that should be merged: + +In case a TS map has been computed using the option to split the calculations +into several jobs, this tool is required to merge the output into one final +map again. Running :doc:`cttsmap` with the hidden parameters ``binmin`` and +``binmax`` specified will result in several sliced TS maps. This script merges +them into one FITS file. The input slices can be passed via the ``inmaps`` +parameter. There are 4 options to specify a list of files that should be merged: - a space-separated list of file names (e.g. tsmap1.fits tsmap2.fits) - a comma-separated list of file names (e.g. tsmap1.fits,tsmap2.fits) - a wildcard string (e.g. tsmap*.xml) @@ -61,7 +62,7 @@ Standard parameters ``(mode = ql) [string]`` Mode of automatic parameters (default is "ql", i.e. "query and learn"). -``(logfile = cssens.log) [filename]`` +``(logfile = cstsmapmerge.log) [filename]`` Log filename. diff --git a/doc/source/reference_manual/cttsmap.rst b/doc/source/reference_manual/cttsmap.rst index 9789cfc..6c077e8 100644 --- a/doc/source/reference_manual/cttsmap.rst +++ b/doc/source/reference_manual/cttsmap.rst @@ -108,7 +108,8 @@ Standard parameters Name of log file. -Related tools -------------- +Related tools or scripts +------------------------ + +:ref:`cstsmapmerge` -None diff --git a/doc/source/reference_manual/index.rst b/doc/source/reference_manual/index.rst index da7bf27..407b27f 100644 --- a/doc/source/reference_manual/index.rst +++ b/doc/source/reference_manual/index.rst @@ -45,7 +45,7 @@ cscripts csspec --- Computes spectral points csresmap --- Generates residual map cstsdist --- Generates TS distribution - csobsinfo --- Shows detailled information about an observation container - csmodelinfo --- Shows detailled information about a model container - csmodelmerge --- Merges several model containers into one file - cstsmapmerge --- Merges slices from ts map computations + csobsinfo --- Shows observation container content + csmodelinfo --- Shows model container content + csmodelmerge --- Merges several model containers into one file + cstsmapmerge --- Merges slices from ts map computations diff --git a/test/test_cscripts.sh.in b/test/test_cscripts.sh.in index abe5a9b..48691bf 100755 --- a/test/test_cscripts.sh.in +++ b/test/test_cscripts.sh.in @@ -97,7 +97,7 @@ $ECHO " ok" # # Test csmodelinfo -# ============== +# ================ $ECHO -n "Test csmodelinfo: " chmod +x @abs_top_srcdir@/cscripts/csmodelinfo.py @abs_top_srcdir@/cscripts/csmodelinfo.py \ @@ -116,7 +116,7 @@ $ECHO " ok" # # Test csmodelmerge (space-separated) -# ============== +# =================================== $ECHO -n "Test csmodelmerge (space-separated): " chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py @abs_top_srcdir@/cscripts/csmodelmerge.py \ @@ -135,7 +135,7 @@ $ECHO " ok" # # Test csmodelmerge (comma-separated) -# ============== +# =================================== $ECHO -n "Test csmodelmerge (comma-separated): " chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py @abs_top_srcdir@/cscripts/csmodelmerge.py \ @@ -154,7 +154,7 @@ $ECHO " ok" # # Test csmodelmerge (wildcard string) -# ============== +# =================================== $ECHO -n "Test csmodelmerge (wildcard string): " chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py @abs_top_srcdir@/cscripts/csmodelmerge.py \ @@ -173,7 +173,7 @@ $ECHO " ok" # # Test csmodelmerge (ascii-file) -# ============== +# ============================== ls data/model_cube_background* > models.txt $ECHO -n "Test csmodelmerge (ascii-file): " chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py @@ -194,7 +194,7 @@ rm models.txt # # Test cstsmapmerge (comma-separated) -# ============== +# =================================== $ECHO -n "Test cstsmapmerge (comma-separated): " chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py @abs_top_srcdir@/cscripts/cstsmapmerge.py \ @@ -213,7 +213,7 @@ $ECHO " ok" # # Test cstsmapmerge (space-separated) -# ============== +# =================================== $ECHO -n "Test cstsmapmerge (space-separated): " chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py @abs_top_srcdir@/cscripts/cstsmapmerge.py \ @@ -232,7 +232,7 @@ $ECHO " ok" # # Test cstsmapmerge (wildcard string) -# ============== +# =================================== $ECHO -n "Test cstsmapmerge (wildcard string): " chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py @abs_top_srcdir@/cscripts/cstsmapmerge.py \ @@ -251,7 +251,7 @@ $ECHO " ok" # # Test cstsmapmerge (ascii-file) -# ============== +# ============================== ls data/tsmap_*.fits > tsmaps.txt $ECHO -n "Test cstsmapmerge (ascii-file): " chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py -- libgit2 0.21.4