Commit f037610f803909885e16302f73159d9a2df7a0f1

Authored by Jürgen Knödlseder
1 parent f506071d

Correctly use GTI input file in cslightcrv

Showing 1 changed file with 9 additions and 8 deletions
cscripts/cslightcrv.py
... ... @@ -207,19 +207,20 @@ class cslightcrv(ctools.csobservation):
207 207  
208 208 # If the file a FITS file then load GTIs directly
209 209 if filename.is_fits():
210   - gti.load(filename)
  210 + gti = gammalib.GGti(filename)
211 211  
212 212 # ... otherwise load file the ASCII file as CSV file and construct
213 213 # the GTIs from the rows of the CSV file. It is expected that the
214 214 # CSV file has two columns containing the "START" and "STOP"
215 215 # values of the time bins. No header row is expected.
216   - csv = gammalib.GCsv(filename)
217   - for i in range(csv.nrows()):
218   - tmin = gammalib.GTime()
219   - tmax = gammalib.GTime()
220   - tmin.mjd(csv.real(i,0))
221   - tmax.mjd(csv.real(i,1))
222   - gti.append(tmin,tmax)
  216 + else:
  217 + csv = gammalib.GCsv(filename)
  218 + for i in range(csv.nrows()):
  219 + tmin = gammalib.GTime()
  220 + tmax = gammalib.GTime()
  221 + tmin.mjd(csv.real(i,0))
  222 + tmax.mjd(csv.real(i,1))
  223 + gti.append(tmin,tmax)
223 224  
224 225 # If the algorithm is "LIN" then use a linear time binning, defined by
225 226 # the "tmin", "tmax" and "tbins" user parameters
... ...