本文整理汇总了Python中JLA_library.smooth方法的典型用法代码示例。如果您正苦于以下问题:Python JLA_library.smooth方法的具体用法?Python JLA_library.smooth怎么用?Python JLA_library.smooth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JLA_library
的用法示例。
在下文中一共展示了JLA_library.smooth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compute_Ccal
# 需要导入模块: import JLA_library [as 别名]
# 或者: from JLA_library import smooth [as 别名]
#.........这里部分代码省略.........
except:
pass
#firstModel=True
print 'Examining SN #%d %s' % (i+1,SN['id'])
# Set up the number of processes
pool = mp.Pool(processes=int(options.processes))
# runSALT is the program that does the lightcurve fitting
results = [pool.apply(runSALT, args=(SALTpath,
SALTmodel,
salt_prefix,
SN['lc'],
SN['id'])) for SALTmodel in SALTmodels]
for result in results[1:]:
# The first model is the unperturbed model
dM,dX,dC=JLA.computeOffsets(results[0],result)
J.extend([dM,dX,dC])
pool.close() # This prevents to many open files
if firstSN:
J_new=numpy.array(J).reshape(nSALTmodels,3).T
firstSN=False
else:
J_new=numpy.concatenate((J_new,numpy.array(J).reshape(nSALTmodels,3).T),axis=0)
log.write('%d rows %d columns\n' % (J_new.shape[0],J_new.shape[1]))
log.close()
# Compute the new covariance matrix J . Cal . J.T produces a 3 * n_SN by 3 * n_SN matrix
# J=jacobian
J_smoothed=numpy.array(J_new)*0.0
J=J_new
# We need to concatenate the different samples ...
if options.Plot:
try:
os.mkdir('figures')
except:
pass
nPoints={'SNLS':11,'SDSS':11,'nearby':11,'high-z':11,'DES':11}
#sampleList=['nearby','DES']
sampleList=params['smoothList'].split(',')
if options.smoothed:
# We smooth the Jacobian
# We roughly follow the method descibed in the footnote of p13 of B14
for sample in sampleList:
selection=(SNeList['survey']==sample)
J_sample=J[numpy.repeat(selection,3)]
for sys in range(nSALTmodels):
# We need to convert to a numpy array
# There is probably a better way
redshifts=numpy.array([z for z in SNeList[selection]['z']])
derivatives_mag=J_sample[0::3][:,sys] # [0::3] = [0,3,6 ...] Every 3rd one
#print redshifts.shape, derivatives_mag.shape, nPoints[sample]
forPlotting_mag,res_mag=JLA.smooth(redshifts,derivatives_mag,nPoints[sample])
derivatives_x1=J_sample[1::3][:,sys]
forPlotting_x1,res_x1=JLA.smooth(redshifts,derivatives_x1,nPoints[sample])
derivatives_c=J_sample[2::3][:,sys]
forPlotting_c,res_c=JLA.smooth(redshifts,derivatives_c,nPoints[sample])