本文整理汇总了Python中JLA_library.compute_extinction_offset方法的典型用法代码示例。如果您正苦于以下问题:Python JLA_library.compute_extinction_offset方法的具体用法?Python JLA_library.compute_extinction_offset怎么用?Python JLA_library.compute_extinction_offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JLA_library
的用法示例。
在下文中一共展示了JLA_library.compute_extinction_offset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compute_dust
# 需要导入模块: import JLA_library [as 别名]
# 或者: from JLA_library import compute_extinction_offset [as 别名]
def compute_dust(options):
"""Python program to compute C_dust
"""
import numpy
import astropy.io.fits as fits
import os
import JLA_library as JLA
# ---------- Read in the SNe list -------------------------
SNelist = numpy.genfromtxt(options.SNlist,
usecols=(0, 2),
dtype='S30,S110',
names=['id', 'lc'])
for i, SN in enumerate(SNelist):
SNelist['id'][i] = SNelist['id'][i].replace('lc-','').replace('.list','')
# ----------- Read in the configuration file ------------
params=JLA.build_dictionary(options.config)
try:
salt_path = JLA.get_full_path(params['defsaltModel'])
except KeyError:
salt_path = ''
# ----------- The lightcurve fitting -------------------
# Compute the offset between the nominal value of the extinciton
# and the adjusted value
# We first compute the difference in light curve fit parameters for E(B-V) * (1+offset)
offset = 0.1
j = []
for SN in SNelist:
inputFile = SN['lc']
print 'Fitting %s ' % (SN['lc'])
workArea = JLA.get_full_path(options.workArea)
dm, dx1, dc = JLA.compute_extinction_offset(SN['id'], inputFile, offset, workArea, salt_path)
j.extend([dm, dx1, dc])
# But we want to compute the impact of an offset that is twice as large, hence the factor of 4 in the expression
# 2017/10/13
# But we want to compute the impact of an offset that is half as large, hence the factor of 4 in the denominator
# cdust = numpy.matrix(j).T * numpy.matrix(j) * 4.0
cdust = numpy.matrix(j).T * numpy.matrix(j) / 4.0
date = JLA.get_date()
fits.writeto('C_dust_%s.fits' % date, cdust, clobber=True)
return
示例2: compute_dust
# 需要导入模块: import JLA_library [as 别名]
# 或者: from JLA_library import compute_extinction_offset [as 别名]
def compute_dust(options):
"""Python program to compute C_dust
"""
import numpy
import astropy.io.fits as fits
import os
import JLA_library as JLA
# ---------- Read in the SNe list -------------------------
SNelist = numpy.genfromtxt(options.SNlist,
usecols=(0, 2),
dtype='S30,S100',
names=['id', 'lc'])
for i, SN in enumerate(SNelist):
SNelist['id'][i] = SNelist['id'][i].replace('lc-','').replace('.list','')
# ----------- The lightcurve fitting -------------------
# Compute the offset between the nominal value of the extinciton
# and the adjusted value
offset = 0.1
j = []
for SN in SNelist:
inputFile = SN['lc']
print 'Fitting %s' % (SN['id'])
dm, dx1, dc = JLA.compute_extinction_offset(SN['id'], inputFile, offset)
j.extend([dm, dx1, dc])
cdust = numpy.matrix(j).T * numpy.matrix(j) * 4.0
date = JLA.get_date()
fits.writeto('C_dust_%s.fits' % date, cdust, clobber=True)
return