Skip to content

Commit

Permalink
finished draft, to be checked
Browse files Browse the repository at this point in the history
  • Loading branch information
nmik committed Jan 2, 2025
1 parent 1b846d6 commit 0c0dd20
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cosipy/polarization/polarization_stokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def calculate_mdp(self, total_num_events, mu, bkg_rate=22.0):
return MDP99


def calculate_polarization(self, qs, us, qs_unpol, us_unpol, mu, show=False, ref_qu=(None, None), ref_pdpa=(None, None), ref_label=None):
def calculate_polarization(self, qs, us, qs_unpol, us_unpol, mu, show=False, ref_qu=(None, None), ref_pdpa=(None, None), ref_label=None, mdp=None):
"""
Calculate the polarization degree (PD), polarization angle (PA),
and their associated 1-sigma uncertainties given Q and U measurements
Expand Down Expand Up @@ -629,6 +629,9 @@ def calculate_polarization(self, qs, us, qs_unpol, us_unpol, mu, show=False, ref
ref_u = ref_pdpa[0] * np.sin(2*ref_pdpa[1])
plt.plot(ref_q, ref_u, 'x', markersize=20, color='tab:green')
plt.annotate(ref_label, (ref_q, ref_u), textcoords="offset points", xytext=(0,10), ha='center', color='tab:green', fontsize=12)
if mdp != None:
c_mdp = plt.Circle((0, 0), radius=mdp, facecolor='tab:red', alpha=0.3, linewidth=1, linestyle='--', label='MDP')
plt.gca().add_artist(c_mdp)

plt.plot(Q, U, 'o', markersize=5, color='red',label='Measured')
pol_c = plt.Circle((Q, U), radius=polarization_fraction_uncertainty, facecolor='none', edgecolor='red', linewidth=1, label='Polarized source')
Expand Down

0 comments on commit 0c0dd20

Please sign in to comment.