Skip to content

Commit f26940c

Browse files
committed
take care of bins with low/zero number counts in halpha_lf_weighted_composite with _loos_kern
1 parent bc147a6 commit f26940c

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

‎diffhtwo/experimental/n_mag_opt.py‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,6 @@ def _loss_kern(
552552
fb,
553553
)
554554
halpha_L = dpop_halpha.diffstarpop_halpha_kern(*halpha_args)
555-
print("halpha_L:{}", halpha_L)
556555
(
557556
_,
558557
halpha_lf_weighted_q,
@@ -567,19 +566,16 @@ def _loss_kern(
567566
+ halpha_lf_weighted_smooth_ms
568567
+ halpha_lf_weighted_bursty_ms
569568
)
570-
print("halpha_lf_weighted_composite:{}", halpha_lf_weighted_composite)
571-
lg_halpha_LF_model = jnp.log10(halpha_lf_weighted_composite / lc_vol_mpc3)
572569

573-
print(
574-
"halpha_loss:{}",
575-
_mse_w(
576-
lg_halpha_LF_model,
577-
lg_halpha_LF_target[0],
578-
lg_halpha_LF_target[1],
579-
lg_n_thresh,
580-
),
570+
# 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:
571+
N_0 = 1e-12
572+
N_floor = 0.5
573+
halpha_lf_weighted_composite = jnp.where(
574+
halpha_lf_weighted_composite > N_floor, halpha_lf_weighted_composite, N_0
581575
)
582576

577+
lg_halpha_LF_model = jnp.log10(halpha_lf_weighted_composite / lc_vol_mpc3)
578+
583579
loss += _mse_w(
584580
lg_halpha_LF_model,
585581
lg_halpha_LF_target[0],

0 commit comments

Comments
 (0)