Skip to content

Commit 9b9426d

Browse files
authored
Merge pull request #83 from nmdickson/hotfix/numdens-scaling
Hotfix/numdens scaling
2 parents 8104b00 + 519ea46 commit 9b9426d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fitter/probabilities/probabilities.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,15 @@ def likelihood_number_density(model, ndensity, *,
548548
model_Σ = model.Sigmaj[mass_bin] / model.mj[mass_bin]
549549

550550
# Interpolated the model data at the measurement locations
551-
interpolated = np.interp(obs_r, model_r, model_Σ)
551+
interpolated = np.interp(obs_r, model_r, model_Σ).to(obs_Σ.unit)
552552

553553
# Calculate K scaling factor
554554
K = (np.sum(obs_Σ * interpolated / yerr**2)
555555
/ np.sum(interpolated**2 / yerr**2))
556556

557+
if np.isnan(K):
558+
K = 1
559+
557560
interpolated *= K
558561

559562
return likelihood(obs_Σ, interpolated, yerr)

0 commit comments

Comments
 (0)