take pointing direction from event to plot the theta2 distribution
@@ -653,7 +653,7 @@ class EventList(object):
return ax
- def plot_theta2_distribution(self, ax=None, number_bins=50, pointing_radec=None):
+ def plot_theta2_distribution(self, ax=None, number_bins=50):
"""Plot the theta2 distribution of the events.
A pointing direction can be given in the same units as the event list as (ra,dec).
If None is given, the average of incoming directions of the events is taken.
@@ -678,14 +678,8 @@ class EventList(object):
events_ra = self.table[:]['RA']
events_dec = self.table[:]['DEC']
- if pointing_radec != None:
- assert len(pointing)==2, "Pointing must be a tuple of length equals 2"
- pointing_ra = pointing_radec[0]
- pointing_dec = pointing_radec[1]
-
- else:
- pointing_ra = events_ra.mean()
- pointing_dec = events_dec.mean()
+ pointing_ra = self.pointing_radec.ra.value
+ pointing_dec = self.pointing_radec.dec.value
theta2 = (events_ra - pointing_ra)**2 + (events_dec - pointing_dec)**2
