collections.py 文件源码

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

项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码
def dust_temperature_and_mass_from_grey_body_fit(self, fluxtype='limited'):
        # get the Herschel 160, 250, 350, 500 wavelengths
        waves = np.array( [ Filter(fs).pivotwavelength() for fs in ("Pacs.red","SPIRE.PSW","SPIRE.PMW","SPIRE.PLW")] )
        sigmas = np.array(( 3,1,1,3 ))      # pacs is less sensitive; longer wavelength fluxes are harder to measure

        # get the Herschel 160, 250, 350, 500 datapoints
        fluxstring = '''[ self.instr_fluxdensity_pacs_red_{0}, self.instr_fluxdensity_spire_psw_{0},
                          self.instr_fluxdensity_spire_pmw_{0}, self.instr_fluxdensity_spire_plw_{0} ]'''.format(fluxtype)
        fluxes = eval(fluxstring)

        # setup an iterator over the galaxies, specifying two to-be-allocated output arrays for T and M
        it = np.nditer([None, None, self.setup_distance_instrument] + fluxes,
                       op_flags = [['writeonly','allocate'],['writeonly','allocate'],['readonly'],
                                   ['readonly'], ['readonly'], ['readonly'], ['readonly']])

        # do the fit, iterating over the galaxies
        for Ti,Mi,di,f160i,f250i,f350i,f500i in it:
            greybody = GreyBody(di, 2, kappa350_Cortese)
            #greybody = GreyBody(di, 2, kappa350_Zubko)
            it[0],it[1] = greybody.fit(waves, (f160i,f250i,f350i,f500i), sigmas)

        # return the two result arrays T and M allocated by the iterator
        return it.operands[0:2]

    ## This function returns dust temperature (in K) for best fit with Herschel 160, 250, 350, 500 data points
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号