synthetic_photometry.py 文件源码

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

项目:gullikson-scripts 作者: kgullikson88 项目源码 文件源码
def __init__(self, filt, T_low=3500, T_high=12000, dT=10, feh=0.0):
        """
        Initialize a CompanionFitter instance. It will pre-tabulate
        synthetic photometry for main-sequence stars with Temperatures
        ranging from T_low to T_high, in steps of dT K. All the
        models will have [Fe/H] = feh. Finally, we will interpolate
        the relationship between temperature and magnitude so that
        additional photometry points are made quickly.

        Parameters:
        ===========
        - filt:               A pysynphot bandpass encoding the filter information.

        - T_low, T_high, dT:  floats
                              Parameters describing the temperature grid
                              to interpolate

        -feh:                 float
                              The metallicity [Fe/H] to use for the models
        """
        # Use the Mamajek table to get main-sequence relationships
        MT = Mamajek_Table.MamajekTable()
        MT.mam_df['radius'] = 10**(0.5*MT.mam_df.logL - 2.0*MT.mam_df.logT + 2.0*3.762)
        MT.mam_df['logg'] = 4.44 + np.log10(MT.mam_df.Msun) - 2.0*np.log10(MT.mam_df.radius)
        teff2radius = MT.get_interpolator('Teff', 'radius')
        teff2logg = MT.get_interpolator('Teff', 'logg')

        # Pre-calculate the magnitude at each temperature
        self.temperature = np.arange(T_low, T_high, dT)
        self.magnitude = np.zeros(self.temperature.size)
        for i, T in enumerate(self.temperature):
            logging.info('i = {}/{}: T = {:.1f}'.format(i+1, self.temperature.size, T))
            logg = teff2logg(T)
            R = teff2radius(T)
            spec = pysynphot.Icat('ck04models', T, feh, logg) * R**2
            obs = pysynphot.Observation(spec, filt)
            self.magnitude[i] = obs.effstim('abmag')

        # Interpolate the T-mag curve
        self.interpolator = spline(self.temperature, self.magnitude)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号