emission.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:fg21sim 作者: liweitianux 项目源码 文件源码
def _interp_sync_kernel(xmin=1e-3, xmax=10.0, xsample=256):
    """
    Sample the synchrotron kernel function at the specified X
    positions and make an interpolation, to optimize the speed
    when invoked to calculate the synchrotron emissivity.

    WARNING
    -------
    Do NOT simply bound the synchrotron kernel within the specified
    [xmin, xmax] range, since it decreases as a power law of index
    1/3 at the left end, and decreases exponentially at the right end.
    Bounding it with interpolation will cause the synchrotron emissivity
    been *overestimated* on the higher frequencies.

    Parameters
    ----------
    xmin, xmax : float, optional
        The lower and upper cuts for the kernel function.
        Default: [1e-3, 10.0]
    xsample : int, optional
        Number of samples within [xmin, xmax] used to do interpolation.

    Returns
    -------
    F_interp : function
        The interpolated kernel function ``F(x)``.
    """
    xx = np.logspace(np.log10(xmin), np.log10(xmax), num=xsample)
    Fxx = [xp * integrate.quad(lambda t: scipy.special.kv(5/3, t),
                               a=xp, b=np.inf)[0]
           for xp in xx]
    F_interp = interpolate.interp1d(xx, Fxx, kind="quadratic",
                                    bounds_error=True, assume_sorted=True)
    return F_interp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号