本文整理汇总了Python中hyperion.model.Model.add_external_spherical_source方法的典型用法代码示例。如果您正苦于以下问题:Python Model.add_external_spherical_source方法的具体用法?Python Model.add_external_spherical_source怎么用?Python Model.add_external_spherical_source使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyperion.model.Model
的用法示例。
在下文中一共展示了Model.add_external_spherical_source方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_external_spherical_source [as 别名]
#.........这里部分代码省略.........
#
# Opacity at 1.0 micron (per gram dust):
#
chi = dust_properties.optical_properties.interp_chi_wav(1.0)
tau_max = 0
for k in range(0, grid_Np):
tau = 0
for i in range(0, grid_Nw):
dr = model.grid.widths[0,k,j,i]
dtau = dr * rho[k,j,i] * chi
tau += dtau
tau_max = max(tau_max, tau)
if(cli.filament == "linear"):
tau_max *= 2
dev = 100 * abs(cli.opticaldepth - tau_max) / cli.opticaldepth
if(cli.verbose):
print("Check:")
print(" Numerical integration of the optical depth through the filament center yields tau = ", tau_max)
print(" This corresponds to a deviation to the chosen setup value of", dev, "percent")
#
# Source:
#
if(cli.sources == "external"):
nu, jnu = np.loadtxt('bg_intensity_modified.txt', unpack=True)
source_R = 5*pc
source = model.add_external_spherical_source()
source.peeloff = False
source.position = (0, 0, 5.0*pc) # in a Cartesian frame
source.radius = source_R
source.spectrum = (nu, jnu)
#source_MeanIntensity_J = <integrate bg_intensity.txt>
#source_Area = 4.0 * pi * source_R*source_R
source.luminosity = 8237.0*lsun #source_Area * pi * source_MeanIntensity_J
elif(cli.sources == "stellar"):
source = model.add_point_source()
source.luminosity = 3.839e35 # in ergs s^-1
source.temperature = 10000.0 # in K
if(cli.filament == "linear"):
source.position = (3.0*pc, 0, 5.0*pc)
elif(cli.filament == "spiraling"):
source.position = (0 , 0, 3.0*pc)
#
# 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")
示例2: Model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_external_spherical_source [as 别名]
# Initialize model
m = Model()
# Set up grid
m.set_spherical_polar_grid([0., 1.001 * pc],
[0., np.pi],
[0., 2. * np.pi])
# Read in MMP83 spectrum
wav, jlambda = np.loadtxt('mmp83.txt', unpack=True)
nu = c / (wav * 1.e-4)
jnu = jlambda * wav / nu
# Set up the source - note that the normalization of the spectrum is not
# important - the luminosity is set separately.
s = m.add_external_spherical_source()
s.radius = pc
s.spectrum = (nu, jnu)
s.luminosity = np.pi * pc * pc * FOUR_PI_JNU
# Add an inside observer with an all-sky camera
image = m.add_peeled_images(sed=False, image=True)
image.set_inside_observer((0., 0., 0.))
image.set_image_limits(180., -180., -90., 90.)
image.set_image_size(256, 128)
image.set_wavelength_range(100, 0.01, 1000.)
# Use raytracing for high signal-to-noise
m.set_raytracing(True)
# Don't compute the temperature