Hi. I need some help with improving my code. In my study, I’m working on the problem of localizing a radioactive source. The radiation detection device cannot determine which side of the road the radiation originated from, resulting in probable positions for the source on both sides of the road—i.e., a bimodal posterior distribution. To account for this, I implemented a “mirroring” technique for the posterior, which provides suitable results. However, I’m wondering if there might be a smarter way to handle this, perhaps through a custom sampler? Any advice are more than welcome.
with pm.Model() as cps_angl_model:
alpha = pm.Gamma('alpha', mu=10000, sigma=100)
beta = pm.Gamma('beta', mu=100, sigma=10)
x_left = pm.Uniform("x_src_left", lower=LOWER_X, upper=LEFT_X_MIN)
x_right = pm.Uniform("x_src_right", lower=RIGHT_X_MIN, upper=UPPER_X)
y_left = pm.Uniform("y_src_left", lower=LEFT_Y_MIN, upper=UPPER_Y)
y_right = pm.Uniform("y_src_right", lower=LOWER_Y, upper=RIGHT_Y_MIN)
angles_left = tensor_calc_angles(pos_x_tt, pos_y_tt, x_left , y_left)
angles_right = tensor_calc_angles(pos_x_tt, pos_y_tt, x_right, y_right)
eff_rel_left = f_inter_tt(angles_left)
eff_rel_right = f_inter_tt(angles_right)
act = pm.Gamma("act", alpha=alpha, beta=beta, initval=1000)
bkg = pm.Normal("bkg", mu=MEAN_BKG_CPS, sigma=BKG_STD, initval=MEAN_BKG_CPS)
count_rate = mean_angular_cps_tt(pos_x_tt, pos_y_tt, x_left, y_left, act, bkg, eff_rel_left)
count_rate1 = mean_angular_cps_tt(pos_x_tt, pos_y_tt, x_right, y_right, act, bkg, eff_rel_right)
cps_obs = pm.Poisson("cps_obs", mu=count_rate, observed=cps)
cps_obs1 = pm.Poisson("cps_obs_mir", mu=count_rate1, observed=cps)