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