本文整理汇总了Python中population.Population.radialDistType方法的典型用法代码示例。如果您正苦于以下问题:Python Population.radialDistType方法的具体用法?Python Population.radialDistType怎么用?Python Population.radialDistType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类population.Population
的用法示例。
在下文中一共展示了Population.radialDistType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate
# 需要导入模块: from population import Population [as 别名]
# 或者: from population.Population import radialDistType [as 别名]
def generate(ngen,
surveyList=None,
pDistType='lnorm',
radialDistType='lfl06',
radialDistPars=7.5,
electronModel='ne2001',
pDistPars=[2.7, -0.34],
siDistPars=[-1.6, 0.35],
lumDistType='lnorm',
lumDistPars=[-1.1, 0.9],
zscaleType='exp',
zscale=0.33,
duty_percent=6.,
scindex=-3.86,
gpsArgs=[None, None],
doubleSpec=[None, None],
nostdout=False,
pattern='gaussian',
orbits=False):
"""
Generate a population of pulsars.
Keyword args:
ngen -- the number of pulsars to generate (or detect)
surveyList -- a list of surveys you want to use to try and detect
the pulsars
pDistType -- the pulsar period distribution model to use (def=lnorm)
radialDistType -- radial distribution model
electronModel -- mode to use for Galactic electron distribution
pDistPars -- parameters to use for period distribution
siDistPars -- parameters to use for spectral index distribution
lumDistPars -- parameters to use for luminosity distribution
radialDistPars -- parameters for radial distribution
zscale -- if using exponential z height, set it here (in kpc)
scindex -- spectral index of the scattering model
gpsArgs -- add GPS-type spectrum sources
doubleSpec -- add double-spectrum type sources
nostdout -- (bool) switch off stdout
"""
pop = Population()
# check that the distribution types are supported....
if lumDistType not in ['lnorm', 'pow']:
print "Unsupported luminosity distribution: {0}".format(lumDistType)
if pDistType not in ['lnorm', 'norm', 'cc97', 'lorimer12']:
print "Unsupported period distribution: {0}".format(pDistType)
if radialDistType not in ['lfl06', 'yk04', 'isotropic',
'slab', 'disk', 'gauss']:
print "Unsupported radial distribution: {0}".format(radialDistType)
if electronModel not in ['ne2001', 'lmt85']:
print "Unsupported electron model: {0}".format(electronModel)
if pattern not in ['gaussian', 'airy']:
print "Unsupported gain pattern: {0}".format(pattern)
if duty_percent < 0.:
print "Unsupported value of duty cycle: {0}".format(duty_percent)
# need to use properties in this class so they're get/set-type props
pop.pDistType = pDistType
pop.radialDistType = radialDistType
pop.electronModel = electronModel
pop.lumDistType = lumDistType
pop.rsigma = radialDistPars
pop.pmean, pop.psigma = pDistPars
pop.simean, pop.sisigma = siDistPars
pop.gpsFrac, pop.gpsA = gpsArgs
pop.brokenFrac, pop.brokenSI = doubleSpec
if pop.lumDistType == 'lnorm':
pop.lummean, pop.lumsigma = \
lumDistPars[0], lumDistPars[1]
else:
try:
pop.lummin, pop.lummax, pop.lumpow = \
lumDistPars[0], lumDistPars[1], lumDistPars[2]
except ValueError:
raise PopulateException('Not enough lum distn parameters')
pop.zscaleType = zscaleType
pop.zscale = zscale
# store the dict of arguments inside the model. Could be useful.
try:
argspec = inspect.getargspec(generate)
key_values = [(arg, locals()[arg]) for arg in argspec.args]
pop.arguments = {key: value for (key, value) in key_values}
except SyntaxError:
pass
if not nostdout:
print "\tGenerating pulsars with parameters:"
param_string_list = []
#.........这里部分代码省略.........