Commit d315b8c8d0b6e9fa9360544ce9514f6c8cd7eb63
1 parent
dfa1decc
Integrate code.
Showing
16 changed files
with
199 additions
and
179 deletions
ChangeLog
| 1 | +2015-11-24 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | ||
| 2 | + | ||
| 3 | + * Version 1.1.0 released | ||
| 4 | + ======================== | ||
| 5 | + | ||
| 6 | + Add csobsinfo, csmodelinfo, csmodelmerge, cstsmapmerge (#1578) | ||
| 7 | + | ||
| 8 | + | ||
| 1 | 2015-11-06 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | 9 | 2015-11-06 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> |
| 2 | 10 | ||
| 3 | * Version 1.0.0 released | 11 | * Version 1.0.0 released |
NEWS
| 1 | -New Features and Important Changes in ctools 1.0.0 | 1 | +New Features and Important Changes in ctools 1.1.0 |
| 2 | 2 | ||
| 3 | Author(s) : Juergen Knoedlseder | 3 | Author(s) : Juergen Knoedlseder |
| 4 | 4 | ||
| 5 | -6 November 2015 | 5 | +24 November 2015 |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 1. Introduction | 8 | 1. Introduction |
| 9 | --------------- | 9 | --------------- |
| 10 | This document briefly summarizes executable by executable the most important | 10 | This document briefly summarizes executable by executable the most important |
| 11 | changes made since the last release of ctools. The code complies to GammaLib | 11 | changes made since the last release of ctools. The code complies to GammaLib |
| 12 | -version 1.0.0 or above. | 12 | +version 1.1.0 or above. |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | 2. Configuration | 15 | 2. Configuration |
| @@ -79,8 +79,7 @@ None | @@ -79,8 +79,7 @@ None | ||
| 79 | 79 | ||
| 80 | 15. ctcubemask - CTA cube filtering | 80 | 15. ctcubemask - CTA cube filtering |
| 81 | ----------------------------------- | 81 | ----------------------------------- |
| 82 | -Allow to ignore the spatial filtering by specifying NONE parameters for "ra", | ||
| 83 | -"dec" or "rad". | 82 | +None |
| 84 | 83 | ||
| 85 | 84 | ||
| 86 | 16. ctbutterfly - Generate butterfly diagrams | 85 | 16. ctbutterfly - Generate butterfly diagrams |
| @@ -100,10 +99,11 @@ None | @@ -100,10 +99,11 @@ None | ||
| 100 | 99 | ||
| 101 | 19. cscripts | 100 | 19. cscripts |
| 102 | ------------ | 101 | ------------ |
| 103 | -The csspec script now handled correctly stacked data. Dependent on the | ||
| 104 | -requested energy binning, it selects for each spectral energy bin the | ||
| 105 | -relevant energy bins from the counts cube and performs a maximum likelihood | ||
| 106 | -analysis. | 102 | +The following scripts have been added: |
| 103 | +- csobsinfo: dump information in observation container | ||
| 104 | +- csmodelinfo: dump information in model container | ||
| 105 | +- csmodelmerge: merge model containers into single container | ||
| 106 | +- cstsmapmerge: merge sliced TS map into single map | ||
| 107 | 107 | ||
| 108 | 108 | ||
| 109 | 20. Examples | 109 | 20. Examples |
README
| 1 | ctools information | 1 | ctools information |
| 2 | ================== | 2 | ================== |
| 3 | -Version: 0.10.0 (31 October 2015) | 3 | +Version: 1.1.0 (24 November 2015) |
| 4 | Author: Juergen Knodlseder (jurgen.knodlseder@irap.omp.eu) | 4 | Author: Juergen Knodlseder (jurgen.knodlseder@irap.omp.eu) |
| 5 | -GammaLib dependency: 0.11.0 | 5 | +GammaLib dependency: 1.1.0 |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | License information | 8 | License information |
cscripts/Makefile.am
| @@ -9,8 +9,8 @@ pythonscripts = __init__.py \ | @@ -9,8 +9,8 @@ pythonscripts = __init__.py \ | ||
| 9 | 9 | ||
| 10 | # Scripts for which symbolic links will be created in bindir | 10 | # Scripts for which symbolic links will be created in bindir |
| 11 | linkscripts = cspull cssens cstsdist cscaldb csresmap \ | 11 | linkscripts = cspull cssens cstsdist cscaldb csresmap \ |
| 12 | - cshessobs csobsdef csspec cslightcrv csobsinfo csmodelmerge \ | ||
| 13 | - csinfo csmodelinfo cstsmapmerge | 12 | + cshessobs csobsdef csspec cslightcrv csobsinfo \ |
| 13 | + csinfo csmodelinfo csmodelmerge cstsmapmerge | ||
| 14 | 14 | ||
| 15 | # Distribute scripts | 15 | # Distribute scripts |
| 16 | EXTRA_DIST = $(binscripts) $(pythonscripts) | 16 | EXTRA_DIST = $(binscripts) $(pythonscripts) |
cscripts/csmodelinfo.py
| @@ -23,15 +23,16 @@ import ctools | @@ -23,15 +23,16 @@ import ctools | ||
| 23 | import sys | 23 | import sys |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | -# =============== # | ||
| 27 | -# cshessobs class # | ||
| 28 | -# =============== # | 26 | +# ================= # |
| 27 | +# csmodelinfo class # | ||
| 28 | +# ================= # | ||
| 29 | class csmodelinfo(ctools.cscript): | 29 | class csmodelinfo(ctools.cscript): |
| 30 | """ | 30 | """ |
| 31 | - This class dumps information about a model container into a logfile or on screen. | ||
| 32 | - This might be helpful for quick access to the model container, e.g. number of sources, | ||
| 33 | - background models, free and fixed parameters etc. | ||
| 34 | - The tool can also dump the models into a region file to display e.g. with ds9. | 31 | + This class dumps information about a model container into a logfile or |
| 32 | + on screen. This might be helpful for quick access to the model container, | ||
| 33 | + showing, e.g., number of sources, background models, free and fixed | ||
| 34 | + parameters etc. The tool can also dump the models into a region file to | ||
| 35 | + display e.g. with ds9. | ||
| 35 | """ | 36 | """ |
| 36 | def __init__(self, *argv): | 37 | def __init__(self, *argv): |
| 37 | """ | 38 | """ |
| @@ -39,7 +40,7 @@ class csmodelinfo(ctools.cscript): | @@ -39,7 +40,7 @@ class csmodelinfo(ctools.cscript): | ||
| 39 | """ | 40 | """ |
| 40 | # Set name | 41 | # Set name |
| 41 | self.name = "csmodelinfo" | 42 | self.name = "csmodelinfo" |
| 42 | - self.version = "0.1.0" | 43 | + self.version = "1.1.0" |
| 43 | 44 | ||
| 44 | # Make sure that parfile exists | 45 | # Make sure that parfile exists |
| 45 | file = self.parfile() | 46 | file = self.parfile() |
| @@ -69,7 +70,8 @@ class csmodelinfo(ctools.cscript): | @@ -69,7 +70,8 @@ class csmodelinfo(ctools.cscript): | ||
| 69 | def parfile(self): | 70 | def parfile(self): |
| 70 | """ | 71 | """ |
| 71 | Check if parfile exists. If parfile does not exist then create a | 72 | Check if parfile exists. If parfile does not exist then create a |
| 72 | - default parfile. This kluge avoids shipping the cscript with a parfile. | 73 | + default parfile. This kluge avoids shipping the cscript with a |
| 74 | + parfile. | ||
| 73 | """ | 75 | """ |
| 74 | 76 | ||
| 75 | # Set parfile name | 77 | # Set parfile name |
| @@ -108,10 +110,10 @@ class csmodelinfo(ctools.cscript): | @@ -108,10 +110,10 @@ class csmodelinfo(ctools.cscript): | ||
| 108 | Get parameters from parfile and setup the observation. | 110 | Get parameters from parfile and setup the observation. |
| 109 | """ | 111 | """ |
| 110 | # Get models | 112 | # Get models |
| 111 | - self.models = gammalib.GModels(self["inmodel"].filename()) | 113 | + self.models = gammalib.GModels(self["inmodel"].filename()) |
| 112 | 114 | ||
| 113 | - # Get ds9 file | ||
| 114 | - self.ds9file = self["ds9file"].filename() | 115 | + # Get ds9 filename |
| 116 | + self.ds9file = self["ds9file"].filename() | ||
| 115 | 117 | ||
| 116 | # Get hidden parameters for region file | 118 | # Get hidden parameters for region file |
| 117 | self.pnt_type = self["pnt_type"].string() | 119 | self.pnt_type = self["pnt_type"].string() |
| @@ -128,7 +130,6 @@ class csmodelinfo(ctools.cscript): | @@ -128,7 +130,6 @@ class csmodelinfo(ctools.cscript): | ||
| 128 | 130 | ||
| 129 | # Return | 131 | # Return |
| 130 | return | 132 | return |
| 131 | - | ||
| 132 | 133 | ||
| 133 | def run(self): | 134 | def run(self): |
| 134 | """ | 135 | """ |
| @@ -321,7 +322,7 @@ class csmodelinfo(ctools.cscript): | @@ -321,7 +322,7 @@ class csmodelinfo(ctools.cscript): | ||
| 321 | 322 | ||
| 322 | def save(self): | 323 | def save(self): |
| 323 | """ | 324 | """ |
| 324 | - Save pointings to ds9 region file if required | 325 | + Save models to ds9 region file if required |
| 325 | """ | 326 | """ |
| 326 | 327 | ||
| 327 | # Check if ds9 file is valid | 328 | # Check if ds9 file is valid |
| @@ -479,7 +480,6 @@ class csmodelinfo(ctools.cscript): | @@ -479,7 +480,6 @@ class csmodelinfo(ctools.cscript): | ||
| 479 | # Return string | 480 | # Return string |
| 480 | return ds9string | 481 | return ds9string |
| 481 | 482 | ||
| 482 | - | ||
| 483 | def execute(self): | 483 | def execute(self): |
| 484 | """ | 484 | """ |
| 485 | Execute the script. | 485 | Execute the script. |
cscripts/csmodelmerge.py
| @@ -24,12 +24,13 @@ import sys | @@ -24,12 +24,13 @@ import sys | ||
| 24 | import glob | 24 | import glob |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | -# =============== # | ||
| 28 | -# cshessobs class # | ||
| 29 | -# =============== # | 27 | +# ================== # |
| 28 | +# csmodelmerge class # | ||
| 29 | +# ================== # | ||
| 30 | class csmodelmerge(ctools.cscript): | 30 | class csmodelmerge(ctools.cscript): |
| 31 | """ | 31 | """ |
| 32 | - This class merges an arbitray number of model container into one output model XML file | 32 | + This class merges an arbitray number of model container into one output |
| 33 | + model XML file. | ||
| 33 | """ | 34 | """ |
| 34 | def __init__(self, *argv): | 35 | def __init__(self, *argv): |
| 35 | """ | 36 | """ |
| @@ -37,7 +38,7 @@ class csmodelmerge(ctools.cscript): | @@ -37,7 +38,7 @@ class csmodelmerge(ctools.cscript): | ||
| 37 | """ | 38 | """ |
| 38 | # Set name | 39 | # Set name |
| 39 | self.name = "csmodelmerge" | 40 | self.name = "csmodelmerge" |
| 40 | - self.version = "0.1.0" | 41 | + self.version = "1.1.0" |
| 41 | 42 | ||
| 42 | # Make sure that parfile exists | 43 | # Make sure that parfile exists |
| 43 | file = self.parfile() | 44 | file = self.parfile() |
| @@ -67,7 +68,8 @@ class csmodelmerge(ctools.cscript): | @@ -67,7 +68,8 @@ class csmodelmerge(ctools.cscript): | ||
| 67 | def parfile(self): | 68 | def parfile(self): |
| 68 | """ | 69 | """ |
| 69 | Check if parfile exists. If parfile does not exist then create a | 70 | Check if parfile exists. If parfile does not exist then create a |
| 70 | - default parfile. This kluge avoids shipping the cscript with a parfile. | 71 | + default parfile. This kluge avoids shipping the cscript with a |
| 72 | + parfile. | ||
| 71 | """ | 73 | """ |
| 72 | 74 | ||
| 73 | # Set parfile name | 75 | # Set parfile name |
| @@ -116,7 +118,9 @@ class csmodelmerge(ctools.cscript): | @@ -116,7 +118,9 @@ class csmodelmerge(ctools.cscript): | ||
| 116 | 118 | ||
| 117 | # Throw exception if input models cannot be decoded | 119 | # Throw exception if input models cannot be decoded |
| 118 | else: | 120 | else: |
| 119 | - msg = "Parameter \"inmodels\" must contain either an @ASCII file, a comma-separated or space-separated list of files or a wildcard string" | 121 | + msg = "Parameter \"inmodels\" must contain either an @ASCII"+\ |
| 122 | + " file, a comma-separated or whitespace-separated list"+\ | ||
| 123 | + " of files or a wildcard string" | ||
| 120 | raise gammalib.GException.invalid_argument("csmodelmerge::get_parameters", msg) | 124 | raise gammalib.GException.invalid_argument("csmodelmerge::get_parameters", msg) |
| 121 | 125 | ||
| 122 | # Get output file | 126 | # Get output file |
| @@ -125,7 +129,6 @@ class csmodelmerge(ctools.cscript): | @@ -125,7 +129,6 @@ class csmodelmerge(ctools.cscript): | ||
| 125 | # Return | 129 | # Return |
| 126 | return | 130 | return |
| 127 | 131 | ||
| 128 | - | ||
| 129 | def run(self): | 132 | def run(self): |
| 130 | """ | 133 | """ |
| 131 | Run the script. | 134 | Run the script. |
| @@ -141,13 +144,13 @@ class csmodelmerge(ctools.cscript): | @@ -141,13 +144,13 @@ class csmodelmerge(ctools.cscript): | ||
| 141 | if self.logTerse(): | 144 | if self.logTerse(): |
| 142 | self.log_parameters() | 145 | self.log_parameters() |
| 143 | self.log("\n") | 146 | self.log("\n") |
| 144 | - | 147 | + |
| 148 | + # Dump header | ||
| 145 | if self.logTerse(): | 149 | if self.logTerse(): |
| 146 | self.log("\n") | 150 | self.log("\n") |
| 147 | self.log.header1("Merging Models") | 151 | self.log.header1("Merging Models") |
| 148 | self.log("\n") | 152 | self.log("\n") |
| 149 | - | ||
| 150 | - | 153 | + |
| 151 | # Initialise output model container | 154 | # Initialise output model container |
| 152 | self.models = gammalib.GModels() | 155 | self.models = gammalib.GModels() |
| 153 | 156 | ||
| @@ -172,7 +175,6 @@ class csmodelmerge(ctools.cscript): | @@ -172,7 +175,6 @@ class csmodelmerge(ctools.cscript): | ||
| 172 | """ | 175 | """ |
| 173 | Save pointings to ds9 region file if required | 176 | Save pointings to ds9 region file if required |
| 174 | """ | 177 | """ |
| 175 | - | ||
| 176 | # Logging | 178 | # Logging |
| 177 | if self.logExplicit(): | 179 | if self.logExplicit(): |
| 178 | self.log("\n") | 180 | self.log("\n") |
| @@ -185,7 +187,6 @@ class csmodelmerge(ctools.cscript): | @@ -185,7 +187,6 @@ class csmodelmerge(ctools.cscript): | ||
| 185 | # Return | 187 | # Return |
| 186 | return | 188 | return |
| 187 | 189 | ||
| 188 | - | ||
| 189 | def execute(self): | 190 | def execute(self): |
| 190 | """ | 191 | """ |
| 191 | Execute the script. | 192 | Execute the script. |
cscripts/csobsinfo.py
| @@ -24,13 +24,13 @@ import sys | @@ -24,13 +24,13 @@ import sys | ||
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | # =============== # | 26 | # =============== # |
| 27 | -# cshessobs class # | 27 | +# csobsinfo class # |
| 28 | # =============== # | 28 | # =============== # |
| 29 | class csobsinfo(ctools.cscript): | 29 | class csobsinfo(ctools.cscript): |
| 30 | """ | 30 | """ |
| 31 | - This class dumps information about an observation container into a logfile or on screen. | ||
| 32 | - This might be helpful for quick access to an observation container, e.g. total lifetime, | ||
| 33 | - energy range etc. | 31 | + This class dumps information about an observation container into a |
| 32 | + logfile or on screen. This might be helpful for quick access to an | ||
| 33 | + observation container showing, e.g., total lifetime, energy range etc. | ||
| 34 | """ | 34 | """ |
| 35 | def __init__(self, *argv): | 35 | def __init__(self, *argv): |
| 36 | """ | 36 | """ |
| @@ -38,7 +38,7 @@ class csobsinfo(ctools.cscript): | @@ -38,7 +38,7 @@ class csobsinfo(ctools.cscript): | ||
| 38 | """ | 38 | """ |
| 39 | # Set name | 39 | # Set name |
| 40 | self.name = "csobsinfo" | 40 | self.name = "csobsinfo" |
| 41 | - self.version = "0.1.0" | 41 | + self.version = "1.1.0" |
| 42 | 42 | ||
| 43 | # Make sure that parfile exists | 43 | # Make sure that parfile exists |
| 44 | file = self.parfile() | 44 | file = self.parfile() |
| @@ -68,7 +68,8 @@ class csobsinfo(ctools.cscript): | @@ -68,7 +68,8 @@ class csobsinfo(ctools.cscript): | ||
| 68 | def parfile(self): | 68 | def parfile(self): |
| 69 | """ | 69 | """ |
| 70 | Check if parfile exists. If parfile does not exist then create a | 70 | Check if parfile exists. If parfile does not exist then create a |
| 71 | - default parfile. This kluge avoids shipping the cscript with a parfile. | 71 | + default parfile. This kluge avoids shipping the cscript with a |
| 72 | + parfile. | ||
| 72 | """ | 73 | """ |
| 73 | 74 | ||
| 74 | # Set parfile name | 75 | # Set parfile name |
| @@ -104,18 +105,19 @@ class csobsinfo(ctools.cscript): | @@ -104,18 +105,19 @@ class csobsinfo(ctools.cscript): | ||
| 104 | 105 | ||
| 105 | # Initialise object position | 106 | # Initialise object position |
| 106 | self.obj_dir = gammalib.GSkyDir() | 107 | self.obj_dir = gammalib.GSkyDir() |
| 107 | - | 108 | + |
| 109 | + # Get (optional) offset parameters | ||
| 108 | self.m_offset = self["offset"].boolean() | 110 | self.m_offset = self["offset"].boolean() |
| 109 | if self.m_offset: | 111 | if self.m_offset: |
| 110 | - ra = self["ra"].real() | 112 | + ra = self["ra"].real() |
| 111 | dec = self["dec"].real() | 113 | dec = self["dec"].real() |
| 112 | self.obj_dir.radec_deg(ra,dec) | 114 | self.obj_dir.radec_deg(ra,dec) |
| 113 | - | 115 | + |
| 116 | + # Get (optional) DS9 filename | ||
| 114 | self.ds9file = self["ds9file"].filename() | 117 | self.ds9file = self["ds9file"].filename() |
| 115 | 118 | ||
| 116 | # Return | 119 | # Return |
| 117 | return | 120 | return |
| 118 | - | ||
| 119 | 121 | ||
| 120 | def run(self): | 122 | def run(self): |
| 121 | """ | 123 | """ |
| @@ -135,21 +137,21 @@ class csobsinfo(ctools.cscript): | @@ -135,21 +137,21 @@ class csobsinfo(ctools.cscript): | ||
| 135 | 137 | ||
| 136 | # Initialise arrays to store certain values for reuse | 138 | # Initialise arrays to store certain values for reuse |
| 137 | # Todo, think about using a python dictionary | 139 | # Todo, think about using a python dictionary |
| 138 | - self.offsets = [] | ||
| 139 | - self.zeniths = [] | 140 | + self.offsets = [] |
| 141 | + self.zeniths = [] | ||
| 140 | self.azimuths = [] | 142 | self.azimuths = [] |
| 141 | - self.pnt_ra = [] | ||
| 142 | - self.pnt_dec = [] | ||
| 143 | - obs_names = [] | 143 | + self.pnt_ra = [] |
| 144 | + self.pnt_dec = [] | ||
| 145 | + obs_names = [] | ||
| 144 | 146 | ||
| 145 | # Initialise output to be filled | 147 | # Initialise output to be filled |
| 146 | - self.ebounds = gammalib.GEbounds() | ||
| 147 | - self.gti = gammalib.GGti() | ||
| 148 | - ontime = 0.0 | ||
| 149 | - livetime = 0.0 | ||
| 150 | - n_events = 0 | ||
| 151 | - n_eventbins = 0 | ||
| 152 | - n_obs_binned = 0 | 148 | + self.ebounds = gammalib.GEbounds() |
| 149 | + self.gti = gammalib.GGti() | ||
| 150 | + ontime = 0.0 | ||
| 151 | + livetime = 0.0 | ||
| 152 | + n_events = 0 | ||
| 153 | + n_eventbins = 0 | ||
| 154 | + n_obs_binned = 0 | ||
| 153 | n_obs_unbinned = 0 | 155 | n_obs_unbinned = 0 |
| 154 | 156 | ||
| 155 | # Logging | 157 | # Logging |
| @@ -183,9 +185,9 @@ class csobsinfo(ctools.cscript): | @@ -183,9 +185,9 @@ class csobsinfo(ctools.cscript): | ||
| 183 | # Retrieve time interval | 185 | # Retrieve time interval |
| 184 | obs_gti = obs.events().gti() | 186 | obs_gti = obs.events().gti() |
| 185 | 187 | ||
| 186 | - # Compute mean time and dead tim fraction in percent | ||
| 187 | - tmean = (obs_gti.tstart() + obs_gti.tstop()) | ||
| 188 | - tmean*=0.5 | 188 | + # Compute mean time and dead time fraction in percent |
| 189 | + tmean = (obs_gti.tstart() + obs_gti.tstop()) | ||
| 190 | + tmean *= 0.5 | ||
| 189 | deadfrac = (1.0-obs.deadc(tmean))*100.0 | 191 | deadfrac = (1.0-obs.deadc(tmean))*100.0 |
| 190 | 192 | ||
| 191 | # Retrieve pointing and store Ra,Dec | 193 | # Retrieve pointing and store Ra,Dec |
| @@ -209,7 +211,7 @@ class csobsinfo(ctools.cscript): | @@ -209,7 +211,7 @@ class csobsinfo(ctools.cscript): | ||
| 209 | self.log.parformat("binned") | 211 | self.log.parformat("binned") |
| 210 | 212 | ||
| 211 | if obs.eventtype() == "CountsCube": | 213 | if obs.eventtype() == "CountsCube": |
| 212 | - n_eventbins += obs.events().size() | 214 | + n_eventbins += obs.events().size() |
| 213 | n_obs_binned += 1 | 215 | n_obs_binned += 1 |
| 214 | if self.logTerse(): | 216 | if self.logTerse(): |
| 215 | self.log("yes") | 217 | self.log("yes") |
| @@ -218,7 +220,7 @@ class csobsinfo(ctools.cscript): | @@ -218,7 +220,7 @@ class csobsinfo(ctools.cscript): | ||
| 218 | self.log(str(obs.events().size())) | 220 | self.log(str(obs.events().size())) |
| 219 | self.log("\n") | 221 | self.log("\n") |
| 220 | else: | 222 | else: |
| 221 | - n_events += obs.events().size() | 223 | + n_events += obs.events().size() |
| 222 | n_obs_unbinned += 1 | 224 | n_obs_unbinned += 1 |
| 223 | if self.logTerse(): | 225 | if self.logTerse(): |
| 224 | self.log("no") | 226 | self.log("no") |
| @@ -239,7 +241,7 @@ class csobsinfo(ctools.cscript): | @@ -239,7 +241,7 @@ class csobsinfo(ctools.cscript): | ||
| 239 | self.log("\n") | 241 | self.log("\n") |
| 240 | 242 | ||
| 241 | # Log observation time interval | 243 | # Log observation time interval |
| 242 | - self.log.parformat("Time range [MJD]") | 244 | + self.log.parformat("Time range (MJD)") |
| 243 | if obs_gti.size() == 0: | 245 | if obs_gti.size() == 0: |
| 244 | self.log("undefined") | 246 | self.log("undefined") |
| 245 | else: | 247 | else: |
| @@ -257,8 +259,8 @@ class csobsinfo(ctools.cscript): | @@ -257,8 +259,8 @@ class csobsinfo(ctools.cscript): | ||
| 257 | self.log("\n") | 259 | self.log("\n") |
| 258 | 260 | ||
| 259 | # Log dead time fraction | 261 | # Log dead time fraction |
| 260 | - self.log.parformat("Dead-time fraction [%]") | ||
| 261 | - self.log("%.3f"%deadfrac) | 262 | + self.log.parformat("Dead-time fraction (%)") |
| 263 | + self.log("%.3f" % (deadfrac)) | ||
| 262 | self.log("\n") | 264 | self.log("\n") |
| 263 | 265 | ||
| 264 | # Log pointing direction | 266 | # Log pointing direction |
| @@ -271,7 +273,7 @@ class csobsinfo(ctools.cscript): | @@ -271,7 +273,7 @@ class csobsinfo(ctools.cscript): | ||
| 271 | offset = pnt_dir.dist_deg(self.obj_dir) | 273 | offset = pnt_dir.dist_deg(self.obj_dir) |
| 272 | self.offsets.append(offset) | 274 | self.offsets.append(offset) |
| 273 | self.log.parformat("Offset") | 275 | self.log.parformat("Offset") |
| 274 | - self.log("%.2f"%(offset)) | 276 | + self.log("%.2f" % (offset)) |
| 275 | self.log("\n") | 277 | self.log("\n") |
| 276 | else: | 278 | else: |
| 277 | self.offsets.append(-1.0) | 279 | self.offsets.append(-1.0) |
| @@ -285,10 +287,10 @@ class csobsinfo(ctools.cscript): | @@ -285,10 +287,10 @@ class csobsinfo(ctools.cscript): | ||
| 285 | # Log Zenith and Azimuth if required | 287 | # Log Zenith and Azimuth if required |
| 286 | if self.logExplicit(): | 288 | if self.logExplicit(): |
| 287 | self.log.parformat("Zenith angle") | 289 | self.log.parformat("Zenith angle") |
| 288 | - self.log("%.2f"%(zenith)) | 290 | + self.log("%.2f" % (zenith)) |
| 289 | self.log("\n") | 291 | self.log("\n") |
| 290 | self.log.parformat("Azimuth angle") | 292 | self.log.parformat("Azimuth angle") |
| 291 | - self.log("%.2f"%(azimuth)) | 293 | + self.log("%.2f" % (azimuth)) |
| 292 | self.log("\n\n") | 294 | self.log("\n\n") |
| 293 | 295 | ||
| 294 | # Log summary | 296 | # Log summary |
| @@ -315,15 +317,15 @@ class csobsinfo(ctools.cscript): | @@ -315,15 +317,15 @@ class csobsinfo(ctools.cscript): | ||
| 315 | # Log mean offset if possible | 317 | # Log mean offset if possible |
| 316 | if self.m_offset: | 318 | if self.m_offset: |
| 317 | self.log.parformat("Mean offset angle") | 319 | self.log.parformat("Mean offset angle") |
| 318 | - self.log("%.2f"%(sum(self.offsets)/len(self.offsets))) | 320 | + self.log("%.2f" % (sum(self.offsets)/len(self.offsets))) |
| 319 | self.log("\n") | 321 | self.log("\n") |
| 320 | 322 | ||
| 321 | # Log mean azimuth and zenith angle | 323 | # Log mean azimuth and zenith angle |
| 322 | self.log.parformat("Mean zenith angle") | 324 | self.log.parformat("Mean zenith angle") |
| 323 | - self.log("%.2f"%(sum(self.zeniths)/len(self.zeniths))) | 325 | + self.log("%.2f" % (sum(self.zeniths)/len(self.zeniths))) |
| 324 | self.log("\n") | 326 | self.log("\n") |
| 325 | self.log.parformat("Mean azimuth angle") | 327 | self.log.parformat("Mean azimuth angle") |
| 326 | - self.log("%.2f"%(sum(self.azimuths)/len(self.azimuths))) | 328 | + self.log("%.2f" % (sum(self.azimuths)/len(self.azimuths))) |
| 327 | self.log("\n") | 329 | self.log("\n") |
| 328 | 330 | ||
| 329 | # Log name of observations if requested | 331 | # Log name of observations if requested |
| @@ -361,10 +363,10 @@ class csobsinfo(ctools.cscript): | @@ -361,10 +363,10 @@ class csobsinfo(ctools.cscript): | ||
| 361 | 363 | ||
| 362 | # Log ontime and livetime in different units | 364 | # Log ontime and livetime in different units |
| 363 | self.log.parformat("Total ontime") | 365 | self.log.parformat("Total ontime") |
| 364 | - self.log("%.2f s = %.2f min = %.2f h"%(ontime, ontime/60., ontime/3600.)) | 366 | + self.log("%.2f s = %.2f min = %.2f h" % (ontime, ontime/60., ontime/3600.)) |
| 365 | self.log("\n") | 367 | self.log("\n") |
| 366 | self.log.parformat("Total livetime") | 368 | self.log.parformat("Total livetime") |
| 367 | - self.log("%.2f s = %.2f min = %.2f h"%(livetime, livetime/60.0, livetime/3600.)) | 369 | + self.log("%.2f s = %.2f min = %.2f h" % (livetime, livetime/60.0, livetime/3600.)) |
| 368 | self.log("\n") | 370 | self.log("\n") |
| 369 | 371 | ||
| 370 | # Return | 372 | # Return |
| @@ -385,7 +387,6 @@ class csobsinfo(ctools.cscript): | @@ -385,7 +387,6 @@ class csobsinfo(ctools.cscript): | ||
| 385 | f.write("fk5\n") | 387 | f.write("fk5\n") |
| 386 | 388 | ||
| 387 | # Loop over pointings | 389 | # Loop over pointings |
| 388 | - | ||
| 389 | for i in range(len(self.pnt_ra)): | 390 | for i in range(len(self.pnt_ra)): |
| 390 | 391 | ||
| 391 | # Create string | 392 | # Create string |
cscripts/cstsmapmerge.py
| @@ -25,12 +25,12 @@ import glob | @@ -25,12 +25,12 @@ import glob | ||
| 25 | import os | 25 | import os |
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | -# =============== # | ||
| 29 | -# cshessobs class # | ||
| 30 | -# =============== # | 28 | +# ================== # |
| 29 | +# cstsmapmerge class # | ||
| 30 | +# ================== # | ||
| 31 | class cstsmapmerge(ctools.cscript): | 31 | class cstsmapmerge(ctools.cscript): |
| 32 | """ | 32 | """ |
| 33 | - This class merges an arbitray number of model container into one output model XML file | 33 | + This class merges TS map files into one TS map |
| 34 | """ | 34 | """ |
| 35 | def __init__(self, *argv): | 35 | def __init__(self, *argv): |
| 36 | """ | 36 | """ |
| @@ -38,7 +38,7 @@ class cstsmapmerge(ctools.cscript): | @@ -38,7 +38,7 @@ class cstsmapmerge(ctools.cscript): | ||
| 38 | """ | 38 | """ |
| 39 | # Set name | 39 | # Set name |
| 40 | self.name = "cstsmapmerge" | 40 | self.name = "cstsmapmerge" |
| 41 | - self.version = "0.1.0" | 41 | + self.version = "1.1.0" |
| 42 | 42 | ||
| 43 | # Make sure that parfile exists | 43 | # Make sure that parfile exists |
| 44 | file = self.parfile() | 44 | file = self.parfile() |
| @@ -68,7 +68,8 @@ class cstsmapmerge(ctools.cscript): | @@ -68,7 +68,8 @@ class cstsmapmerge(ctools.cscript): | ||
| 68 | def parfile(self): | 68 | def parfile(self): |
| 69 | """ | 69 | """ |
| 70 | Check if parfile exists. If parfile does not exist then create a | 70 | Check if parfile exists. If parfile does not exist then create a |
| 71 | - default parfile. This kluge avoids shipping the cscript with a parfile. | 71 | + default parfile. This kluge avoids shipping the cscript with a |
| 72 | + parfile. | ||
| 72 | """ | 73 | """ |
| 73 | 74 | ||
| 74 | # Set parfile name | 75 | # Set parfile name |
| @@ -119,12 +120,16 @@ class cstsmapmerge(ctools.cscript): | @@ -119,12 +120,16 @@ class cstsmapmerge(ctools.cscript): | ||
| 119 | 120 | ||
| 120 | # Throw exception if input models cannot be decoded | 121 | # Throw exception if input models cannot be decoded |
| 121 | else: | 122 | else: |
| 122 | - msg = "Parameter \"inmmaps\" must contain either an @ASCII file, a comma-separated or space-separated list of files or a wildcard string" | ||
| 123 | - sys.exit(msg) | ||
| 124 | - | 123 | + msg = "Parameter \"inmmaps\" must contain either an @ASCII file,"+\ |
| 124 | + " a comma-separated or whitespace-separated list of files"+\ | ||
| 125 | + " or a wildcard string" | ||
| 126 | + raise gammalib.GException.invalid_argument("cstsmapmerge::get_parameters", msg) | ||
| 127 | + | ||
| 128 | + # Check number of files. We need at least two files. | ||
| 125 | if len(self.files) <= 1: | 129 | if len(self.files) <= 1: |
| 126 | - msg = "Need at least two files to start merging, "+str(len(self.files))+" given" | ||
| 127 | - sys.exit(msg) | 130 | + msg = "Need at least two files to start merging, "+\ |
| 131 | + str(len(self.files))+" files given." | ||
| 132 | + raise gammalib.GException.invalid_argument("cstsmapmerge::get_parameters", msg) | ||
| 128 | 133 | ||
| 129 | # Get output file | 134 | # Get output file |
| 130 | self.outmap = self["outmap"].filename() | 135 | self.outmap = self["outmap"].filename() |
| @@ -136,22 +141,21 @@ class cstsmapmerge(ctools.cscript): | @@ -136,22 +141,21 @@ class cstsmapmerge(ctools.cscript): | ||
| 136 | # Return | 141 | # Return |
| 137 | return | 142 | return |
| 138 | 143 | ||
| 139 | - | ||
| 140 | def init_map(self, fitsfile): | 144 | def init_map(self, fitsfile): |
| 141 | - | 145 | + """ |
| 146 | + """ | ||
| 147 | + # Set filename | ||
| 142 | self.in_filename = fitsfile | 148 | self.in_filename = fitsfile |
| 143 | 149 | ||
| 144 | - # open FITS file | ||
| 145 | - | ||
| 146 | - fits = gammalib.GFits(fitsfile) | ||
| 147 | - self.tsmap = gammalib.GSkyMap() | 150 | + # Open FITS file |
| 151 | + fits = gammalib.GFits(fitsfile) | ||
| 152 | + self.tsmap = gammalib.GSkyMap() | ||
| 148 | self.tsmap.read(fits[0]) | 153 | self.tsmap.read(fits[0]) |
| 149 | - | ||
| 150 | self.statusmap = gammalib.GSkyMap() | 154 | self.statusmap = gammalib.GSkyMap() |
| 151 | self.statusmap.read(fits["STATUS MAP"]) | 155 | self.statusmap.read(fits["STATUS MAP"]) |
| 152 | 156 | ||
| 153 | # Get other maps | 157 | # Get other maps |
| 154 | - self.maps = [] | 158 | + self.maps = [] |
| 155 | self.mapnames = [] | 159 | self.mapnames = [] |
| 156 | 160 | ||
| 157 | # Loop over extensions | 161 | # Loop over extensions |
| @@ -172,15 +176,13 @@ class cstsmapmerge(ctools.cscript): | @@ -172,15 +176,13 @@ class cstsmapmerge(ctools.cscript): | ||
| 172 | # Return | 176 | # Return |
| 173 | return | 177 | return |
| 174 | 178 | ||
| 175 | - # Add map instances to each other | ||
| 176 | - # in this way the TS maps get merged | 179 | + # Add map instances to each other. In this way the TS maps get merged |
| 177 | def add(self, fitsfile): | 180 | def add(self, fitsfile): |
| 178 | 181 | ||
| 179 | # open FITS file | 182 | # open FITS file |
| 180 | - fits = gammalib.GFits(fitsfile) | ||
| 181 | - add_tsmap = gammalib.GSkyMap() | 183 | + fits = gammalib.GFits(fitsfile) |
| 184 | + add_tsmap = gammalib.GSkyMap() | ||
| 182 | add_tsmap.read(fits[0]) | 185 | add_tsmap.read(fits[0]) |
| 183 | - | ||
| 184 | add_statusmap = gammalib.GSkyMap() | 186 | add_statusmap = gammalib.GSkyMap() |
| 185 | add_statusmap.read(fits["STATUS MAP"]) | 187 | add_statusmap.read(fits["STATUS MAP"]) |
| 186 | 188 | ||
| @@ -209,11 +211,13 @@ class cstsmapmerge(ctools.cscript): | @@ -209,11 +211,13 @@ class cstsmapmerge(ctools.cscript): | ||
| 209 | for i in range(self.tsmap.npix()): | 211 | for i in range(self.tsmap.npix()): |
| 210 | if add_statusmap[i] > 0.5: | 212 | if add_statusmap[i] > 0.5: |
| 211 | 213 | ||
| 212 | - # throw exception if this bin has already been computed | 214 | + # Throw exception if this bin has already been computed |
| 213 | if self.statusmap[i] > 0.5 and not self.overwrite: | 215 | if self.statusmap[i] > 0.5 and not self.overwrite: |
| 214 | - msg = "Attempt to merge bin which apparently has already been merged. File \""+fitsfile+"\" contains already merged bins." | ||
| 215 | - msg += " Set hidden parameter overwrite=yes to avoid this error" | ||
| 216 | - raise gammalib.GException("cstsmapmerge::add", msg) | 216 | + msg = "Attempt to merge bin which apparently has already"+\ |
| 217 | + " been merged. File \""+fitsfile+"\" contains"+\ | ||
| 218 | + " already merged bins. Set hidden parameter"+\ | ||
| 219 | + " overwrite=yes to avoid this error." | ||
| 220 | + raise gammalib.GException.invalid_value("cstsmapmerge::add", msg) | ||
| 217 | 221 | ||
| 218 | # Copy TS values | 222 | # Copy TS values |
| 219 | self.tsmap[i] = add_tsmap[i] | 223 | self.tsmap[i] = add_tsmap[i] |
| @@ -250,7 +254,7 @@ class cstsmapmerge(ctools.cscript): | @@ -250,7 +254,7 @@ class cstsmapmerge(ctools.cscript): | ||
| 250 | self.log("\n") | 254 | self.log("\n") |
| 251 | 255 | ||
| 252 | # Initialise file to start with | 256 | # Initialise file to start with |
| 253 | - file0 ="" | 257 | + file0 = "" |
| 254 | 258 | ||
| 255 | self.added_files = [] | 259 | self.added_files = [] |
| 256 | 260 | ||
| @@ -317,8 +321,7 @@ class cstsmapmerge(ctools.cscript): | @@ -317,8 +321,7 @@ class cstsmapmerge(ctools.cscript): | ||
| 317 | 321 | ||
| 318 | # Return | 322 | # Return |
| 319 | return | 323 | return |
| 320 | - | ||
| 321 | - | 324 | + |
| 322 | def save(self): | 325 | def save(self): |
| 323 | """ | 326 | """ |
| 324 | Save merged tsmap file and remove slices if requested | 327 | Save merged tsmap file and remove slices if requested |
| @@ -373,7 +376,6 @@ class cstsmapmerge(ctools.cscript): | @@ -373,7 +376,6 @@ class cstsmapmerge(ctools.cscript): | ||
| 373 | # Return | 376 | # Return |
| 374 | return | 377 | return |
| 375 | 378 | ||
| 376 | - | ||
| 377 | def execute(self): | 379 | def execute(self): |
| 378 | """ | 380 | """ |
| 379 | Execute the script. | 381 | Execute the script. |
doc/source/reference_manual/cscaldb.rst
| 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 | ||
| 2 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +.. _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 | ||
| 3 | \ No newline at end of file | 3 | \ No newline at end of file |
doc/source/reference_manual/csmodelinfo.rst
| 1 | .. _csmodelinfo: | 1 | .. _csmodelinfo: |
| 2 | 2 | ||
| 3 | csmodelinfo | 3 | csmodelinfo |
| 4 | -====== | 4 | +=========== |
| 5 | 5 | ||
| 6 | -Dumps information about a model container into log file or on screen | 6 | +Dumps information about a model container into log file or on screen. |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | Synopsis | 9 | Synopsis |
| 10 | -------- | 10 | -------- |
| 11 | 11 | ||
| 12 | This script provides detailled information about a given model container. | 12 | This script provides detailled information about a given model container. |
| 13 | -It presents the number of parameters, the number of free parameters (sub-divided by | ||
| 14 | -spectral, spatial and temporal type). The tool further creates information about any | ||
| 15 | -parameter that is stuck at the parameter boundaries. This might be quite useful for | ||
| 16 | -debugging a fit. | ||
| 17 | -Finally the tool also list the TS values of each source that was fitted, in order | ||
| 18 | -have a quick overview on these quantities on the screen. | 13 | +It presents the number of parameters, the number of free parameters (sub- |
| 14 | +divided by spectral, spatial and temporal type). The tool further creates | ||
| 15 | +information about any parameter that is stuck at the parameter boundaries. | ||
| 16 | +This might be quite useful for debugging a fit. Finally the tool also list | ||
| 17 | +the TS values of each source that was fitted, in order have a quick overview | ||
| 18 | +on these quantities on the screen. | ||
| 19 | 19 | ||
| 20 | -In addition the tool is also capable of exporting the input model XML container to | ||
| 21 | -a region file which is compatible to be read with ds9 or other displying tools. | ||
| 22 | -To create a region file, the hidden parameter "ds9file" needs to be specified. There | ||
| 23 | -are quite a few further hidden parameters to steer e.g. color, font, etc of the region | ||
| 24 | -file output. | 20 | +In addition the tool is also capable of exporting the input model XML container |
| 21 | +to a region file which is compatible to be read with ds9 or other displying | ||
| 22 | +tools. To create a region file, the hidden parameter "ds9file" needs to be | ||
| 23 | +specified. There are quite a few further hidden parameters to steer e.g. | ||
| 24 | +color, font, etc of the region file output. | ||
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | General parameters | 27 | General parameters |
| @@ -91,10 +91,11 @@ Standard parameters | @@ -91,10 +91,11 @@ Standard parameters | ||
| 91 | ``(mode = ql) [string]`` | 91 | ``(mode = ql) [string]`` |
| 92 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). | 92 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). |
| 93 | 93 | ||
| 94 | -``(logfile = cssens.log) [filename]`` | 94 | +``(logfile = csmodelinfo.log) [filename]`` |
| 95 | Log filename. | 95 | Log filename. |
| 96 | 96 | ||
| 97 | 97 | ||
| 98 | Related tools or scripts | 98 | Related tools or scripts |
| 99 | ------------------------ | 99 | ------------------------ |
| 100 | 100 | ||
| 101 | +None | ||
| 101 | \ No newline at end of file | 102 | \ No newline at end of file |
doc/source/reference_manual/csmodelmerge.rst
| 1 | .. _csmodelmerge: | 1 | .. _csmodelmerge: |
| 2 | 2 | ||
| 3 | csmodelmerge | 3 | csmodelmerge |
| 4 | -====== | 4 | +============ |
| 5 | 5 | ||
| 6 | -Merges an arbitrary number of model XML files into one file. | 6 | +Merges an arbitrary number of model XML files into a single file. |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | Synopsis | 9 | Synopsis |
| 10 | -------- | 10 | -------- |
| 11 | 11 | ||
| 12 | -This script can be used to merge several model XML file into one output file. | ||
| 13 | -The files can be passed via the ``inmodels`` parameter. There are 4 options to specify | 12 | +This script merges several model XML file into a single model XML file. The |
| 13 | +files are passed via the ``inmodels`` parameter. There are 4 options to specify | ||
| 14 | a list of files that should be merged: | 14 | a list of files that should be merged: |
| 15 | - a space-separated list of file names (e.g. model1.xml model2.xml) | 15 | - a space-separated list of file names (e.g. model1.xml model2.xml) |
| 16 | - a comma-separated list of file names (e.g. model1.xml,model2.xml) | 16 | - a comma-separated list of file names (e.g. model1.xml,model2.xml) |
| 17 | - a wildcard string (e.g. mymodel*.xml) | 17 | - a wildcard string (e.g. mymodel*.xml) |
| 18 | - an ASCII file containing the file names, one file per line (e.g. @mymodels.txt) | 18 | - an ASCII file containing the file names, one file per line (e.g. @mymodels.txt) |
| 19 | 19 | ||
| 20 | -Note that the "@" needs to be specified in case of an ASCII file name. It is also important to | ||
| 21 | -note that models with the same name cannot be appended. The tool will throw and exception if | ||
| 22 | -the provided file contain models with the same name. | 20 | +Note that the "@" needs to be specified in case of an ASCII file name. It is |
| 21 | +also important to note that models with the same name cannot be appended. The | ||
| 22 | +tool will throw and exception if the provided file contain models with the same | ||
| 23 | +name. | ||
| 23 | 24 | ||
| 24 | 25 | ||
| 25 | General parameters | 26 | General parameters |
| @@ -56,10 +57,11 @@ Standard parameters | @@ -56,10 +57,11 @@ Standard parameters | ||
| 56 | ``(mode = ql) [string]`` | 57 | ``(mode = ql) [string]`` |
| 57 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). | 58 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). |
| 58 | 59 | ||
| 59 | -``(logfile = cssens.log) [filename]`` | 60 | +``(logfile = csmodelmerge.log) [filename]`` |
| 60 | Log filename. | 61 | Log filename. |
| 61 | 62 | ||
| 62 | 63 | ||
| 63 | Related tools or scripts | 64 | Related tools or scripts |
| 64 | ------------------------ | 65 | ------------------------ |
| 65 | 66 | ||
| 67 | +None | ||
| 66 | \ No newline at end of file | 68 | \ No newline at end of file |
doc/source/reference_manual/csobsinfo.rst
| 1 | .. _csobsinfo: | 1 | .. _csobsinfo: |
| 2 | 2 | ||
| 3 | csobsinfo | 3 | csobsinfo |
| 4 | -====== | 4 | +========= |
| 5 | 5 | ||
| 6 | -Dumps information about an observation container into log file or on screen | 6 | +Dumps information about an observation container into log file or on |
| 7 | +screen. | ||
| 7 | 8 | ||
| 8 | 9 | ||
| 9 | Synopsis | 10 | Synopsis |
| 10 | -------- | 11 | -------- |
| 11 | 12 | ||
| 12 | -This script provides detailled information about a given observation container. | ||
| 13 | -For IACT observations usually several observations with different | ||
| 14 | -configurations are combined. The script computes e.g. the overall energy | ||
| 15 | -range which could be an important input for :doc:`ctbin` to create a suitable | ||
| 16 | -energy range. In addition the script prints the pointing attributes like the average | ||
| 17 | -zenith/azimuth angle. If the hidden boolean parameter "offset" is specified to "yes", | ||
| 18 | -the script queries for the target position and computes the run-by-run offset as well | ||
| 19 | -as its average. In the observation summary, the time range of the observations including | ||
| 20 | -total ontime and (dead-time corrected) livetime is shown. | ||
| 21 | - | ||
| 22 | -The script further contains the hidden parameter "ds9file". If specified with a file | ||
| 23 | -name, the tool writes out a ds9 region file including a cross for each pointing position | ||
| 24 | -in the sky. | ||
| 25 | - | ||
| 26 | -When executed from within python, the script provides methods to return arrays containing | ||
| 27 | -observation-wise parameters. This might be useful for graphical display within a script. The | ||
| 28 | -following methods are implemented: | 13 | +This script provides detailed information about a given observation container. |
| 14 | +For IACT observations usually several observations with different configurations | ||
| 15 | +are combined. The script computes e.g. the overall energy range which could be | ||
| 16 | +an important input for :doc:`ctbin` to create a suitable energy range. In | ||
| 17 | +addition the script prints the pointing attributes like the average | ||
| 18 | +zenith/azimuth angle. If the hidden boolean parameter "offset" is specified to | ||
| 19 | +"yes", the script queries for the target position and computes the run-by-run | ||
| 20 | +offset as well as its average. In the observation summary, the time range of | ||
| 21 | +the observations including total ontime and (dead-time corrected) livetime is | ||
| 22 | +shown. | ||
| 23 | + | ||
| 24 | +The script further contains the hidden parameter "ds9file". If specified with | ||
| 25 | +a file name, the tool writes out a ds9 region file including a cross for each | ||
| 26 | +pointing position in the sky. | ||
| 27 | + | ||
| 28 | +When executed from within python, the script provides methods to return arrays | ||
| 29 | +containing observation-wise parameters. This might be useful for graphical | ||
| 30 | +display within a script. The following methods are implemented: | ||
| 29 | - zeniths (returning all zenith angles) | 31 | - zeniths (returning all zenith angles) |
| 30 | - azimuths (returning all azimuth angles) | 32 | - azimuths (returning all azimuth angles) |
| 31 | - offsets (returning all offset angles, provided the hidden parameter offset=yes) | 33 | - offsets (returning all offset angles, provided the hidden parameter offset=yes) |
| @@ -76,10 +78,11 @@ Standard parameters | @@ -76,10 +78,11 @@ Standard parameters | ||
| 76 | ``(mode = ql) [string]`` | 78 | ``(mode = ql) [string]`` |
| 77 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). | 79 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). |
| 78 | 80 | ||
| 79 | -``(logfile = cssens.log) [filename]`` | 81 | +``(logfile = csobsinfo.log) [filename]`` |
| 80 | Log filename. | 82 | Log filename. |
| 81 | 83 | ||
| 82 | 84 | ||
| 83 | Related tools or scripts | 85 | Related tools or scripts |
| 84 | ------------------------ | 86 | ------------------------ |
| 85 | 87 | ||
| 88 | +None | ||
| 86 | \ No newline at end of file | 89 | \ No newline at end of file |
doc/source/reference_manual/cstsmapmerge.rst
| 1 | .. _cstsmapmerge: | 1 | .. _cstsmapmerge: |
| 2 | 2 | ||
| 3 | cstsmapmerge | 3 | cstsmapmerge |
| 4 | -====== | 4 | +============ |
| 5 | 5 | ||
| 6 | Merges slices of splitted tsmap computations. | 6 | Merges slices of splitted tsmap computations. |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | Synopsis | 9 | Synopsis |
| 10 | -------- | 10 | -------- |
| 11 | -In case a TS map has been computed using the option to split the calculations into | ||
| 12 | -several jobs, this tool is required to merge the output into one final map again. | ||
| 13 | -Running :doc:`cttsmap` with the hidden parameters ``binmin`` and ``binmax`` specified | ||
| 14 | -will result in several sliced TS maps. This script merges them into one FITS file. | ||
| 15 | -The input slices can be passed via the ``inmaps`` parameter. There are 4 options to specify | ||
| 16 | -a list of files that should be merged: | 11 | + |
| 12 | +In case a TS map has been computed using the option to split the calculations | ||
| 13 | +into several jobs, this tool is required to merge the output into one final | ||
| 14 | +map again. Running :doc:`cttsmap` with the hidden parameters ``binmin`` and | ||
| 15 | +``binmax`` specified will result in several sliced TS maps. This script merges | ||
| 16 | +them into one FITS file. The input slices can be passed via the ``inmaps`` | ||
| 17 | +parameter. There are 4 options to specify a list of files that should be merged: | ||
| 17 | - a space-separated list of file names (e.g. tsmap1.fits tsmap2.fits) | 18 | - a space-separated list of file names (e.g. tsmap1.fits tsmap2.fits) |
| 18 | - a comma-separated list of file names (e.g. tsmap1.fits,tsmap2.fits) | 19 | - a comma-separated list of file names (e.g. tsmap1.fits,tsmap2.fits) |
| 19 | - a wildcard string (e.g. tsmap*.xml) | 20 | - a wildcard string (e.g. tsmap*.xml) |
| @@ -61,7 +62,7 @@ Standard parameters | @@ -61,7 +62,7 @@ Standard parameters | ||
| 61 | ``(mode = ql) [string]`` | 62 | ``(mode = ql) [string]`` |
| 62 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). | 63 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). |
| 63 | 64 | ||
| 64 | -``(logfile = cssens.log) [filename]`` | 65 | +``(logfile = cstsmapmerge.log) [filename]`` |
| 65 | Log filename. | 66 | Log filename. |
| 66 | 67 | ||
| 67 | 68 |
doc/source/reference_manual/cttsmap.rst
doc/source/reference_manual/index.rst
| @@ -45,7 +45,7 @@ cscripts | @@ -45,7 +45,7 @@ cscripts | ||
| 45 | csspec --- Computes spectral points <csspec> | 45 | csspec --- Computes spectral points <csspec> |
| 46 | csresmap --- Generates residual map <csresmap> | 46 | csresmap --- Generates residual map <csresmap> |
| 47 | cstsdist --- Generates TS distribution <cstsdist> | 47 | cstsdist --- Generates TS distribution <cstsdist> |
| 48 | - csobsinfo --- Shows detailled information about an observation container | ||
| 49 | - csmodelinfo --- Shows detailled information about a model container | ||
| 50 | - csmodelmerge --- Merges several model containers into one file | ||
| 51 | - cstsmapmerge --- Merges slices from ts map computations | 48 | + csobsinfo --- Shows observation container content <csobsinfo> |
| 49 | + csmodelinfo --- Shows model container content <csmodelinfo> | ||
| 50 | + csmodelmerge --- Merges several model containers into one file <csmodelmerge> | ||
| 51 | + cstsmapmerge --- Merges slices from ts map computations <cstsmapmerge> |
test/test_cscripts.sh.in
| @@ -97,7 +97,7 @@ $ECHO " ok" | @@ -97,7 +97,7 @@ $ECHO " ok" | ||
| 97 | 97 | ||
| 98 | # | 98 | # |
| 99 | # Test csmodelinfo | 99 | # Test csmodelinfo |
| 100 | -# ============== | 100 | +# ================ |
| 101 | $ECHO -n "Test csmodelinfo: " | 101 | $ECHO -n "Test csmodelinfo: " |
| 102 | chmod +x @abs_top_srcdir@/cscripts/csmodelinfo.py | 102 | chmod +x @abs_top_srcdir@/cscripts/csmodelinfo.py |
| 103 | @abs_top_srcdir@/cscripts/csmodelinfo.py \ | 103 | @abs_top_srcdir@/cscripts/csmodelinfo.py \ |
| @@ -116,7 +116,7 @@ $ECHO " ok" | @@ -116,7 +116,7 @@ $ECHO " ok" | ||
| 116 | 116 | ||
| 117 | # | 117 | # |
| 118 | # Test csmodelmerge (space-separated) | 118 | # Test csmodelmerge (space-separated) |
| 119 | -# ============== | 119 | +# =================================== |
| 120 | $ECHO -n "Test csmodelmerge (space-separated): " | 120 | $ECHO -n "Test csmodelmerge (space-separated): " |
| 121 | chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py | 121 | chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py |
| 122 | @abs_top_srcdir@/cscripts/csmodelmerge.py \ | 122 | @abs_top_srcdir@/cscripts/csmodelmerge.py \ |
| @@ -135,7 +135,7 @@ $ECHO " ok" | @@ -135,7 +135,7 @@ $ECHO " ok" | ||
| 135 | 135 | ||
| 136 | # | 136 | # |
| 137 | # Test csmodelmerge (comma-separated) | 137 | # Test csmodelmerge (comma-separated) |
| 138 | -# ============== | 138 | +# =================================== |
| 139 | $ECHO -n "Test csmodelmerge (comma-separated): " | 139 | $ECHO -n "Test csmodelmerge (comma-separated): " |
| 140 | chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py | 140 | chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py |
| 141 | @abs_top_srcdir@/cscripts/csmodelmerge.py \ | 141 | @abs_top_srcdir@/cscripts/csmodelmerge.py \ |
| @@ -154,7 +154,7 @@ $ECHO " ok" | @@ -154,7 +154,7 @@ $ECHO " ok" | ||
| 154 | 154 | ||
| 155 | # | 155 | # |
| 156 | # Test csmodelmerge (wildcard string) | 156 | # Test csmodelmerge (wildcard string) |
| 157 | -# ============== | 157 | +# =================================== |
| 158 | $ECHO -n "Test csmodelmerge (wildcard string): " | 158 | $ECHO -n "Test csmodelmerge (wildcard string): " |
| 159 | chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py | 159 | chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py |
| 160 | @abs_top_srcdir@/cscripts/csmodelmerge.py \ | 160 | @abs_top_srcdir@/cscripts/csmodelmerge.py \ |
| @@ -173,7 +173,7 @@ $ECHO " ok" | @@ -173,7 +173,7 @@ $ECHO " ok" | ||
| 173 | 173 | ||
| 174 | # | 174 | # |
| 175 | # Test csmodelmerge (ascii-file) | 175 | # Test csmodelmerge (ascii-file) |
| 176 | -# ============== | 176 | +# ============================== |
| 177 | ls data/model_cube_background* > models.txt | 177 | ls data/model_cube_background* > models.txt |
| 178 | $ECHO -n "Test csmodelmerge (ascii-file): " | 178 | $ECHO -n "Test csmodelmerge (ascii-file): " |
| 179 | chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py | 179 | chmod +x @abs_top_srcdir@/cscripts/csmodelmerge.py |
| @@ -194,7 +194,7 @@ rm models.txt | @@ -194,7 +194,7 @@ rm models.txt | ||
| 194 | 194 | ||
| 195 | # | 195 | # |
| 196 | # Test cstsmapmerge (comma-separated) | 196 | # Test cstsmapmerge (comma-separated) |
| 197 | -# ============== | 197 | +# =================================== |
| 198 | $ECHO -n "Test cstsmapmerge (comma-separated): " | 198 | $ECHO -n "Test cstsmapmerge (comma-separated): " |
| 199 | chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py | 199 | chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py |
| 200 | @abs_top_srcdir@/cscripts/cstsmapmerge.py \ | 200 | @abs_top_srcdir@/cscripts/cstsmapmerge.py \ |
| @@ -213,7 +213,7 @@ $ECHO " ok" | @@ -213,7 +213,7 @@ $ECHO " ok" | ||
| 213 | 213 | ||
| 214 | # | 214 | # |
| 215 | # Test cstsmapmerge (space-separated) | 215 | # Test cstsmapmerge (space-separated) |
| 216 | -# ============== | 216 | +# =================================== |
| 217 | $ECHO -n "Test cstsmapmerge (space-separated): " | 217 | $ECHO -n "Test cstsmapmerge (space-separated): " |
| 218 | chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py | 218 | chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py |
| 219 | @abs_top_srcdir@/cscripts/cstsmapmerge.py \ | 219 | @abs_top_srcdir@/cscripts/cstsmapmerge.py \ |
| @@ -232,7 +232,7 @@ $ECHO " ok" | @@ -232,7 +232,7 @@ $ECHO " ok" | ||
| 232 | 232 | ||
| 233 | # | 233 | # |
| 234 | # Test cstsmapmerge (wildcard string) | 234 | # Test cstsmapmerge (wildcard string) |
| 235 | -# ============== | 235 | +# =================================== |
| 236 | $ECHO -n "Test cstsmapmerge (wildcard string): " | 236 | $ECHO -n "Test cstsmapmerge (wildcard string): " |
| 237 | chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py | 237 | chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py |
| 238 | @abs_top_srcdir@/cscripts/cstsmapmerge.py \ | 238 | @abs_top_srcdir@/cscripts/cstsmapmerge.py \ |
| @@ -251,7 +251,7 @@ $ECHO " ok" | @@ -251,7 +251,7 @@ $ECHO " ok" | ||
| 251 | 251 | ||
| 252 | # | 252 | # |
| 253 | # Test cstsmapmerge (ascii-file) | 253 | # Test cstsmapmerge (ascii-file) |
| 254 | -# ============== | 254 | +# ============================== |
| 255 | ls data/tsmap_*.fits > tsmaps.txt | 255 | ls data/tsmap_*.fits > tsmaps.txt |
| 256 | $ECHO -n "Test cstsmapmerge (ascii-file): " | 256 | $ECHO -n "Test cstsmapmerge (ascii-file): " |
| 257 | chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py | 257 | chmod +x @abs_top_srcdir@/cscripts/cstsmapmerge.py |