import numpy as np

# # blind A
# # Z_Bbin sigma_e neff
# # Flag_SOM_Fid
# 0.1<ZB<=0.3 0.27085526185463465 0.6141903412434272
# 0.3<ZB<=0.5 0.260789170603278 1.1714443526924525
# 0.5<ZB<=0.7 0.27664489739710685 1.8306617593091257
# 0.7<ZB<=0.9 0.2616226704859973 1.2340324684694277
# 0.9<ZB<=1.2 0.2818628832701304 1.2777696421274052

# # blind B
# # Z_Bbin sigma_e neff
# # Flag_SOM_Fid
# 0.1<ZB<=0.3 0.26842505878253875 0.6187082608962824
# 0.3<ZB<=0.5 0.25501768080905934 1.1942152882679087
# 0.5<ZB<=0.7 0.2684949317660632 1.8820489105766731
# 0.7<ZB<=0.9 0.24635057301164487 1.2898847904777375
# 0.9<ZB<=1.2 0.2588042476903187 1.3531528640732855

# # blind C
# # Z_Bbin sigma_e neff
# # Flag_SOM_Fid
# 0.1<ZB<=0.3 0.2696215956290229 0.6163756250182619
# 0.3<ZB<=0.5 0.25788498381059144 1.1821211132939125
# 0.5<ZB<=0.7 0.2725868234515691 1.8541025952232577
# 0.7<ZB<=0.9 0.25393725942022516 1.259196379102648
# 0.9<ZB<=1.2 0.2702738432562588 1.3108755093653546


ngal_A_in=np.asarray([0.6141903412434272,
					  1.1714443526924525,
					  1.8306617593091257,
					  1.2340324684694277,
					  1.2777696421274052])

ngal_B_in=np.asarray([0.6187082608962824,
					  1.1942152882679087,
					  1.8820489105766731,
					  1.2898847904777375,
					  1.3531528640732855])

ngal_C_in=np.asarray([0.6163756250182619,
					  1.1821211132939125,
					  1.8541025952232577,
					  1.259196379102648,
					  1.3108755093653546])

area_omegacam    = 777.406
area_healpix4096 = 866.924


ngal_A = ngal_A_in*area_omegacam/area_healpix4096
ngal_B = ngal_B_in*area_omegacam/area_healpix4096
ngal_C = ngal_C_in*area_omegacam/area_healpix4096


np.savetxt('ngal_blindA.ascii',ngal_A.reshape(1,len(ngal_A)),fmt='%1.8f')
np.savetxt('ngal_blindB.ascii',ngal_B.reshape(1,len(ngal_B)),fmt='%1.8f')
np.savetxt('ngal_blindC.ascii',ngal_C.reshape(1,len(ngal_C)),fmt='%1.8f')


sigma_e_A=np.asarray([0.27085526185463465,
					  0.260789170603278,
					  0.27664489739710685,
					  0.2616226704859973, 
					  0.2818628832701304])

sigma_e_B=np.asarray([0.26842505878253875,
					  0.25501768080905934,
					  0.2684949317660632,
					  0.24635057301164487,
					  0.2588042476903187])

sigma_e_C=np.asarray([0.2696215956290229,
					  0.25788498381059144,
					  0.2725868234515691,
					  0.25393725942022516,
					  0.2702738432562588])

np.savetxt('../ellipticity_dispersion/sigma_e_blindA.ascii',sigma_e_A.reshape(1,len(sigma_e_A)),fmt='%1.8f')
np.savetxt('../ellipticity_dispersion/sigma_e_blindB.ascii',sigma_e_B.reshape(1,len(sigma_e_B)),fmt='%1.8f')
np.savetxt('../ellipticity_dispersion/sigma_e_blindC.ascii',sigma_e_C.reshape(1,len(sigma_e_C)),fmt='%1.8f')


# old values with wrong zbin edges
# ngal_A_in=np.asarray([0.5696062756935643, 1.1420051774183186, 1.820071990524645, 1.257355966105446, 1.3150376529887304])
# ngal_B_in=np.asarray([0.5738808446605536, 1.1635165129209137, 1.870408698085444, 1.312215197103098, 1.3923624557726593])
# ngal_C_in=np.asarray([0.5716711629725594, 1.1520993491907465, 1.843051137595057, 1.282128974674171, 1.3490061651057792])


# old values with wrong zbin edges:
# sigma_e_a=[ 0.271501816130848, 0.2615574190604257, 0.2754555314207977, 0.2625519982871117, 0.2812947994992024]
# sigma_e_b=[ 0.269029592008083, 0.2559736564818429, 0.2674527764112131, 0.2480196700309332, 0.2583321479620859] 
# sigma_e_c=[ 0.270247406769942, 0.2587478515919105, 0.2714697072625222, 0.2552422429840755, 0.2697528938767397]



