frb.dm_kde.transient_kdes
Definitions relating to the observed DM distributions of pulsars and FRBs. Standard KDE is used for pulsars and varying asymmetric KDE for FRBs. To use this code, please download the asymmetric_kde package from https://github.com/tillahoffmann/asymmetric_kde [Hoffman and Jones, 2015]
- frb.dm_kde.transient_kdes.kde_for_frb(grid, dm_frb, num_samples, num_resamples=100, save_to_path=None)[source]
Find FRB KDE and minima
- Parameters:
- Outputs:
- dm_kde (array):
KDEs for observed FRB DM distribution. A sample of size=num_samples is taken from the FRB PDF and then resampled num_resamples times.
- frb_lim (array):
The max gradients of the FRB DM KDEs, corresponding to an lower limit on the MW halo DM
- frb.dm_kde.transient_kdes.kde_for_psr(grid, dm_psr, num_samples, num_resamples=100, min_bandwidth=8, max_bandwidth=15, bandwidth_stepsize=0.1, cv=100, kernel='gaussian', save_to_path=None)[source]
Find pulsar KDE and maxima
- Parameters:
dm_grid (array) – Value of DM values.
dm_psr (array) – PDF of DM_psr.
num_samples (int) – Number of draws from dm_psr
num_resamples (int, optional) – Number of times to resample the draws. Default=100.
min_bandwidth (int, optional) – Minimum bandwidth for cross-validation. Default=8.
max_bandwidth (int, optional) – Maximum bandwidth for cross-validation. Default=15.
bandwidth_stepsize (int, optional) – Bandwidth stepsize. Default=1.
cv (int, optional) – Number of folds for cross-validation. Default=5.
kernel (str, optional) – Kernel to use. Default=’gaussian’
save_to_path (str, optional) – To save data outputs (as .npy), specify path. Default=None.
- Outputs:
- dm_kde (array):
KDEs for observed pulsar DM distribution. A sample of size=num_samples is taken from the FRB PDF and then resampled num_resamples times.
- psr_lim (array):
The max gradients of the pulsar DM KDEs, corresponding to an lower limit on the MW halo DM