53 Get parameters from parfile
56 if self.obs().size() == 0:
60 if self[
'inobs'].is_valid():
61 self.obs(gammalib.GObservations(self[
'inobs'].filename()))
63 cta = gammalib.GCTAObservation()
64 mission = gammalib.tolower(self[
'instrument'].string())
65 caldb = gammalib.GCaldb(mission, self[
'caldb'].string())
66 rsp = gammalib.GCTAResponseIrf(self[
'irf'].string(), caldb)
67 cta.instrument(mission)
69 self.obs().append(cta)
74 self[
'aeffthres'].real()
75 self[
'bkgthres'].real()
78 if self._read_ahead():
79 self[
'outfile'].filename()
82 self._log_parameters(gammalib.TERSE)
89 Set energy boundaries for one CTA observation
93 responses : list of dict
94 List of response dictionaries
96 Energy to insert (TeV)
98 Reason for energy insertion
101 logE = math.log10(energy)
102 for rsp
in responses:
103 rsp[
'thres'] = rsp[
'irf'](logE, 0.0, 0.0)
106 eng = gammalib.GEnergy(energy,
'TeV')
109 msg = str(energy)+
' TeV'
111 msg +=
' ('+comment+
')'
121 self._log_value(gammalib.NORMAL,
'First boundary', msg)
137 self._log_value(gammalib.NORMAL,
'Boundary', msg)
147 self._log_value(gammalib.NORMAL,
'Boundary', msg)
154 Set energy boundaries for one CTA observation
158 obs : `~gammalib.GObservations`
162 emin = self[
'emin'].real()
163 emax = self[
'emax'].real()
164 aeffthres = self[
'aeffthres'].real()
165 bkgthres = self[
'bkgthres'].real()
174 mission = run.response().caldb().mission()
175 instrument = run.response().caldb().instrument()
176 rspname = run.response().rspname()
177 name =
'%s::%s::%s' % (mission, instrument, rspname)
181 for rsp
in responses:
182 if rsp[
'name'] == name:
189 aeff = {
'name': name,
'type':
'Aeff',
190 'irf': run.response().aeff(),
'thres': 0.0}
191 bkg = {
'name': name,
'type':
'Background',
192 'irf': run.response().background(),
'thres': 0.0}
193 responses.append(aeff)
194 responses.append(bkg)
197 self._log_value(gammalib.NORMAL,
'Append response',
'%s (%s) [%s]' %
198 (rspname, instrument, mission))
201 logEs = [math.log10(1.0e-3*float(i))
for i
in range(int(emin*1000),int(emax*1000))]
207 for rsp
in responses:
210 irf = rsp[
'irf'](logE, 0.0, 0.0)
213 if rsp[
'type'] ==
'Aeff':
214 threshold = aeffthres
220 if rsp[
'thres'] == 0.0
and irf > 0.0:
226 elif rsp[
'thres'] != 0.0:
228 if 1.0-f > threshold
or f-1.0 > threshold:
236 self._log_value(gammalib.NORMAL,
'Number of boundaries', self.
_ebounds.size())