Python astropy.units 模块,quantity_input() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用astropy.units.quantity_input()

项目:whoseline    作者:bmorris3    | 项目源码 | 文件源码
def __init__(self, wavelength, species, priority):
        """
        Parameters
        ----------
        wavelength : `~astropy.units.Quantity`
        species : `~numpy.ndarray`
        priority : `~numpy.ndarray`
        """
        self.wavelength = wavelength
        self.species = species
        self.priority = priority

    # @classmethod
    # @u.quantity_input(wavelength_min=u.Angstrom, wavelength_max=u.Angstrom)
    # def from_mock(cls, wavelength_min, wavelength_max):
    #     """
    #
    #     >>> from whoseline import LineList
    #     >>> import astropy.units as u
    #     >>> l = LineList.from_mock(3000*u.Angstrom, 4000*u.Angstrom)
    #     """
    #     from astropy.io import ascii
    #
    #     table = ascii.read(mock_data_path)
    #
    #     in_wavelength_bounds = ((table['wavelengths']*u.Angstrom < wavelength_max) &
    #                             (table['wavelengths']*u.Angstrom > wavelength_min))
    #
    #     return cls(wavelength=table['wavelengths'][in_wavelength_bounds].data * u.Angstrom,
    #                species=table['species'][in_wavelength_bounds].data,
    #                priority=table['strengths'][in_wavelength_bounds].data)