213 Select observation in a pointing box
217 obs : `~gammalib.GCTAObservation`
223 Observation selection flag
227 msg =
'outside selection box'
230 coordsys = self[
'coordsys'].string()
233 pnt = obs.pointing().dir()
236 width = self[
'width'].real()
237 height = self[
'height'].real()
240 if coordsys ==
'CEL':
243 ra = self[
'ra'].real()
244 dec = self[
'dec'].real()
245 ra_min = ra - 0.5 * width
246 ra_max = ra + 0.5 * width
247 dec_min = dec - 0.5 * height
248 dec_max = dec + 0.5 * height
253 ra_minus = ra - 360.0
255 if dec >= dec_min
and dec <= dec_max:
256 if ra >= ra_min
and ra <= ra_max
or \
257 ra_plus >= ra_min
and ra_plus <= ra_max
or \
258 ra_minus >= ra_min
and ra_minus <= ra_max:
260 msg =
'inside selection box'
266 glon = self[
'glon'].real()
267 glat = self[
'glat'].real()
268 glon_min = glon - 0.5 * width
269 glon_max = glon + 0.5 * width
270 glat_min = glat - 0.5 * height
271 glat_max = glat + 0.5 * height
275 glon_plus = glon + 360.0
276 glon_minus = glon - 360.0
278 if glat >= glat_min
and glat <= glat_max:
279 if glon >= glon_min
and glon <= glon_max
or \
280 glon_plus >= glon_min
and glon_plus <= glon_max
or \
281 glon_minus >= glon_min
and glon_minus <= glon_max:
283 msg =
'inside selection box'
301 selected_obs = gammalib.GObservations()
304 selected_obs.models(self.obs().models())
307 self._log_observations(gammalib.NORMAL, self.obs(),
'Input observation')
310 self._log_header1(gammalib.TERSE,
'Observation selection')
313 for obs
in self.obs():
317 selected_obs.append(obs)
320 self.obs(selected_obs)
323 self._log_observations(gammalib.NORMAL, self.obs(),
'Selected observation')