本文整理汇总了Python中PALutils.computeLuminosityDistance方法的典型用法代码示例。如果您正苦于以下问题:Python PALutils.computeLuminosityDistance方法的具体用法?Python PALutils.computeLuminosityDistance怎么用?Python PALutils.computeLuminosityDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PALutils
的用法示例。
在下文中一共展示了PALutils.computeLuminosityDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prior
# 需要导入模块: import PALutils [as 别名]
# 或者: from PALutils import computeLuminosityDistance [as 别名]
parser.add_option('--drawPdistPrior', dest='pdistPrior', action='store_true', default=False,
help='Draw simulated pulsar distance from prior instead of using mean value)')
parser.add_option('--PdistSeed', dest='pdistSeed', action='store', type=int, default=0,
help='Random number seed for drawing pulsar distances from prior (default = 0, no seed)')
# parse arguments
(args, x) = parser.parse_args()
# compute chirp mass if mass m1 and m2 are given
if args.gwmass1 is not None and args.gwmass2 is not None:
args.gwchirpmass = (args.gwmass1*args.gwmass2)**(3/5) / (args.gwmass1+args.gwmass2)**(1/5)
# compute luminosity distance from redshift if given
if args.gwredshift is not None:
args.gwdist = PALutils.computeLuminosityDistance(args.gwredshift)
# make copy of h5file TODO: maybe better way than using os.system?
h5copy = args.outFile
print 'Saving file to {0}'.format(h5copy)
os.system('cp {0} {1}'.format(args.h5file, h5copy))
# import hdf5 file
pfile = h5.File(h5copy, 'r+')
# define the pulsargroup
pulsargroup = pfile['Data']['Pulsars']
# fill in pulsar class
psr = [PALpulsarInit.pulsar(pulsargroup[key], addNoise=True, addGmatrix=True) \
for key in pulsargroup]