Commit 2a8224a6c4aaa366e0e2f0faf9e9e358f6bbde6e

Authored by Jürgen Knödlseder
1 parent 53d9a3d7

Integrate script.

Showing 1 changed file with 15 additions and 16 deletions
scripts/cslightcrv.py
... ... @@ -133,8 +133,7 @@ class cslightcrv(ctools.cscript):
133 133  
134 134 # Return
135 135 return
136   -
137   -
  136 +
138 137 def create_tbounds(self):
139 138  
140 139 # Create time bin container
... ... @@ -156,8 +155,8 @@ class cslightcrv(ctools.cscript):
156 155 # Use linear time binning
157 156 time_min = self["tmin"].real()
158 157 time_max = self["tmax"].real()
159   - nbins = self["tbins"].integer()
160   - step = (time_max - time_min) / float(nbins)
  158 + nbins = self["tbins"].integer()
  159 + step = (time_max - time_min) / float(nbins)
161 160 for i in range(nbins):
162 161 tmin = gammalib.GTime()
163 162 tmin.mjd(time_min + i*step)# ref)
... ... @@ -171,8 +170,10 @@ class cslightcrv(ctools.cscript):
171 170 self.m_tbins.append(obs.events().gti().tstart(i),obs.events().gti().tstop(i))
172 171 else:
173 172 raise AttributeError("tbinalg=\""+self["tbinalg"].string()+"\" unkown. Must be one of \"FILE\", \"LIN\" or \"GTI\"")
  173 +
  174 + # Return
  175 + return
174 176  
175   -
176 177 def get_parameters(self):
177 178 """
178 179 Get parameters from parfile and setup the observation.
... ... @@ -205,7 +206,6 @@ class cslightcrv(ctools.cscript):
205 206 self.m_ebins = self["nebins"].integer()
206 207 self.m_emin = self["emin"].real()
207 208 self.m_emax = self["emax"].real()
208   -
209 209  
210 210 # Read other parameters
211 211 self.m_outfile = self["outfile"].filename()
... ... @@ -309,7 +309,7 @@ class cslightcrv(ctools.cscript):
309 309 self.log("\n")
310 310 self.log.header1("Generate lightcurve")
311 311  
312   - # Initialise FITS Table with extension "SPECTRUM"
  312 + # Initialise FITS Table with extension "LIGHTCURVE"
313 313 table = gammalib.GFitsBinTable(self.m_tbins.size())
314 314 table.extname("LIGHTCURVE")
315 315  
... ... @@ -348,14 +348,14 @@ class cslightcrv(ctools.cscript):
348 348 self.log.header2("Time bin "+str(i))
349 349  
350 350 # Get time boundaries
351   - tmin = self.m_tbins.tstart(i)
352   - tmax = self.m_tbins.tstop(i)
  351 + tmin = self.m_tbins.tstart(i)
  352 + tmax = self.m_tbins.tstop(i)
353 353  
354   - # compute time bin center and time width
355   - tmean = (tmin + tmax)
356   - tmean*=0.5
357   - twidth = (tmax - tmin)
358   - twidth*=0.5
  354 + # Compute time bin center and time width
  355 + tmean = (tmin + tmax)
  356 + tmean *= 0.5
  357 + twidth = (tmax - tmin)
  358 + twidth *= 0.5
359 359  
360 360 # Store time as MJD
361 361 MJD[i] = tmean.mjd()
... ... @@ -501,7 +501,7 @@ class cslightcrv(ctools.cscript):
501 501  
502 502 # Set all values to 0
503 503 for col in columns:
504   - col[i] = 0.0
  504 + col[i] = 0.0
505 505 TSvalues[i] = 0.0
506 506 ulim_values[i] = 0.0
507 507 continue
... ... @@ -598,4 +598,3 @@ if __name__ == '__main__':
598 598  
599 599 # Execute application
600 600 app.execute()
601   -
602 601 \ No newline at end of file
... ...