本文整理匯總了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: