本文整理汇总了Python中hyperion.model.Model.use_quantities方法的典型用法代码示例。如果您正苦于以下问题:Python Model.use_quantities方法的具体用法?Python Model.use_quantities怎么用?Python Model.use_quantities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyperion.model.Model
的用法示例。
在下文中一共展示了Model.use_quantities方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import use_quantities [as 别名]
#.........这里部分代码省略.........
rho_setup = 5.21829e-4 * msun/pc/pc/pc
else:
rho_setup = 2.60915e-3 * msun/pc/pc/pc
deviation = 100.0 * abs(rho_setup - rho_max) / rho_setup
if(cli.verbose):
print("Check value of central dust density:")
print(" rho_max = ", rho_max, "g cm^-3")
print(" This corresponds to a deviation to the chosen setup value of", deviation, "percent")
#
# To compute total photon numbers:
#
grid_N = grid_Nw * grid_Nz * grid_Np
if(cli.verbose):
print("Radiation setup:")
print(" photons_temperature / cell =", cli.photons_temperature)
print(" photons_temperature total =", grid_N * cli.photons_temperature)
file = filename(cli, "temperature")
file += ".rtin"
else:
file = filename(cli, "temperature")
file += ".rtout"
try:
with open(file):
if(cli.verbose):
print("Using the specific energy distribution from file", file)
model.use_geometry(file)
model.use_quantities(file, only_initial=False, copy=False)
model.use_sources(file)
except IOError:
print("ERROR: File '", file, "' cannot be found. \nERROR: This file, containing the specific energy density, has to be computed first via calling hyperion.")
exit(2)
#
# To compute total photon numbers:
#
grid_Nw = len(model.grid.gw[0,0,:])
grid_Nz = len(model.grid.gw[0,:,0])
grid_Np = len(model.grid.gw[:,0,0])
grid_N = grid_Nw * grid_Nz * grid_Np
if(cli.verbose):
print("Grid setup:")
print(" grid_Nw =",grid_Nw)
print(" grid_Nz =",grid_Nz)
print(" grid_Np =",grid_Np)
print("Radiation setup:")
print(" photons_temperature / cell =", cli.photons_temperature)
print(" photons_temperature total =", grid_N * cli.photons_temperature)
print(" photons_raytracing / cell =", cli.photons_raytracing)
print(" photons_raytracing total =", grid_N * cli.photons_raytracing)
print(" photons_imaging / cell =", cli.photons_imaging)
print(" photons_imaging total =", grid_N * cli.photons_imaging)
file = filename(cli, "")
file += ".rtin"
##
## Temperature, Images, and SEDs: