licks.py 文件源码

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

项目:pyphot 作者: mfouesneau 项目源码 文件源码
def _get_indice(cls, w, flux, blue, red, band=None, unit='ew', degree=1,
                    **kwargs):
        """ compute spectral index after continuum subtraction

        Parameters
        ----------
        w: ndarray (nw, )
            array of wavelengths in AA
        flux: ndarray (N, nw)
            array of flux values for different spectra in the series
        blue: tuple(2)
            selection for blue continuum estimate
        red: tuple(2)
            selection for red continuum estimate
        band: tuple(2), optional
            select region in this band only.
            default is band = (min(blue), max(red))
        unit: str
            `ew` or `mag` wether equivalent width or magnitude
        degree: int (default 1)
            degree of the polynomial fit to the continuum

        Returns
        -------
        ew: ndarray (N,)
            equivalent width array
        """
        wi, fi = cls.continuum_normalized_region_around_line(w, flux, blue,
                                                             red, band=band,
                                                             degree=degree)
        if unit in (0, 'ew', 'EW'):
            return np.trapz(1. - fi, wi, axis=-1)
        else:
            m = np.trapz(fi, wi, axis=-1)
            m = -2.5 * np.log10(m / np.ptp(wi))
            return m
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号