Commit 6e1c8619e68169d9bca5fee76651f20397b0e89e

Authored by Jürgen Knödlseder
2 parents 609427de 00c0acbb

Merge branch '2305-datapath-before-vhefits' into integration

cscripts/csfindobs.par
... ... @@ -16,7 +16,7 @@
16 16 #
17 17 # Input and output parameters
18 18 #============================
19   -datapath, s, a, $VHEFITS,,, "Path were data are located"
  19 +datapath, s, a, NONE,,, "Path were data are located (NONE uses $VHEFITS environment variable)"
20 20 prodname, s, a, prod-name,,, "Name of FITS production (Run csiactdata to view your options)"
21 21 outfile, f, a, runlist.lis,,, "Output runlist file"
22 22  
... ...
cscripts/csfindobs.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Find observations from an IACT data store
4 4 #
5   -# Copyright (C) 2016-2017 Michael Mayer
  5 +# Copyright (C) 2016-2018 Michael Mayer
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -53,32 +53,36 @@ class csfindobs(ctools.cscript):
53 53  
54 54 # Return
55 55 return
56   -
  56 +
57 57  
58 58 # Private methods
59 59 def _get_parameters(self):
60 60 """
61 61 Get parameters from parfile and setup the observation.
62 62 """
63   - # Get parameters
64   - if self._datapath == '':
65   - self._datapath = self['datapath'].string()
66   -
  63 + # Query datapath. If the parameter is not NONE then use it, otherwise
  64 + # use the datapath from the VHEFITS environment variable
  65 + datapath = self['datapath'].string()
  66 + if gammalib.toupper(datapath) != 'NONE':
  67 + self._datapath = datapath
  68 + else:
  69 + self._datapath = os.getenv('VHEFITS','')
  70 +
67 71 # Expand environment
68 72 self._datapath = gammalib.expand_env(self._datapath)
69   -
  73 +
70 74 # Get production name
71 75 self._prodname = self['prodname'].string()
72   -
  76 +
73 77 # Master index file name
74 78 master_indx = self['master_indx'].string()
75   -
  79 +
76 80 # Initialise flag if spatial selection is required
77 81 self._select_radec = True
78   -
  82 +
79 83 # Initialise invalid radius
80 84 self._radius = 0.0
81   -
  85 +
82 86 # Check for validity of spatial parameters
83 87 if (self['ra'].is_valid() and
84 88 self['dec'].is_valid() and
... ...
cscripts/csiactdata.par
... ... @@ -16,7 +16,7 @@
16 16 #
17 17 # Input and output parameters
18 18 #============================
19   -datapath, s, a, $VHEFITS,,, "Path were data is located"
  19 +datapath, s, a, NONE,,, "Path were data are located (NONE uses $VHEFITS environment variable)"
20 20 master_indx, s, h, master.json,,, "Name of master index file"
21 21  
22 22 #
... ...
cscripts/csiactdata.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Inspect an IACT data storage
4 4 #
5   -# Copyright (C) 2015-2017 Michael Mayer
  5 +# Copyright (C) 2015-2018 Michael Mayer
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -61,18 +61,21 @@ class csiactdata(ctools.cscript):
61 61 """
62 62 Get parameters from parfile and setup the observation
63 63 """
64   -
65   - # Get datapath if not already set
66   - if self._datapath == '':
67   - self._datapath = self['datapath'].string()
68   -
  64 + # Query datapath. If the parameter is not NONE then use it, otherwise
  65 + # use the datapath from the VHEFITS environment variable
  66 + datapath = self['datapath'].string()
  67 + if gammalib.toupper(datapath) != 'NONE':
  68 + self._datapath = datapath
  69 + else:
  70 + self._datapath = os.getenv('VHEFITS','')
  71 +
69 72 # Expand environment
70 73 self._datapath = gammalib.expand_env(self._datapath)
71   -
  74 +
72 75 # Get filename of master index file
73 76 self._master_indx = self['master_indx'].string()
74 77 self._master_file = os.path.join(self._datapath, self._master_indx)
75   -
  78 +
76 79 # Check for presence of master index file
77 80 if not os.path.isfile(self._master_file):
78 81 raise RuntimeError('Master index file "'+self._master_file+
... ...
cscripts/csiactobs.par
... ... @@ -16,7 +16,7 @@
16 16 #
17 17 # Input and output parameters
18 18 #============================
19   -datapath, s, a, $VHEFITS,,, "Path were data is located"
  19 +datapath, s, a, NONE,,, "Path were data are located (NONE uses $VHEFITS environment variable)"
20 20 prodname, s, a, fits-prod-name,,, "Data storage name"
21 21 infile, f, a, runlist.lis,,, "Input runlist file"
22 22 inmodel, f, h, NONE,,, "Input model definition XML file (optional)"
... ...
cscripts/csiactobs.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # Generates an IACT observation definition XML file
4 4 #
5   -# Copyright (C) 2015-2017 Michael Mayer
  5 +# Copyright (C) 2015-2018 Michael Mayer
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -94,19 +94,23 @@ class csiactobs(ctools.cscript):
94 94 """
95 95 Get parameters from parfile and setup the observation
96 96 """
97   - # Set data path
98   - if self._datapath == '':
99   - self._datapath = self['datapath'].string()
100   -
101   - # Query input parameters
102   - self['inmodel'].filename()
  97 + # Query datapath. If the parameter is not NONE then use it, otherwise
  98 + # use the datapath from the VHEFITS environment variable
  99 + datapath = self['datapath'].string()
  100 + if gammalib.toupper(datapath) != 'NONE':
  101 + self._datapath = datapath
  102 + else:
  103 + self._datapath = os.getenv('VHEFITS','')
103 104  
104 105 # Expand environment
105 106 self._datapath = gammalib.expand_env(self._datapath)
106   -
  107 +
  108 + # Query input parameters
  109 + self['inmodel'].filename()
  110 +
107 111 # Read FITS production
108 112 self._prodname = self['prodname'].string()
109   -
  113 +
110 114 # Read runlist file if list not already filled
111 115 if len(self._runlist) == 0:
112 116  
... ...