Commit f497c92a0164e34a75ec5ab2601305bf60b0797f

Authored by Jürgen Knödlseder
1 parent 3a96805c

Forward debug flag to ctools.

Showing 1 changed file with 15 additions and 10 deletions
scripts/cspull.py
... ... @@ -89,7 +89,7 @@ class cspull(ctools.cscript):
89 89 pars = gammalib.GApplicationPars(parfile)
90 90 except:
91 91 # Signal if parfile was not found
92   - sys.stdout.write("Parfile "+parfile+" not found. Create default parfile.\n")
  92 + print("Parfile "+parfile+" not found. Create default parfile.")
93 93  
94 94 # Create default parfile
95 95 pars = gammalib.GApplicationPars()
... ... @@ -143,11 +143,11 @@ class cspull(ctools.cscript):
143 143  
144 144 # Read parameters for binned if requested
145 145 if not self.m_enumbins == 0:
146   - self.m_npix = self["npix"].integer()
147   - self.m_binsz = self["binsz"].real()
  146 + self.m_npix = self["npix"].integer()
  147 + self.m_binsz = self["binsz"].real()
148 148 else:
149 149 # Set dummy values (required by obsutils)
150   - self.m_npix = 0
  150 + self.m_npix = 0
151 151 self.m_binsz = 0.0
152 152  
153 153 # Set models if we have none
... ... @@ -155,18 +155,19 @@ class cspull(ctools.cscript):
155 155 self.obs.models(self["inmodel"].filename())
156 156  
157 157 # Read other parameters
158   - self.m_outfile = self["outfile"].filename()
159   - self.m_ntrials = self["ntrials"].integer()
160   - self.m_edisp = self["edisp"].boolean()
161   - self.m_offset = self["offset"].real()
  158 + self.m_outfile = self["outfile"].filename()
  159 + self.m_ntrials = self["ntrials"].integer()
  160 + self.m_edisp = self["edisp"].boolean()
  161 + self.m_offset = self["offset"].real()
162 162  
163 163 # Set some fixed parameters
164   - self.m_log = False # Logging in client tools
165   - self.m_debug = True # Debugging in client tools
  164 + self.m_log = False # Logging in client tools
  165 + self.m_debug = self["debug"].boolean() # Debugging in client tools
166 166  
167 167 # Return
168 168 return
169 169  
  170 +
170 171 def models(self, models):
171 172 """
172 173 Set model.
... ... @@ -177,6 +178,7 @@ class cspull(ctools.cscript):
177 178 # Return
178 179 return
179 180  
  181 +
180 182 def execute(self):
181 183 """
182 184 Execute the script.
... ... @@ -187,6 +189,7 @@ class cspull(ctools.cscript):
187 189 # Return
188 190 return
189 191  
  192 +
190 193 def run(self):
191 194 """
192 195 Run the script.
... ... @@ -235,6 +238,7 @@ class cspull(ctools.cscript):
235 238 # Return
236 239 return
237 240  
  241 +
238 242 def set_obs(self):
239 243 """
240 244 Returns an observation container with a set of CTA observations.
... ... @@ -258,6 +262,7 @@ class cspull(ctools.cscript):
258 262 # Return observation container
259 263 return obs
260 264  
  265 +
261 266 def trial(self, seed):
262 267 """
263 268 Create the pull for a single trial.
... ...