Skip to content

Commit addfabc

Browse files
committed
halpha LF in z thin slice for 1d loss kern
1 parent 534e1dc commit addfabc

1 file changed

Lines changed: 26 additions & 8 deletions

File tree

diffhtwo/experimental/n_mag_opt.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def _loss_kern_1d(
118118
scatter_params,
119119
bin_centers_1d,
120120
dmag,
121-
mag_column,
121+
mag_columns,
122122
mag_thresh_column,
123123
mag_thresh,
124124
fit_columns,
@@ -183,7 +183,7 @@ def _loss_kern_1d(
183183
ssp_err_pop_params,
184184
bin_centers_1d,
185185
dmag,
186-
mag_column,
186+
mag_columns,
187187
mag_thresh_column,
188188
mag_thresh,
189189
cosmo_params,
@@ -219,21 +219,39 @@ def _loss_kern_1d(
219219
fb,
220220
)
221221
halpha_L = dpop_halpha.diffstarpop_halpha_kern(*halpha_args)
222+
223+
halpha_LF_zmin = halpha_LF_z - (halpha_LF_delta_z / 2)
224+
halpha_LF_zmax = halpha_LF_z + (halpha_LF_delta_z / 2)
225+
halpha_LF_z_sel = (lc_z_obs > halpha_LF_zmin) & (lc_z_obs < halpha_LF_zmax)
226+
halpha_LF_z_sel = jnp.float64(halpha_LF_z_sel)
227+
222228
(
223229
_,
224230
halpha_lf_weighted_q,
225231
halpha_lf_weighted_smooth_ms,
226232
halpha_lf_weighted_bursty_ms,
227233
) = dpop_halpha.diffstarpop_halpha_lf_weighted_lc_weighted(
228-
halpha_L, lc_nhalos, sig=0.05, lgL_bin_edges=lg_halpha_Lbin_edges
234+
halpha_L,
235+
lc_nhalos * halpha_LF_z_sel,
236+
sig=0.05,
237+
lgL_bin_edges=lg_halpha_Lbin_edges,
229238
)
230239

231240
halpha_lf_weighted_composite = (
232241
halpha_lf_weighted_q
233242
+ halpha_lf_weighted_smooth_ms
234243
+ halpha_lf_weighted_bursty_ms
235244
)
236-
lg_halpha_LF_model = jnp.log10(halpha_lf_weighted_composite / lc_vol_mpc3)
245+
# take care of bins with low/zero number counts in a similar way to n_mag.get_n_data_err(), using same N_floor and N_0:
246+
N_0 = 1e-12
247+
N_floor = 0.5
248+
halpha_lf_weighted_composite = jnp.where(
249+
halpha_lf_weighted_composite > N_floor, halpha_lf_weighted_composite, N_0
250+
)
251+
252+
lg_halpha_LF_model = jnp.log10(
253+
halpha_lf_weighted_composite / halpha_LF_delta_z_vol_Mpc3
254+
)
237255

238256
loss += _mse_w(
239257
lg_halpha_LF_model,
@@ -269,7 +287,7 @@ def fit_n_1d(
269287
scatter_params,
270288
bin_centers_1d,
271289
dmag,
272-
mag_column,
290+
mag_columns,
273291
mag_thresh_column,
274292
mag_thresh,
275293
fit_columns,
@@ -307,7 +325,7 @@ def fit_n_1d(
307325
scatter_params,
308326
bin_centers_1d,
309327
dmag,
310-
mag_column,
328+
mag_columns,
311329
mag_thresh_column,
312330
mag_thresh,
313331
fit_columns,
@@ -408,7 +426,7 @@ def fit_n_1d_multi_z(
408426
scatter_params,
409427
bin_centers_1d,
410428
dmag,
411-
mag_column,
429+
mag_columns,
412430
mag_thresh_column,
413431
mag_thresh,
414432
fit_columns,
@@ -446,7 +464,7 @@ def fit_n_1d_multi_z(
446464
scatter_params,
447465
bin_centers_1d,
448466
dmag,
449-
mag_column,
467+
mag_columns,
450468
mag_thresh_column,
451469
mag_thresh,
452470
fit_columns,

0 commit comments

Comments
 (0)