integrate_pdm
- zdm.pcosmic.integrate_pdm(ddm, ndm, logmean, logsigma, quick=True, plot=False)[source]
Discretize a lognormal DM distribution onto histogram bins.
Converts a continuous lognormal probability distribution into discrete bin probabilities for use in convolution operations. Two methods are available: fast (evaluate at bin centers) and slow (integrate each bin).
- Parameters:
ddm (float) – Bin spacing in pc/cm^3.
ndm (int) – Number of DM bins. Bins span [0, ndm*ddm] with first bin [0, 0.5*ddm].
logmean (float) – Mean of the lognormal distribution in natural log space.
logsigma (float) – Standard deviation in natural log space.
quick (bool, optional) – If True (default), use fast method evaluating at bin centers. If False, integrate over each bin (slower but more accurate).
plot (bool, optional) – If True, generate comparison plot of quick vs slow methods and exit. Default is False.
- Returns:
Array of shape (ndm,) containing probability mass in each bin. Not normalized; caller should normalize if needed.
- Return type:
ndarray