本文整理汇总了Python中hyperion.model.Model.add_point_source方法的典型用法代码示例。如果您正苦于以下问题:Python Model.add_point_source方法的具体用法?Python Model.add_point_source怎么用?Python Model.add_point_source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyperion.model.Model
的用法示例。
在下文中一共展示了Model.add_point_source方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_point_source [as 别名]
from hyperion.model import Model
from hyperion.util.constants import pc, lsun
# Initialize model
m = Model()
# Set one-cell cartesian grid
w = np.linspace(-pc, pc, 32)
m.set_cartesian_grid(w, w, w)
# Add density grid with constant density
m.add_density_grid(np.ones(m.grid.shape) * 4.e-20, 'kmh_lite.hdf5')
# Add a point source in the center
s = m.add_point_source()
s.luminosity = 1000 * lsun
s.temperature = 6000.
# Add 10 SEDs for different viewing angles
image = m.add_peeled_images(sed=True, image=False)
image.set_wavelength_range(250, 0.01, 5000.)
image.set_viewing_angles(np.linspace(0., 90., 10), np.repeat(20., 10))
image.set_track_origin('basic')
# Add multi-wavelength image for a single viewing angle
image = m.add_peeled_images(sed=False, image=True)
image.set_wavelength_range(30, 1., 1000.)
image.set_viewing_angles([30.], [20.])
image.set_image_size(200, 200)
image.set_image_limits(-1.5 * pc, 1.5 * pc, -1.5 * pc, 1.5 * pc)
示例2: setup_model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_point_source [as 别名]
#.........这里部分代码省略.........
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")
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: