Skip to content

Commit 0b5ec0e

Browse files
authored
updated codes 2
1 parent 642f9d6 commit 0b5ec0e

4 files changed

+21
-23
lines changed

SIMGEN_NEFF_YPIPELINE_SEO1.input

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
SIMLIB_FILE: $SNDATA_ROOT/INTERNAL/DES/simlibs/DES_DIFFIMG.SIMLIB
33
#SOLID_ANGLE: 0.00913851 # 6 sq deg (steridian) for deep field + 24 sq deg (steridian) for shallow
44
SIMLIB_FIELDLIST: X3+C3+E1+E2+S1+S2+C1+C2+X1+X2 #all DES fields, should include solid angle inside
5-
NGEN_SEASON: 3.0 # 3 seasons
5+
NGEN_SEASON: 1.0 # 1 to make it faster 3 seasons
66

77
# ----------------- sim setup ---------------
88
GENVERSION: AMDES_NEFF_YPIPELINE_SEO1 # SNDATA version to generate
@@ -78,8 +78,8 @@ CUTWIN_T0GAPMAX: 0 20.
7878
NEWMJD_DIF: 0.4 #days. Ensures multiple epochs needed for trigger
7979

8080
# cosmological params for lightcurve generation and redshift distribution
81-
OMEGA_MATTER: 0.27
82-
OMEGA_LAMBDA: 0.73
81+
OMEGA_MATTER: 0.295
82+
OMEGA_LAMBDA: 0.705
8383
W0_LAMBDA: -1.00
8484
H0: 70.0
8585

do_emcee_fit_sigmoid.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ def log_posterior(theta, x, y):
128128
samples = sampler.chain[:, nburn:, :].reshape((-1, ndim))
129129
plot_MCMC_results(xdata, ydata, samples)
130130

131-
import corner
132-
plt.clf()
133-
fig = corner.corner(samples, labels=list_key,quantiles=[0.5],bins=50)
134-
fig.savefig(path_to_save+'/triangle_' + filt + ".png")
131+
# import corner
132+
# plt.clf()
133+
# fig = corner.corner(samples, labels=list_key,quantiles=[0.5],bins=50)
134+
# fig.savefig(path_to_save+'/triangle_' + filt + ".png")
135135

136136
A_mcmc, alpha_mcmc, beta_mcmc = map(lambda v: (v[1], v[2] - v[1], v[1] - v[0]),
137137
zip(*np.percentile(samples, [16, 50, 84],

do_selection_function.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@
1515
debugging=False
1616

1717
#______LOAD DATA AND SIM, AND APPLY CUTS
18-
data_ori = pd.read_csv('../../../data_and_sim/DESALL_fitted_myself/FITOPT000.FITRES',
18+
data_ori = pd.read_csv('../../../data_and_sim/SMP_SPEC_v1/FITOPT000.FITRES',
1919
index_col=False, comment='#',delimiter=' ')
20+
# print data_ori
21+
2022
tmp = data_ori[(data_ori['c'] > -0.3) & (data_ori['c'] < 0.3) & (data_ori['x1'] > -3) & (data_ori['x1']
2123
< 3) & (data_ori['z'] > 0.05) & (data_ori['z'] < 0.9) & (data_ori['FITPROB'] > 1E-05)]
2224
tmp2 = tmp[tmp.columns.values[:-1]]
2325
#Selecting type Ias!
24-
data=tmp2[tmp2['TYPE']==1]
26+
# data=tmp2[tmp2['TYPE']==1]
27+
#with SMP we don't have this issue
28+
data = tmp2
2529

26-
sim = pd.read_csv('../sim/NEFF/FITOPT000.FITRES',
30+
sim = pd.read_csv('FITOPT000.FITRES',
2731
index_col=False, comment='#', delimiter=' ')
2832
tmp2 = sim[(sim['c'] > -0.3) & (sim['c'] < 0.3) & (sim['x1'] > -3) & (sim['x1'] < 3)
2933
& (sim['z'] > 0.05) & (sim['z'] < 0.9) & (sim['FITPROB'] > 1E-05)]
@@ -59,12 +63,12 @@ def initial_plots(norm_bin):
5963
err_sim = []
6064
for ibin in range(nbins - 1):
6165
# data
62-
bin_elements_dat = np.take(data[var],np.where(
66+
bin_elements_dat = np.take(data[var].values,np.where(
6367
index_of_bin_belonging_to_dat == ibin)[0])
6468
error_dat = np.sqrt(len(bin_elements_dat))
6569
err_dat.append(error_dat)
6670
# sim
67-
bin_elements_sim = np.take(sim[var],np.where(index_of_bin_belonging_to_sim == ibin)[0])
71+
bin_elements_sim = np.take(sim[var].values,np.where(index_of_bin_belonging_to_sim == ibin)[0])
6872
error_sim = np.sqrt(len(bin_elements_sim))
6973
err_sim.append(error_sim)
7074
del bin_elements_sim, bin_elements_dat
@@ -149,15 +153,16 @@ def plots_vs_z():
149153
z_bins_plot=np.arange(min_z+half_z_bin_step,max_z-half_z_bin_step,z_bin_step)
150154
color_dic={'data':'red','sim':'blue'}
151155

152-
Mb_arr=np.ones(len(z_bins)-1)*(19.4)
156+
Mb=19.05
157+
Mb_arr=np.ones(len(z_bins)-1)*(Mb)
153158
alpha=0.144 #from sim
154159
beta=3.1
155160

156161
#Bias correction
157162
mean_mu_arr=[]
158163
mean_z_arr=[]
159164
err_mu_arr=[]
160-
sim['new_mu']=np.array(sim['mB'])+19.38+np.array(alpha*sim['x1'])-np.array(beta*sim['c'])-np.array(dist_mu(sim['z']))
165+
sim['new_mu']=np.array(sim['mB'])+Mb+np.array(alpha*sim['x1'])-np.array(beta*sim['c'])-np.array(dist_mu(sim['z']))
161166
for i, z_bin in enumerate(z_bins[:-1]):
162167
binned_indices=sim[(sim['z'] >= z_bin) & (sim['z'] < z_bins[i + 1])].index.tolist()
163168
binned_mu=sim['new_mu'][binned_indices]
@@ -170,7 +175,7 @@ def plots_vs_z():
170175
plt.errorbar(mean_z_arr,mean_mu_arr,yerr=np.array(err_mu_arr),fmt='o')
171176
plt.xlabel('z')
172177
plt.ylabel('bias correction')
173-
plt.title('mB+19.38+alpha*x1-beta*c-dist_mu(z)')
178+
plt.title('mB+%s+alpha*x1-beta*c-dist_mu(z)'%Mb)
174179
plt.savefig('%s/bias.png'%path_to_save)
175180
del fig
176181

mu_cosmo.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
def dist_mu(redshift):
77
mu = cosmo.distmod(redshift)
8-
# mu = cosmo.luminosity_distance(redshift)
8+
99
return mu.value
1010

1111
if __name__ == "__main__":
@@ -16,10 +16,3 @@ def dist_mu(redshift):
1616
redshift = float(args.z)
1717

1818
dist_mu(redshift)
19-
20-
# import cosmolopy.distance as cd
21-
# cosmo = {'omega_M_0':0.295, 'omega_lambda_0':0.705, 'omega_k_0':0.0, 'h':0.70}
22-
# cosmo = cd.set_omega_k_0(cosmo)
23-
# def dist_mu2(redshift):
24-
# mu = cd.luminosity_distance(redshift)
25-
# return mu.value

0 commit comments

Comments
 (0)