Commit 9c5ea3237a69a6e8b7dfb0fba3eff760fd780da0

Authored by Jürgen Knödlseder
1 parent 64e71e40

Solve conflicts from merging.

Showing 1 changed file with 6 additions and 82 deletions
scripts/cspull.py
... ... @@ -78,68 +78,6 @@ class cspull(GApplication):
78 78 # Return
79 79 return
80 80  
81   -<<<<<<< HEAD
82   - def parfile(self):
83   - """
84   - Check if parfile exists. If parfile does not exist then create a
85   - default parfile. This kluge avoids shipping the cscript with a parfile.
86   - """
87   - # Set parfile name
88   - parfile = self.name+".par"
89   -
90   - try:
91   - pars = GApplicationPars(parfile)
92   - except:
93   - # Signal if parfile was not found
94   - sys.stdout.write("Parfile "+parfile+" not found. Create default parfile.\n")
95   -
96   - # Create default parfile
97   - pars = GApplicationPars()
98   - pars.append(GApplicationPar("srcmdl","f","a","$CTOOLS/share/models/crab.xml","","","Source model"))
99   - pars.append(GApplicationPar("outfile","f","a","pull.dat","","","Output file name"))
100   - pars.append(GApplicationPar("ntrials","i","a","10","","","Number of trials"))
101   - pars.append(GApplicationPar("caldb","s","h","","","","Calibration database"))
102   - pars.append(GApplicationPar("irf","s","a","cta_dummy_irf","","","Instrument response function"))
103   - pars.append(GApplicationPar("edisp","b","h","no","","","Apply energy dispersion?"))
104   - pars.append(GApplicationPar("ra","r","a","83.6331","0","360","RA of pointing (deg)"))
105   - pars.append(GApplicationPar("dec","r","a","22.0145","-90","90","Dec of pointing (deg)"))
106   - pars.append(GApplicationPar("emin","r","a","0.1","0.0","","Lower energy limit (TeV)"))
107   - pars.append(GApplicationPar("emax","r","a","100.0","0.0","","Upper energy limit (TeV)"))
108   - pars.append(GApplicationPar("enumbins","i","a","0","","","Number of energy bins (0=unbinned)"))
109   - pars.append(GApplicationPar("duration","r","a","180000.0","","","Effective exposure time (s)"))
110   - pars.append(GApplicationPar("deadc","r","h","0.95","","","Deadtime correction factor"))
111   - pars.append(GApplicationPar("rad","r","h","5.0","","","Radius of ROI (deg)"))
112   - pars.append(GApplicationPar("npix","i","h","200","","","Number of pixels for binned"))
113   - pars.append(GApplicationPar("binsz","r","h","0.05","","","Pixel size for binned (deg/pixel)"))
114   - pars.append_standard()
115   - pars.save(parfile)
116   -
117   - # Return
118   - return
119   -
120   - def get_parameters(self):
121   - """
122   - Get parameters from parfile and setup the observation.
123   - """
124   - # Get parameters
125   - if self.model == None:
126   - self.m_srcmdl = self["srcmdl"].filename()
127   - self.m_outfile = self["outfile"].filename()
128   - self.m_ntrials = self["ntrials"].integer()
129   - self.m_caldb = self["caldb"].string()
130   - self.m_irf = self["irf"].string()
131   - self.m_edisp = self["edisp"].boolean()
132   - self.m_ra = self["ra"].real()
133   - self.m_dec = self["dec"].real()
134   - self.m_emin = self["emin"].real()
135   - self.m_emax = self["emax"].real()
136   - self.m_enumbins = self["enumbins"].integer()
137   - self.m_duration = self["duration"].real()
138   - self.m_deadc = self["deadc"].real()
139   - self.m_rad = self["rad"].real()
140   - self.m_npix = self["npix"].integer()
141   - self.m_binsz = self["binsz"].real()
142   -=======
143 81 def parfile(self):
144 82 """
145 83 Check if parfile exists. If parfile does not exist then create a
... ... @@ -156,11 +94,12 @@ class cspull(GApplication):
156 94  
157 95 # Create default parfile
158 96 pars = GApplicationPars()
159   - pars.append(GApplicationPar("srcmdl","f","a","$GAMMALIB/share/models/crab.xml","","","Source model"))
  97 + pars.append(GApplicationPar("srcmdl","f","a","$CTOOLS/share/models/crab.xml","","","Source model"))
160 98 pars.append(GApplicationPar("outfile","f","a","pull.dat","","","Output file name"))
161 99 pars.append(GApplicationPar("ntrials","i","a","10","","","Number of trials"))
162 100 pars.append(GApplicationPar("caldb","s","h","","","","Calibration database"))
163 101 pars.append(GApplicationPar("irf","s","a","cta_dummy_irf","","","Instrument response function"))
  102 + pars.append(GApplicationPar("edisp","b","h","no","","","Apply energy dispersion?"))
164 103 pars.append(GApplicationPar("ra","r","a","83.6331","0","360","RA of pointing (deg)"))
165 104 pars.append(GApplicationPar("dec","r","a","22.0145","-90","90","Dec of pointing (deg)"))
166 105 pars.append(GApplicationPar("emin","r","a","0.1","0.0","","Lower energy limit (TeV)"))
... ... @@ -188,6 +127,7 @@ class cspull(GApplication):
188 127 self.m_ntrials = self["ntrials"].integer()
189 128 self.m_caldb = self["caldb"].string()
190 129 self.m_irf = self["irf"].string()
  130 + self.m_edisp = self["edisp"].boolean()
191 131 self.m_ra = self["ra"].real()
192 132 self.m_dec = self["dec"].real()
193 133 self.m_emin = self["emin"].real()
... ... @@ -198,7 +138,6 @@ class cspull(GApplication):
198 138 self.m_rad = self["rad"].real()
199 139 self.m_npix = self["npix"].integer()
200 140 self.m_binsz = self["binsz"].real()
201   ->>>>>>> 00-07-02
202 141  
203 142 # Set some fixed parameters
204 143 self.m_log = False # Logging in client tools
... ... @@ -325,24 +264,14 @@ class cspull(GApplication):
325 264 if self.logExplicit():
326 265 self.log.header2("Trial "+str(seed+1))
327 266  
328   -<<<<<<< HEAD
329   - # Simulate events
330   - obs = obsutils.sim(self.obs, \
331   - nbins=self.m_enumbins, \
332   - seed=seed, \
333   - binsz=self.m_binsz, \
334   - npix=self.m_npix, \
335   - edisp=self.m_edisp, \
336   - log=self.m_log, debug=self.m_debug)
337   -=======
338 267 # Simulate events
339 268 obs = obsutils.sim(self.obs, \
340 269 nbins=self.m_enumbins, \
341 270 seed=seed, \
342 271 binsz=self.m_binsz, \
343 272 npix=self.m_npix, \
  273 + edisp=self.m_edisp, \
344 274 log=self.m_log, debug=self.m_debug)
345   ->>>>>>> 00-07-02
346 275  
347 276 # Determine number of events in simulation
348 277 nevents = 0.0
... ... @@ -356,14 +285,9 @@ class cspull(GApplication):
356 285 self.log(nevents)
357 286 self.log("\n")
358 287  
359   -<<<<<<< HEAD
360   - # Fit model
361   - like = obsutils.fit(obs, edisp=self.m_edisp, \
362   - log=self.m_log, debug=self.m_debug)
363   -=======
364 288 # Fit model
365   - like = obsutils.fit(obs, log=self.m_log, debug=self.m_debug)
366   ->>>>>>> 00-07-02
  289 + like = obsutils.fit(obs, edisp=self.m_edisp, \
  290 + log=self.m_log, debug=self.m_debug)
367 291  
368 292 # Store results
369 293 logL = like.opt().value()
... ...