Commit 151d929984f2caa66679d50886fce3c228f0ec8b
1 parent
0c324747
Integrate code.
Showing
9 changed files
with
174 additions
and
122 deletions
cscripts/csfindobs.py
| 1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
| 2 | +# ========================================================================== | ||
| 3 | +# Find observations from an IACT data store | ||
| 4 | +# | ||
| 5 | +# Copyright (C) 2016 Michael Mayer | ||
| 6 | +# | ||
| 7 | +# This program is free software: you can redistribute it and/or modify | ||
| 8 | +# it under the terms of the GNU General Public License as published by | ||
| 9 | +# the Free Software Foundation, either version 3 of the License, or | ||
| 10 | +# (at your option) any later version. | ||
| 11 | +# | ||
| 12 | +# This program is distributed in the hope that it will be useful, | ||
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | +# GNU General Public License for more details. | ||
| 16 | +# | ||
| 17 | +# You should have received a copy of the GNU General Public License | ||
| 18 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | +# | ||
| 20 | +# ========================================================================== | ||
| 2 | import gammalib | 21 | import gammalib |
| 3 | import ctools | 22 | import ctools |
| 4 | import sys | 23 | import sys |
| 5 | import os | 24 | import os |
| 6 | import json | 25 | import json |
| 7 | 26 | ||
| 8 | -# ============== # | ||
| 9 | -# csrunfinder class # | ||
| 10 | -# ============== # | 27 | + |
| 28 | +# =============== # | ||
| 29 | +# csfindobs class # | ||
| 30 | +# =============== # | ||
| 11 | class csfindobs(ctools.cscript): | 31 | class csfindobs(ctools.cscript): |
| 12 | """ | 32 | """ |
| 13 | - This class can be used to find observations from an IACT data store. It derives | ||
| 14 | - from the GammaLib::GApplication class which provides support for parameter | ||
| 15 | - files, command line arguments, and logging. In that way the Python | ||
| 16 | - script behaves just as a regular ctool. | 33 | + This class can be used to find observations from an IACT data store. |
| 17 | """ | 34 | """ |
| 18 | def __init__(self, *argv): | 35 | def __init__(self, *argv): |
| 19 | """ | 36 | """ |
| 20 | Constructor. | 37 | Constructor. |
| 21 | """ | 38 | """ |
| 22 | # Set name | 39 | # Set name |
| 23 | - self.name = "csfindobs" | ||
| 24 | - self.version = "1.0.0" | ||
| 25 | - self.verbose = False | 40 | + self.name = "csfindobs" |
| 41 | + self.version = "1.0.0" | ||
| 42 | + self.verbose = False | ||
| 26 | self.datapath = os.getenv("VHEFITS","") | 43 | self.datapath = os.getenv("VHEFITS","") |
| 27 | 44 | ||
| 28 | # Make sure that parfile exists | 45 | # Make sure that parfile exists |
| @@ -70,16 +87,17 @@ class csfindobs(ctools.cscript): | @@ -70,16 +87,17 @@ class csfindobs(ctools.cscript): | ||
| 70 | 87 | ||
| 71 | # Create default parfile | 88 | # Create default parfile |
| 72 | pars = gammalib.GApplicationPars() | 89 | pars = gammalib.GApplicationPars() |
| 73 | - pars.append(gammalib.GApplicationPar("datapath","s","a",self.datapath,"","","Path were data is located")) | 90 | + pars.append(gammalib.GApplicationPar("datapath","s","a",self.datapath,"","","Path were data are located")) |
| 74 | pars.append(gammalib.GApplicationPar("prodname","s","a","prod-name","","","Name of FITS production (Run csiactdata to view your options)")) | 91 | pars.append(gammalib.GApplicationPar("prodname","s","a","prod-name","","","Name of FITS production (Run csiactdata to view your options)")) |
| 92 | + pars.append(gammalib.GApplicationPar("outfile","f","a","runlist.lis","","","Runlist outfile")) | ||
| 75 | pars.append(gammalib.GApplicationPar("ra","r","a","83.6331","","","Right ascension")) | 93 | pars.append(gammalib.GApplicationPar("ra","r","a","83.6331","","","Right ascension")) |
| 76 | pars.append(gammalib.GApplicationPar("dec","r","a","22.01","","","Declination")) | 94 | pars.append(gammalib.GApplicationPar("dec","r","a","22.01","","","Declination")) |
| 77 | pars.append(gammalib.GApplicationPar("rad","r","a","2.5","","","Search radius")) | 95 | pars.append(gammalib.GApplicationPar("rad","r","a","2.5","","","Search radius")) |
| 78 | pars.append(gammalib.GApplicationPar("min_qual","i","h","0","0|1|2","","Minimum data quality (0=perfect, 1=ok, 2=bad)")) | 96 | pars.append(gammalib.GApplicationPar("min_qual","i","h","0","0|1|2","","Minimum data quality (0=perfect, 1=ok, 2=bad)")) |
| 79 | pars.append(gammalib.GApplicationPar("expression","s","h","NONE","","","Additional expression")) | 97 | pars.append(gammalib.GApplicationPar("expression","s","h","NONE","","","Additional expression")) |
| 80 | pars.append(gammalib.GApplicationPar("master_indx","s","h","master.json","","","Name of master index file")) | 98 | pars.append(gammalib.GApplicationPar("master_indx","s","h","master.json","","","Name of master index file")) |
| 81 | - pars.append(gammalib.GApplicationPar("outfile","f","a","runlist.lis","","","Runlist outfile")) | ||
| 82 | pars.append_standard() | 99 | pars.append_standard() |
| 100 | + pars.append(gammalib.GApplicationPar("logfile","f","h","csfindobs.log","","","Log filename")) | ||
| 83 | pars.save(parfile) | 101 | pars.save(parfile) |
| 84 | 102 | ||
| 85 | # Return | 103 | # Return |
| @@ -97,7 +115,7 @@ class csfindobs(ctools.cscript): | @@ -97,7 +115,7 @@ class csfindobs(ctools.cscript): | ||
| 97 | self.datapath = gammalib.expand_env(self.datapath) | 115 | self.datapath = gammalib.expand_env(self.datapath) |
| 98 | 116 | ||
| 99 | # Get production name | 117 | # Get production name |
| 100 | - self.m_prodname = self["prodname"].string() | 118 | + self.m_prodname = self["prodname"].string() |
| 101 | 119 | ||
| 102 | # Master index file name | 120 | # Master index file name |
| 103 | self.m_master_indx = self["master_indx"].string() | 121 | self.m_master_indx = self["master_indx"].string() |
| @@ -109,8 +127,8 @@ class csfindobs(ctools.cscript): | @@ -109,8 +127,8 @@ class csfindobs(ctools.cscript): | ||
| 109 | if self["ra"].is_valid() and self["dec"].is_valid() and self["rad"].is_valid(): | 127 | if self["ra"].is_valid() and self["dec"].is_valid() and self["rad"].is_valid(): |
| 110 | 128 | ||
| 111 | # Read spatial parameters | 129 | # Read spatial parameters |
| 112 | - self.m_ra = self["ra"].real() | ||
| 113 | - self.m_dec = self["dec"].real() | 130 | + self.m_ra = self["ra"].real() |
| 131 | + self.m_dec = self["dec"].real() | ||
| 114 | self.m_radius = self["rad"].real() | 132 | self.m_radius = self["rad"].real() |
| 115 | 133 | ||
| 116 | else: | 134 | else: |
| @@ -121,7 +139,7 @@ class csfindobs(ctools.cscript): | @@ -121,7 +139,7 @@ class csfindobs(ctools.cscript): | ||
| 121 | self.select_radec = False | 139 | self.select_radec = False |
| 122 | 140 | ||
| 123 | # Read other parameters | 141 | # Read other parameters |
| 124 | - self.m_quality = self["min_qual"].integer() | 142 | + self.m_quality = self["min_qual"].integer() |
| 125 | self.m_expression = self["expression"].string() | 143 | self.m_expression = self["expression"].string() |
| 126 | 144 | ||
| 127 | # Check for validity of expression | 145 | # Check for validity of expression |
| @@ -159,9 +177,10 @@ class csfindobs(ctools.cscript): | @@ -159,9 +177,10 @@ class csfindobs(ctools.cscript): | ||
| 159 | raise RuntimeError("FITS data store \""+self.m_prodname+"\" not available. Run csiactdata to get a list of available storage names") | 177 | raise RuntimeError("FITS data store \""+self.m_prodname+"\" not available. Run csiactdata to get a list of available storage names") |
| 160 | if not gammalib.is_fits(self.m_obs_index+"[OBS_INDEX]"): | 178 | if not gammalib.is_fits(self.m_obs_index+"[OBS_INDEX]"): |
| 161 | raise RuntimeError("Observation index file \""+self.m_obs_index+"[OBS_INDEX]\" for FITS data store \""+self.m_prodname+"\" not available. Check your master index file or run csdsinfo to get a list of available storage names.") | 179 | raise RuntimeError("Observation index file \""+self.m_obs_index+"[OBS_INDEX]\" for FITS data store \""+self.m_prodname+"\" not available. Check your master index file or run csdsinfo to get a list of available storage names.") |
| 162 | - | ||
| 163 | - self.m_log = False # Logging in client tools | ||
| 164 | - self.m_debug = False # Debugging in client tools | 180 | + |
| 181 | + # Set other members | ||
| 182 | + self.m_log = False # Logging in client tools | ||
| 183 | + self.m_debug = False # Debugging in client tools | ||
| 165 | self.m_clobber = self["clobber"].boolean() | 184 | self.m_clobber = self["clobber"].boolean() |
| 166 | 185 | ||
| 167 | # Return | 186 | # Return |
| @@ -187,8 +206,7 @@ class csfindobs(ctools.cscript): | @@ -187,8 +206,7 @@ class csfindobs(ctools.cscript): | ||
| 187 | 206 | ||
| 188 | # Return | 207 | # Return |
| 189 | return | 208 | return |
| 190 | - | ||
| 191 | - | 209 | + |
| 192 | def run(self): | 210 | def run(self): |
| 193 | """ | 211 | """ |
| 194 | Run the script. | 212 | Run the script. |
| @@ -241,14 +259,15 @@ class csfindobs(ctools.cscript): | @@ -241,14 +259,15 @@ class csfindobs(ctools.cscript): | ||
| 241 | # Read observation IDs into array | 259 | # Read observation IDs into array |
| 242 | for i in range(obs_indx.nrows()): | 260 | for i in range(obs_indx.nrows()): |
| 243 | self.runs.append(obs_indx["OBS_ID"][i]) | 261 | self.runs.append(obs_indx["OBS_ID"][i]) |
| 244 | - | 262 | + |
| 263 | + # Dump expression | ||
| 245 | if self.logNormal(): | 264 | if self.logNormal(): |
| 246 | self.log("\n") | 265 | self.log("\n") |
| 247 | self.log.header3("Expression") | 266 | self.log.header3("Expression") |
| 248 | self.log(expr) | 267 | self.log(expr) |
| 249 | self.log("\n") | 268 | self.log("\n") |
| 250 | - | ||
| 251 | - | 269 | + |
| 270 | + # Dump number of observations | ||
| 252 | if self.logTerse(): | 271 | if self.logTerse(): |
| 253 | self.log("\n") | 272 | self.log("\n") |
| 254 | self.log.header3("Observations") | 273 | self.log.header3("Observations") |
| @@ -282,7 +301,7 @@ class csfindobs(ctools.cscript): | @@ -282,7 +301,7 @@ class csfindobs(ctools.cscript): | ||
| 282 | # ======================== # | 301 | # ======================== # |
| 283 | if __name__ == '__main__': | 302 | if __name__ == '__main__': |
| 284 | """ | 303 | """ |
| 285 | - Generates residual count map. | 304 | + Find IACT observations. |
| 286 | """ | 305 | """ |
| 287 | # Create instance of application | 306 | # Create instance of application |
| 288 | app = csfindobs(sys.argv) | 307 | app = csfindobs(sys.argv) |
cscripts/csiactdata.py
| @@ -40,8 +40,8 @@ class csiactdata(ctools.cscript): | @@ -40,8 +40,8 @@ class csiactdata(ctools.cscript): | ||
| 40 | Constructor. | 40 | Constructor. |
| 41 | """ | 41 | """ |
| 42 | # Set name | 42 | # Set name |
| 43 | - self.name = "csiactdata" | ||
| 44 | - self.version = "1.0.0" | 43 | + self.name = "csiactdata" |
| 44 | + self.version = "1.0.0" | ||
| 45 | self.datapath = os.getenv("VHEFITS","") | 45 | self.datapath = os.getenv("VHEFITS","") |
| 46 | 46 | ||
| 47 | # Make sure that parfile exists | 47 | # Make sure that parfile exists |
cscripts/csiactobs.py
| @@ -94,11 +94,11 @@ class csiactobs(ctools.cscript): | @@ -94,11 +94,11 @@ class csiactobs(ctools.cscript): | ||
| 94 | pars = gammalib.GApplicationPars() | 94 | pars = gammalib.GApplicationPars() |
| 95 | pars.append(gammalib.GApplicationPar("datapath","s","a",self.datapath,"","","Path were data is located")) | 95 | pars.append(gammalib.GApplicationPar("datapath","s","a",self.datapath,"","","Path were data is located")) |
| 96 | pars.append(gammalib.GApplicationPar("prodname","s","a","","","","Data storage name (Run csiactdata to view your options)")) | 96 | pars.append(gammalib.GApplicationPar("prodname","s","a","","","","Data storage name (Run csiactdata to view your options)")) |
| 97 | - pars.append(gammalib.GApplicationPar("runlistfile","f","a","runlist.lis","","","Runlist file")) | ||
| 98 | - pars.append(gammalib.GApplicationPar("bkgpars","i","a","1","","","Number of free parameters per background model")) | 97 | + pars.append(gammalib.GApplicationPar("infile","f","a","runlist.lis","","","Runlist file")) |
| 98 | + pars.append(gammalib.GApplicationPar("inmodel","f","h","NONE","","","Input model XML file (optional)")) | ||
| 99 | pars.append(gammalib.GApplicationPar("outobs","f","a","obs.xml","","","Observation XML outfile")) | 99 | pars.append(gammalib.GApplicationPar("outobs","f","a","obs.xml","","","Observation XML outfile")) |
| 100 | pars.append(gammalib.GApplicationPar("outmodel","f","a","bgmodels.xml","","","Output model XML file")) | 100 | pars.append(gammalib.GApplicationPar("outmodel","f","a","bgmodels.xml","","","Output model XML file")) |
| 101 | - pars.append(gammalib.GApplicationPar("inmodel","f","h","NONE","","","Input model XML file (optional)")) | 101 | + pars.append(gammalib.GApplicationPar("bkgpars","i","a","1","","","Number of free parameters per background model")) |
| 102 | pars.append(gammalib.GApplicationPar("master_indx","s","h","master.json","","","Name of master index file")) | 102 | pars.append(gammalib.GApplicationPar("master_indx","s","h","master.json","","","Name of master index file")) |
| 103 | pars.append(gammalib.GApplicationPar("bkg_scale","b","h","yes","","","Specifies whether the background scaling factor from the observation index file should be applied if available. ")) | 103 | pars.append(gammalib.GApplicationPar("bkg_scale","b","h","yes","","","Specifies whether the background scaling factor from the observation index file should be applied if available. ")) |
| 104 | pars.append(gammalib.GApplicationPar("ev_hiera","s","h","events","","","Hierarchy of event formats")) | 104 | pars.append(gammalib.GApplicationPar("ev_hiera","s","h","events","","","Hierarchy of event formats")) |
| @@ -133,7 +133,7 @@ class csiactobs(ctools.cscript): | @@ -133,7 +133,7 @@ class csiactobs(ctools.cscript): | ||
| 133 | 133 | ||
| 134 | # Read user parameters | 134 | # Read user parameters |
| 135 | self.m_prodname = self["prodname"].string() | 135 | self.m_prodname = self["prodname"].string() |
| 136 | - self.m_runlistfile = gammalib.expand_env(self["runlistfile"].filename()) | 136 | + self.m_runlistfile = gammalib.expand_env(self["infile"].filename()) |
| 137 | self.m_bkgpars = self["bkgpars"].integer() | 137 | self.m_bkgpars = self["bkgpars"].integer() |
| 138 | 138 | ||
| 139 | # Output model file | 139 | # Output model file |
doc/source/reference_manual/csfindobs.rst
| @@ -3,54 +3,65 @@ | @@ -3,54 +3,65 @@ | ||
| 3 | csfindobs | 3 | csfindobs |
| 4 | ========= | 4 | ========= |
| 5 | 5 | ||
| 6 | -Creates a list of observation IDs that fulfil certain criteria, e.g. pointing close to specific source | 6 | +Creates a list of observation IDs that fulfils certain criteria, e.g. |
| 7 | +pointing close to specific source. | ||
| 7 | 8 | ||
| 8 | 9 | ||
| 9 | Synopsis | 10 | Synopsis |
| 10 | -------- | 11 | -------- |
| 11 | 12 | ||
| 12 | -This script can be used to create lists of observation IDs that share certain properties. For | ||
| 13 | -instance, all observations pointing around a specific sky position can be selected. In addition, | ||
| 14 | -the script is flexible to use expressions to further constrain criteria to select observations. | ||
| 15 | -The user can e.g. select all observations within a certain zenith angle range by specifying the hidden | ||
| 16 | -parameter expression: e.g. use ``csfindobs expression="ZEN_PNT<50&&ZEN_PNT>40"`` to constrain the zenith angle range | ||
| 17 | -from 40 to 50 degrees. The output of this script is an ASCII file containing observation IDs that fulfil criteria | ||
| 18 | -specified by the user. This file can be used as input for :doc:`csiactobs`. The script operates | ||
| 19 | -on an observation index file that needs to be provided along with IACT data. `See here <http://gamma-astro-data-formats.readthedocs.org/en/latest/index.html>`__ how IACT data | ||
| 20 | -should be structured. To investigate additional parameters which are available for selection, | ||
| 21 | -have a look `here <http://gamma-astro-data-formats.readthedocs.org/en/latest/data_storage/obs_index/index.html>`__. | 13 | +This script can be used to create lists of observation IDs that share certain |
| 14 | +properties. For instance, all observations pointing around a specific sky | ||
| 15 | +position can be selected. In addition, the script is flexible to use expressions | ||
| 16 | +to further constrain criteria to select observations. The user can e.g. select | ||
| 17 | +all observations within a certain zenith angle range by specifying the hidden | ||
| 18 | +parameter expression. For example | ||
| 19 | + | ||
| 20 | +``csfindobs expression="ZEN_PNT<50&&ZEN_PNT>40"`` | ||
| 21 | + | ||
| 22 | +is used to select observations with zenith angle range between 40 and 50 degrees. | ||
| 23 | + | ||
| 24 | +The parameter ``datapath`` is only queried if the environment variable $VHEFITS | ||
| 25 | +is not set. | ||
| 26 | + | ||
| 27 | +The output of this script is an ASCII file containing observation IDs that | ||
| 28 | +fulfil criteria specified by the user. This file can be used as input for | ||
| 29 | +:doc:`csiactobs`. The script operates on an observation index file that needs | ||
| 30 | +to be provided along with IACT data. `See here <http://gamma-astro-data-formats.readthedocs.org/en/latest/index.html>`__ | ||
| 31 | +how IACT data should be structured. To investigate additional parameters which | ||
| 32 | +are available for selection, have a look `here <http://gamma-astro-data-formats.readthedocs.org/en/latest/data_storage/obs_index/index.html>`__. | ||
| 22 | 33 | ||
| 23 | 34 | ||
| 24 | General parameters | 35 | General parameters |
| 25 | ------------------ | 36 | ------------------ |
| 26 | 37 | ||
| 27 | ``datapath [string]`` | 38 | ``datapath [string]`` |
| 28 | - Path were data is located | 39 | + Path were data are located. |
| 29 | 40 | ||
| 30 | ``prodname [string]`` | 41 | ``prodname [string]`` |
| 31 | - Name of FITS production (Run :doc:`csiactdata` to view your options) | 42 | + Name of FITS production (Run :doc:`csiactdata` to view your options). |
| 43 | + | ||
| 44 | +``outfile [file]`` | ||
| 45 | + Output runlist ASCII file. | ||
| 32 | 46 | ||
| 33 | ``ra [real]`` | 47 | ``ra [real]`` |
| 34 | - Right ascension of search region (invoke "INDEF" to avoid spatial selection) | 48 | + Right ascension of search region (invoke "INDEF" to avoid spatial selection). |
| 35 | 49 | ||
| 36 | ``dec [real]`` | 50 | ``dec [real]`` |
| 37 | - Declination of search region (invoke "INDEF" to avoid spatial selection) | 51 | + Declination of search region (invoke "INDEF" to avoid spatial selection). |
| 38 | 52 | ||
| 39 | ``rad [real]`` | 53 | ``rad [real]`` |
| 40 | - Radius of search region (deg) (invoke "INDEF" or negative values to avoid spatial selection) | 54 | + Radius of search region (deg) (invoke "INDEF" or negative values to avoid |
| 55 | + spatial selection) | ||
| 41 | 56 | ||
| 42 | -``outfile [file]`` | ||
| 43 | - Runlist outfile | ||
| 44 | - | ||
| 45 | ``(min_qual = 0) [integer]`` | 57 | ``(min_qual = 0) [integer]`` |
| 46 | - Minimum data quality (0=best, 1=medium, 2=bad) | 58 | + Minimum data quality (0=best, 1=medium, 2=bad). |
| 47 | 59 | ||
| 48 | ``(expression = NONE) [string]`` | 60 | ``(expression = NONE) [string]`` |
| 49 | - Additional expression | 61 | + Additional expression. |
| 50 | 62 | ||
| 51 | ``(master_index = master.json) [string]`` | 63 | ``(master_index = master.json) [string]`` |
| 52 | - Name of master index file | ||
| 53 | - | 64 | + Name of master index file. |
| 54 | 65 | ||
| 55 | 66 | ||
| 56 | Standard parameters | 67 | Standard parameters |
| @@ -84,4 +95,4 @@ Standard parameters | @@ -84,4 +95,4 @@ Standard parameters | ||
| 84 | Related tools or scripts | 95 | Related tools or scripts |
| 85 | ------------------------ | 96 | ------------------------ |
| 86 | 97 | ||
| 87 | -None | ||
| 88 | \ No newline at end of file | 98 | \ No newline at end of file |
| 99 | +:doc:`csiactobs` | ||
| 89 | \ No newline at end of file | 100 | \ No newline at end of file |
doc/source/reference_manual/csiactdata.rst
| @@ -3,26 +3,29 @@ | @@ -3,26 +3,29 @@ | ||
| 3 | csiactdata | 3 | csiactdata |
| 4 | =========== | 4 | =========== |
| 5 | 5 | ||
| 6 | -Dumps information about the available FITS productions of IACT data on the screen | 6 | +Dumps information about the available FITS productions of IACT data on the |
| 7 | +screen. | ||
| 7 | 8 | ||
| 8 | 9 | ||
| 9 | Synopsis | 10 | Synopsis |
| 10 | -------- | 11 | -------- |
| 11 | 12 | ||
| 12 | This script inspects the local IACT FITS data storage and prints the names of | 13 | This script inspects the local IACT FITS data storage and prints the names of |
| 13 | -available and valid data productions on the screen. The first parameter ``datapath`` | ||
| 14 | -is only queried if the environment variable $VHEFITS is not set. The path should be set | ||
| 15 | -to the location of the `master index file <http://gamma-astro-data-formats.readthedocs.org/en/latest/data_storage/super_index/index.html>`__. | ||
| 16 | -The output of this script can be used as input for further tools that use IACT data. | 14 | +available and valid data productions on the screen. The parameter ``datapath`` |
| 15 | +is only queried if the environment variable $VHEFITS is not set. The path should | ||
| 16 | +be set to the location of the `master index file <http://gamma-astro-data-formats.readthedocs.org/en/latest/data_storage/super_index/index.html>`__. | ||
| 17 | +The output of this script can be used as input for further tools that use IACT | ||
| 18 | +data. | ||
| 19 | + | ||
| 17 | 20 | ||
| 18 | General parameters | 21 | General parameters |
| 19 | ------------------ | 22 | ------------------ |
| 20 | 23 | ||
| 21 | ``datapath [string]`` | 24 | ``datapath [string]`` |
| 22 | - Path were data is located | 25 | + Path were data are located. |
| 23 | 26 | ||
| 24 | ``(master_index = master.json) [string]`` | 27 | ``(master_index = master.json) [string]`` |
| 25 | - Name of master index file | 28 | + Name of master index file. |
| 26 | 29 | ||
| 27 | 30 | ||
| 28 | Standard parameters | 31 | Standard parameters |
| @@ -56,4 +59,4 @@ Standard parameters | @@ -56,4 +59,4 @@ Standard parameters | ||
| 56 | Related tools or scripts | 59 | Related tools or scripts |
| 57 | ------------------------ | 60 | ------------------------ |
| 58 | 61 | ||
| 59 | -None | ||
| 60 | \ No newline at end of file | 62 | \ No newline at end of file |
| 63 | +:doc:`csfindobs` | ||
| 61 | \ No newline at end of file | 64 | \ No newline at end of file |
doc/source/reference_manual/csiactobs.rst
| @@ -3,98 +3,109 @@ | @@ -3,98 +3,109 @@ | ||
| 3 | csiactobs | 3 | csiactobs |
| 4 | =========== | 4 | =========== |
| 5 | 5 | ||
| 6 | -Creates an observation XML file for IACTs using a list of observation IDs as input | 6 | +Creates an observation XML file for IACTs using a list of observation IDs as |
| 7 | +input. | ||
| 7 | 8 | ||
| 8 | 9 | ||
| 9 | Synopsis | 10 | Synopsis |
| 10 | -------- | 11 | -------- |
| 11 | 12 | ||
| 12 | -This script creates an observation XML file from a list of observation IDs provided in an ASCII file. | ||
| 13 | -Such an ASCII file can for instance be created with :doc:`csfindobs`. The script operates on IACT data | ||
| 14 | -that needs to be present on the user machine. `See here <http://gamma-astro-data-formats.readthedocs.org/en/latest/index.html>`__ how IACT data | ||
| 15 | -should be structured. | ||
| 16 | - | ||
| 17 | -Besides creating an observation XML file, this script also stores a model XML file that contains background models for each | ||
| 18 | -observation. The number of free parameters is steered via the ``bkgpars`` parameter. | ||
| 19 | - | ||
| 20 | -The user can also specify as ``inmodel`` parameter an XML model file with e.g. sky models. The output model | ||
| 21 | -will then contain these models as well. | ||
| 22 | - | ||
| 23 | -The script further allows to specify hierarchies for the data formats and background models. The program will | ||
| 24 | -pick the first available option and fall back to the next one if the first choice is unavailable. | ||
| 25 | -If e.g. the IRF background model is not available, the script will assign the next background model in the hierarchy ``bkg_mod_hiera``. | ||
| 26 | -If the user wants to use a Gaussian background model as first choice, the parameter ``bkg_mod_hiera`` should be specified to "gauss". | ||
| 27 | -In addition, the user can specify start parameters for the background parameters that will be in the output XML model. | ||
| 28 | - | ||
| 29 | -If an observation that given in the input ASCII file is not available on the user machine, the script dumps a warning into the logfile | ||
| 30 | -and the obsservation is skipped. | 13 | +This script creates an observation XML file from a list of observation IDs |
| 14 | +provided in an ASCII file. Such an ASCII file can for instance be created with | ||
| 15 | +:doc:`csfindobs`. The script operates on IACT data that needs to be present on | ||
| 16 | +the user machine. `See here <http://gamma-astro-data-formats.readthedocs.org/en/latest/index.html>`__ | ||
| 17 | +how IACT data should be structured. | ||
| 18 | + | ||
| 19 | +The parameter ``datapath`` is only queried if the environment variable $VHEFITS | ||
| 20 | +is not set. | ||
| 21 | + | ||
| 22 | +Besides creating an observation XML file, this script also stores a model XML | ||
| 23 | +file that contains background models for each observation. The number of free | ||
| 24 | +parameters is steered via the ``bkgpars`` parameter. | ||
| 25 | + | ||
| 26 | +The user can also specify as ``inmodel`` parameter an XML model file with e.g. | ||
| 27 | +sky models. The output model will then contain these models as well. | ||
| 28 | + | ||
| 29 | +The script further allows to specify hierarchies for the data formats and | ||
| 30 | +background models. The script will pick the first available option and fall back | ||
| 31 | +to the next one if the first choice is unavailable. If e.g. the IRF background | ||
| 32 | +model is not available, the script will assign the next background model in the | ||
| 33 | +hierarchy ``bkg_mod_hiera``. If the user wants to use a Gaussian background model | ||
| 34 | +as first choice, the parameter ``bkg_mod_hiera`` should be specified to "gauss". | ||
| 35 | +In addition, the user can specify start parameters for the background parameters | ||
| 36 | +that will be in the output XML model. | ||
| 37 | + | ||
| 38 | +If an observation that given in the input ASCII file is not available on the user | ||
| 39 | +machine, the script dumps a warning into the logfile and the obsservation is | ||
| 40 | +skipped. | ||
| 31 | 41 | ||
| 32 | 42 | ||
| 33 | General parameters | 43 | General parameters |
| 34 | ------------------ | 44 | ------------------ |
| 35 | 45 | ||
| 36 | ``datapath [string]`` | 46 | ``datapath [string]`` |
| 37 | - Path were data is located | 47 | + Path were data are located. |
| 38 | 48 | ||
| 39 | ``prodname [string]`` | 49 | ``prodname [string]`` |
| 40 | - Name of FITS production (Run :doc:`csiactdata` to view your options) | 50 | + Name of FITS production (Run :doc:`csiactdata` to view your options). |
| 41 | 51 | ||
| 42 | -``runlistfile [file]`` | ||
| 43 | - Input list of observation IDs | ||
| 44 | - | ||
| 45 | -``bkgpars [integer]`` | ||
| 46 | - Number of free parameters for each background model | 52 | +``infile [file]`` |
| 53 | + Input runlist ASCII file. | ||
| 47 | 54 | ||
| 55 | +``(inmodel = NONE) [file]`` | ||
| 56 | + Input model XML file. | ||
| 57 | + | ||
| 48 | ``outobs [file]`` | 58 | ``outobs [file]`` |
| 49 | - Observation XML outfile | 59 | + Output Observation Definition XML file. |
| 50 | 60 | ||
| 51 | ``outmodel [file]`` | 61 | ``outmodel [file]`` |
| 52 | - Output model XML file | 62 | + Output model XML file. |
| 63 | + | ||
| 64 | +``bkgpars [integer]`` | ||
| 65 | + Number of free parameters for each background model. | ||
| 53 | 66 | ||
| 54 | -``(inmodel = NONE) [file]`` | ||
| 55 | - Input model XML file (optional) | ||
| 56 | - | ||
| 57 | ``(master_indx = master.json) [file]`` | 67 | ``(master_indx = master.json) [file]`` |
| 58 | - Name of master index file | 68 | + Name of master index file. |
| 59 | 69 | ||
| 60 | ``(bkg_scale = yes) [boolean] | 70 | ``(bkg_scale = yes) [boolean] |
| 61 | - Specifies whether the background scaling factor from the observation index file should be applied if available. | 71 | + Specifies whether the background scaling factor from the observation index |
| 72 | + file should be applied if available. | ||
| 62 | 73 | ||
| 63 | ``(ev_hiera = events) [string]`` | 74 | ``(ev_hiera = events) [string]`` |
| 64 | - Hierarchy of event file formats | 75 | + Hierarchy of event file formats. |
| 65 | 76 | ||
| 66 | ``(aeff_hiera = aeff_2d) [string]`` | 77 | ``(aeff_hiera = aeff_2d) [string]`` |
| 67 | - Hierarchy of effective area formats | 78 | + Hierarchy of effective area formats. |
| 68 | 79 | ||
| 69 | ``(psf_hiera = psf_king|psf_3gauss) [string]`` | 80 | ``(psf_hiera = psf_king|psf_3gauss) [string]`` |
| 70 | - Hierarchy of psf formats | 81 | + Hierarchy of point spread function formats. |
| 71 | 82 | ||
| 72 | ``(edisp_hiera = edisp_2d) [string]`` | 83 | ``(edisp_hiera = edisp_2d) [string]`` |
| 73 | - Hierarchy of energy disperson formats | 84 | + Hierarchy of energy disperson formats. |
| 74 | 85 | ||
| 75 | ``(bkg_hiera = bkg_3d) [string]`` | 86 | ``(bkg_hiera = bkg_3d) [string]`` |
| 76 | Hierarchy of background formats. | 87 | Hierarchy of background formats. |
| 77 | 88 | ||
| 78 | ``(bkg_mod_hiera = irf|aeff|gauss) [string]`` | 89 | ``(bkg_mod_hiera = irf|aeff|gauss) [string]`` |
| 79 | - Hierarchy of background models | 90 | + Hierarchy of background models. |
| 80 | 91 | ||
| 81 | ``(bkg_gauss_norm = 1e-8) [real]`` | 92 | ``(bkg_gauss_norm = 1e-8) [real]`` |
| 82 | - Input normalisation for Gaussian background | 93 | + Input normalisation for Gaussian background. |
| 83 | 94 | ||
| 84 | ``(bkg_gauss_index = -2.0) [real]`` | 95 | ``(bkg_gauss_index = -2.0) [real]`` |
| 85 | - Input spectral index for Gaussian background | 96 | + Input spectral index for Gaussian background. |
| 86 | 97 | ||
| 87 | ``(bkg_gauss_sigma = 1e-8) [real]`` | 98 | ``(bkg_gauss_sigma = 1e-8) [real]`` |
| 88 | - Input sigma for Gaussian background | 99 | + Input sigma for Gaussian background. |
| 89 | 100 | ||
| 90 | ``(bkg_aeff_norm = 1e-14) [real]`` | 101 | ``(bkg_aeff_norm = 1e-14) [real]`` |
| 91 | - Input normalisation for effective area background | 102 | + Input normalisation for effective area background. |
| 92 | 103 | ||
| 93 | ``(bkg_aeff_index = -2.0) [real]`` | 104 | ``(bkg_aeff_index = -2.0) [real]`` |
| 94 | - Input spectral index for effective area background | 105 | + Input spectral index for effective area background. |
| 95 | 106 | ||
| 96 | ``(bkg_range_factor = 100.0) [real]`` | 107 | ``(bkg_range_factor = 100.0) [real]`` |
| 97 | - Factor to determine range of background normalisation | 108 | + Factor to determine range of background normalisation. |
| 98 | 109 | ||
| 99 | 110 | ||
| 100 | Standard parameters | 111 | Standard parameters |
| @@ -128,4 +139,4 @@ Standard parameters | @@ -128,4 +139,4 @@ Standard parameters | ||
| 128 | Related tools or scripts | 139 | Related tools or scripts |
| 129 | ------------------------ | 140 | ------------------------ |
| 130 | 141 | ||
| 131 | -None | ||
| 132 | \ No newline at end of file | 142 | \ No newline at end of file |
| 143 | +:doc:`csiactobs` | ||
| 133 | \ No newline at end of file | 144 | \ No newline at end of file |
doc/source/reference_manual/cstsmapmerge.rst
doc/source/reference_manual/index.rst
| @@ -31,25 +31,33 @@ ctools | @@ -31,25 +31,33 @@ ctools | ||
| 31 | cterror --- Calculates likelihood profile errors <cterror> | 31 | cterror --- Calculates likelihood profile errors <cterror> |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | -cscripts | ||
| 35 | --------- | 34 | +General cscripts |
| 35 | +---------------- | ||
| 36 | 36 | ||
| 37 | .. toctree:: | 37 | .. toctree:: |
| 38 | :maxdepth: 1 | 38 | :maxdepth: 1 |
| 39 | 39 | ||
| 40 | cscaldb --- Lists available instrument response functions <cscaldb> | 40 | cscaldb --- Lists available instrument response functions <cscaldb> |
| 41 | - csobsdef --- Generates observation definition file <csobsdef> | ||
| 42 | cslightcrv --- Computes lightcurve <cslightcrv> | 41 | cslightcrv --- Computes lightcurve <cslightcrv> |
| 42 | + csmodelinfo --- Shows model container content <csmodelinfo> | ||
| 43 | + csmodelmerge --- Merges several model containers into one file <csmodelmerge> | ||
| 44 | + csobsdef --- Generates observation definition file <csobsdef> | ||
| 45 | + csobsinfo --- Shows observation container content <csobsinfo> | ||
| 43 | cspull --- Generates pull distribution <cspull> | 46 | cspull --- Generates pull distribution <cspull> |
| 47 | + csresmap --- Generates residual map <csresmap> | ||
| 44 | cssens --- Computes CTA sensitivity <cssens> | 48 | cssens --- Computes CTA sensitivity <cssens> |
| 45 | csspec --- Computes spectral points <csspec> | 49 | csspec --- Computes spectral points <csspec> |
| 46 | - csresmap --- Generates residual map <csresmap> | ||
| 47 | cstsdist --- Generates TS distribution <cstsdist> | 50 | cstsdist --- Generates TS distribution <cstsdist> |
| 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> | 51 | cstsmapmerge --- Merges slices from ts map computations <cstsmapmerge> |
| 52 | + | ||
| 53 | + | ||
| 54 | +IACT cscripts | ||
| 55 | +------------- | ||
| 56 | + | ||
| 57 | +.. toctree:: | ||
| 58 | + :maxdepth: 1 | ||
| 59 | + | ||
| 52 | csobs2caldb --- Creates a caldb entry from an input observation <csobs2caldb> | 60 | csobs2caldb --- Creates a caldb entry from an input observation <csobs2caldb> |
| 53 | - csiactdata --- Dumps information about the IACT data available on the user machine <csiactdata> | ||
| 54 | - csiactobs --- Creates an observation XML file for IACTs using a list of observation IDs as input <csiactobs> | ||
| 55 | - csfindobs --- Creates a list of observation IDs <csfindobs> | 61 | + csiactdata --- Shows information about IACT data available on the user machine <csiactdata> |
| 62 | + csiactobs --- Generates observation definition file for IACT data from observation IDs <csiactobs> | ||
| 63 | + csfindobs --- Generates a list of IACT observation IDs <csfindobs> |
test/test_cscripts.sh.in
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This script tests all cscripts that are shipped with ctools | 3 | # This script tests all cscripts that are shipped with ctools |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2011-2015 Juergen Knoedlseder | 5 | +# Copyright (C) 2011-2016 Juergen Knoedlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -149,7 +149,7 @@ chmod +x @abs_top_srcdir@/cscripts/csiactobs.py | @@ -149,7 +149,7 @@ chmod +x @abs_top_srcdir@/cscripts/csiactobs.py | ||
| 149 | @abs_top_srcdir@/cscripts/csiactobs.py \ | 149 | @abs_top_srcdir@/cscripts/csiactobs.py \ |
| 150 | datapath="iactdata/" \ | 150 | datapath="iactdata/" \ |
| 151 | prodname="unit-test" \ | 151 | prodname="unit-test" \ |
| 152 | - runlistfile="iactdata/runlist.txt" \ | 152 | + infile="iactdata/runlist.txt" \ |
| 153 | bkgpars="1" \ | 153 | bkgpars="1" \ |
| 154 | outobs="obs2.xml" \ | 154 | outobs="obs2.xml" \ |
| 155 | outmodel="bkgmodels.xml" > csiactobs.log | 155 | outmodel="bkgmodels.xml" > csiactobs.log |