Test reduction and error from ELR propositions

This commit is contained in:
Thibault Barnouin
2021-06-03 16:19:55 +02:00
parent c1b0fead8a
commit 26fc1eb668
46 changed files with 1965 additions and 20 deletions

View File

@@ -660,8 +660,8 @@ def align_data(data_array, error_array=None, upsample_factor=1., ref_data=None,
full_array = np.concatenate((data_array,[ref_data]),axis=0)
err_array = np.concatenate((error_array,[np.zeros(ref_data.shape)]),axis=0)
full_array, err_array = crop_array(full_array, err_array, step=5,
inside=False)
#full_array, err_array = crop_array(full_array, err_array, step=5,
# inside=False)
data_array, ref_data = full_array[:-1], full_array[-1]
error_array = err_array[:-1]
@@ -1083,9 +1083,10 @@ def compute_pol(I_stokes, Q_stokes, U_stokes, Stokes_cov, headers):
#Compute the total exposure time so that
#I_stokes*exp_tot = N_tot the total number of events
exp_tot = np.array([header['exptime'] for header in headers]).sum()
N_obs = I_stokes/np.array([header['photflam'] for header in headers]).mean()*exp_tot
#Errors on P, PA supposing Poisson noise
s_P_P = np.sqrt(2.)*(I_stokes*exp_tot)**(-0.5)
s_P_P = np.sqrt(2.)*(N_obs)**(-0.5)*100.
s_PA_P = s_P_P/(2.*P/100.)*180./np.pi
return P, debiased_P, s_P, s_P_P, PA, s_PA, s_PA_P