本文整理汇总了Python中population.Population.lumPar1方法的典型用法代码示例。如果您正苦于以下问题:Python Population.lumPar1方法的具体用法?Python Population.lumPar1怎么用?Python Population.lumPar1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类population.Population
的用法示例。
在下文中一共展示了Population.lumPar1方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate
# 需要导入模块: from population import Population [as 别名]
# 或者: from population.Population import lumPar1 [as 别名]
def generate(ngen,
surveyList=None,
age_max=1.0E9,
pDistPars=[.3, .15],
bFieldPars=[12.65, 0.55],
birthVPars=[0.0, 180.],
siDistPars=[-1.6, 0.35],
alignModel='orthogonal',
lumDistType='fk06',
lumDistPars=[-1.5, 0.5],
alignTime=None,
spinModel='fk06',
beamModel='tm98',
birthVModel='gaussian',
electronModel='ne2001',
braking_index=0,
zscale=0.05,
duty=5.,
scindex=-3.86,
widthModel=None,
nodeathline=False,
efficiencycut=None,
nostdout=False,
nospiralarms=False,
keepdead=False):
pop = Population()
# set the parameters in the population object
pop.pmean, pop.psigma = pDistPars
pop.bmean, pop.bsigma = bFieldPars
if lumDistType == 'pow':
try:
pop.lummin, pop.lummax, pop.lumpow = \
lumDistPars[0], lumDistPars[1], lumDistPars[2]
except ValueError:
raise EvolveException('Not enough lum distn parameters for "pow"')
elif lumDistType == 'fk06':
pop.lumPar1, pop.lumPar2 = lumDistPars[0], lumDistPars[1]
if len(lumDistPars) == 3:
pop.lumPar3 = lumDistPars[2]
else:
pop.lumPar3 = 0.18
else:
pop.lumPar1, pop.lumPar2 = lumDistPars
pop.simean, pop.sisigma = siDistPars
pop.birthvmean, pop.birthvsigma = birthVPars
pop.alignModel = alignModel
pop.alignTime = alignTime
pop.spinModel = spinModel
pop.beamModel = beamModel
pop.birthVModel = birthVModel
pop.electronModel = electronModel
pop.braking_index = braking_index
pop.deathline = not nodeathline
pop.nospiralarms = nospiralarms
pop.zscale = zscale
if widthModel == 'kj07':
print "\tLoading KJ07 models...."
kj_p_vals, kj_pdot_vals, kj_dists = beammodels.load_kj2007_models()
print "\tDone\n"
if not nostdout:
print "\tGenerating evolved pulsars with parameters:"
print "\t\tngen = {0}".format(ngen)
print "\t\tUsing electron distn model {0}".format(
pop.electronModel)
print "\n\t\tPeriod mean, sigma = {0}, {1}".format(
pop.pmean,
pop.psigma)
print "\t\tLuminosity mean, sigma = {0}, {1}".format(
pop.lummean,
pop.lumsigma)
print "\t\tSpectral index mean, sigma = {0}, {1}".format(
pop.simean,
pop.sisigma)
print "\t\tGalactic z scale height = {0} kpc".format(
pop.zscale)
if widthModel is None:
print "\t\tWidth {0}% ".format(duty)
else:
print "\t\tUsing Karastergiou & Johnston beam width model"
# set up progress bar for fun :)
prog = ProgressBar(min_value=0,
max_value=ngen,
width=65,
mode='dynamic')
# create survey objects here and put them in a list
if surveyList is not None:
surveys = [Survey(s) for s in surveyList]
#.........这里部分代码省略.........
示例2: generate
# 需要导入模块: from population import Population [as 别名]
# 或者: from population.Population import lumPar1 [as 别名]
def generate(ngen,
surveyList=None,
age_max=1.0E9,
pDistPars=[.3, .15],
bFieldPars=[12.65, 0.55],
birthVPars=[0.0, 180.],
siDistPars= [-1.6,0.35],
alignModel='orthogonal',
lumDistType='fk06',
lumDistPars=[-1.5, 0.5],
alignTime=None,
spinModel = 'fk06',
beamModel = 'tm98',
birthVModel = 'gaussian',
electronModel='ne2001',
braking_index=0,
zscale=0.33,
duty=5.,
nodeathline=False,
nostdout=False,
nospiralarms=False):
pop = Population()
# set the parameters in the population object
pop.pmean, pop.psigma = pDistPars
pop.bmean, pop.bsigma = bFieldPars
if lumDistType=='pow':
try:
pop.lummin, pop.lummax, pop.lumpow = \
lumDistPars[0], lumDistPars[1], lumDistPars[2]
except ValueError:
raise EvolveException('Not enough lum distn parameters')
else:
pop.lumPar1, pop.lumPar2 = lumDistPars
pop.simean, pop.sisigma = siDistPars
pop.birthvmean, pop.birthvsigma = birthVPars
pop.alignModel = alignModel
pop.alignTime= alignTime
pop.spinModel = spinModel
pop.beamModel = beamModel
pop.birthVModel = birthVModel
pop.electronModel = electronModel
pop.braking_index = braking_index
pop.nodeathline = nodeathline
pop.nospiralarms = nospiralarms
pop.zscale = zscale
if not nostdout:
print "\tGenerating evolved pulsars with parameters:"
print "\t\tngen = {0}".format(ngen)
print "\t\tUsing electron distn model {0}".format(
pop.electronModel)
print "\n\t\tPeriod mean, sigma = {0}, {1}".format(
pop.pmean,
pop.psigma)
print "\t\tLuminosity mean, sigma = {0}, {1}".format(
pop.lummean,
pop.lumsigma)
print "\t\tSpectral index mean, sigma = {0}, {1}".format(
pop.simean,
pop.sisigma)
print "\t\tGalactic z scale height = {0} kpc".format(
pop.zscale)
print "\t\tWidth {0}% ".format(duty)
# set up progress bar for fun :)
prog = ProgressBar(min_value = 0,
max_value=ngen,
width=65,
mode='dynamic')
# create survey objects here and put them in a list
if surveyList is not None:
surveys = [Survey(s) for s in surveyList]
else:
# make an empty list here - makes some code just a little
# simpler - can still loop over an empty list (ie zero times)
surveys=[]
# initialise these counters to zero
for surv in surveys:
surv.ndet =0 # number detected
surv.nout=0 # number outside survey region
surv.nsmear=0 # number smeared out
surv.ntf=0 # number too faint
# this is the nitty-gritty loop for generating the pulsars
while pop.ndet < ngen:
pulsar = Pulsar()
# initial age for pulsar
pulsar.age = random.random() * age_max
#.........这里部分代码省略.........