Commit 23763bbce3aac7edff218b60ac96be3104ad3e59

Authored by Jürgen Knödlseder
1 parent 394d719a

Integrate code

cscripts/cscaldb.py
@@ -121,7 +121,7 @@ class cscaldb(ctools.cscript): @@ -121,7 +121,7 @@ class cscaldb(ctools.cscript):
121 121
122 # Extract response names from calibrations and append them to the 122 # Extract response names from calibrations and append them to the
123 # response name list 123 # response name list
124 - nrows = calibrations.length() 124 + nrows = calibrations.nrows()
125 ncols = calibrations.number() 125 ncols = calibrations.number()
126 for row in range(nrows): 126 for row in range(nrows):
127 for col in range(ncols): 127 for col in range(ncols):
cscripts/csiactcopy.py
@@ -239,7 +239,7 @@ class csiactcopy(ctools.cscript): @@ -239,7 +239,7 @@ class csiactcopy(ctools.cscript):
239 239
240 # Loop over rows and columns to copy over values exteding remote HDU 240 # Loop over rows and columns to copy over values exteding remote HDU
241 for col in tmp_hdu: 241 for col in tmp_hdu:
242 - for row in range(col.length()): 242 + for row in range(col.nrows()):
243 remote_hdu[col.name()][size + row] = col[row] 243 remote_hdu[col.name()][size + row] = col[row]
244 244
245 # Get remote obs_id 245 # Get remote obs_id
@@ -329,7 +329,7 @@ class csiactcopy(ctools.cscript): @@ -329,7 +329,7 @@ class csiactcopy(ctools.cscript):
329 remote_col = remote_hdu[i] 329 remote_col = remote_hdu[i]
330 330
331 # Loop over entries and merge 331 # Loop over entries and merge
332 - for j in range(remote_col.length()): 332 + for j in range(remote_col.nrows()):
333 local_col[j+old_local_rows] = remote_col[j] 333 local_col[j+old_local_rows] = remote_col[j]
334 334
335 # Save local fits file 335 # Save local fits file
cscripts/csresmap.py
@@ -34,7 +34,7 @@ class csresmap(ctools.cscript): @@ -34,7 +34,7 @@ class csresmap(ctools.cscript):
34 # Constructor 34 # Constructor
35 def __init__(self, *argv): 35 def __init__(self, *argv):
36 """ 36 """
37 - Constructor. 37 + Constructor
38 """ 38 """
39 # Set name 39 # Set name
40 self._name = 'csresmap' 40 self._name = 'csresmap'
@@ -113,13 +113,13 @@ class csresmap(ctools.cscript): @@ -113,13 +113,13 @@ class csresmap(ctools.cscript):
113 self['nypix'].integer() 113 self['nypix'].integer()
114 self['binsz'].real() 114 self['binsz'].real()
115 self['ebinalg'].string() 115 self['ebinalg'].string()
116 - if self['ebinalg'].string() == "FILE": 116 + if self['ebinalg'].string() == 'FILE':
117 self['ebinfile'].filename() 117 self['ebinfile'].filename()
118 else: 118 else:
119 self['emin'].real() 119 self['emin'].real()
120 self['emax'].real() 120 self['emax'].real()
121 self['enumbins'].integer() 121 self['enumbins'].integer()
122 - 122 +
123 # Query parameters 123 # Query parameters
124 self['edisp'].boolean() 124 self['edisp'].boolean()
125 self['algorithm'].string() 125 self['algorithm'].string()
@@ -152,11 +152,7 @@ class csresmap(ctools.cscript): @@ -152,11 +152,7 @@ class csresmap(ctools.cscript):
152 self._get_parameters() 152 self._get_parameters()
153 153
154 # Write observation into logger 154 # Write observation into logger
155 - if self._logTerse():  
156 - self._log('\n')  
157 - self._log.header1(gammalib.number('Observation',len(self._obs)))  
158 - self._log(str(self._obs))  
159 - self._log('\n') 155 + self._log_observations(gammalib.NORMAL, self._obs, 'Observation')
160 156
161 # If a counts and model cube are specified then load them as sky map 157 # If a counts and model cube are specified then load them as sky map
162 if self._use_maps: 158 if self._use_maps:
@@ -175,9 +171,7 @@ class csresmap(ctools.cscript): @@ -175,9 +171,7 @@ class csresmap(ctools.cscript):
175 else: 171 else:
176 172
177 # Write header 173 # Write header
178 - if self._logTerse():  
179 - self._log('\n')  
180 - self._log.header1('Generate binned map (ctbin)') 174 + self._log_header1(gammalib.TERSE, 'Generate binned map (ctbin)')
181 175
182 # Create countsmap 176 # Create countsmap
183 bin = ctools.ctbin(self._obs) 177 bin = ctools.ctbin(self._obs)
@@ -207,9 +201,7 @@ class csresmap(ctools.cscript): @@ -207,9 +201,7 @@ class csresmap(ctools.cscript):
207 countmap = cta_counts_cube.counts() 201 countmap = cta_counts_cube.counts()
208 202
209 # Write header 203 # Write header
210 - if self._logTerse():  
211 - self._log('\n')  
212 - self._log.header1('Generate model map (ctmodel)') 204 + self._log_header1(gammalib.TERSE, 'Generate model map (ctmodel)')
213 205
214 # Create model map 206 # Create model map
215 model = ctools.ctmodel(self._obs) 207 model = ctools.ctmodel(self._obs)