本文整理汇总了Python中hyperion.model.Model.write方法的典型用法代码示例。如果您正苦于以下问题:Python Model.write方法的具体用法?Python Model.write怎么用?Python Model.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyperion.model.Model
的用法示例。
在下文中一共展示了Model.write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: source
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
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
m.set_n_initial_iterations(0)
# Only include photons from the source (since there is no dust)
m.set_n_photons(imaging=0,
raytracing_sources=10000000,
raytracing_dust=0)
# Write out and run the model
m.write('example_isrf.rtin')
m.run('example_isrf.rtout')
示例2:
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
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('detailed')
# 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(-dist, dist, -dist, dist)
# Add a fly-around at 500 microns
image = m.add_peeled_images(sed=False, image=True)
image.set_wavelength_range(1, 499., 501.)
image.set_viewing_angles(np.repeat(45., 36), np.linspace(5., 355., 36))
image.set_image_size(200, 200)
image.set_image_limits(-dist, dist, -dist, dist)
# Radiative Transfer
m.set_n_initial_iterations(5)
m.set_raytracing(True)
m.set_n_photons(initial=1000000, imaging=1000000,
raytracing_sources=1000000, raytracing_dust=1000000)
m.set_sample_sources_evenly(True)
m.set_mrw(True, gamma=2.)
#m.set_pda(True)
# Write out and run input.rtin file
m.write('input.rtin')
m.run('input.out', mpi=True, n_processes = 2)
示例3: setup_model_shell
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
def setup_model_shell(indir,outdir,outname,rin_shell=None,denser_wall=False,tsc=True,idl=False,plot=False,low_res=False,flat=True,scale=1.0):
import numpy as np
import astropy.constants as const
import scipy as sci
import matplotlib.pyplot as plt
import matplotlib as mat
import os
from matplotlib.colors import LogNorm
from scipy.optimize import fsolve
from scipy.optimize import newton
from scipy.integrate import nquad
from envelope_func import func
import hyperion as hp
from hyperion.model import Model
from plot_density import plot_density
# Constants setup
c = const.c.cgs.value
AU = 1.49598e13 # Astronomical Unit [cm]
pc = 3.08572e18 # Parsec [cm]
MS = 1.98892e33 # Solar mass [g]
LS = 3.8525e33 # Solar luminosity [erg/s]
RS = 6.96e10 # Solar radius [cm]
G = 6.67259e-8 # Gravitational constant [cm3/g/s^2]
yr = 60*60*24*365 # Years in seconds
PI = np.pi # PI constant
sigma = const.sigma_sb.cgs.value # Stefan-Boltzmann constant
m = Model()
# Create dust properties
# Hyperion needs nu, albedo, chi, g, p_lin_max
from hyperion.dust import HenyeyGreensteinDust
# Read in the dust opacity table used by RADMC-3D
dust_radmc = dict()
[dust_radmc['wl'], dust_radmc['abs'], dust_radmc['scat'], dust_radmc['g']] = np.genfromtxt('dustkappa_oh5_extended.inp',skip_header=2).T
# opacity per mass of dust?
dust_hy = dict()
dust_hy['nu'] = c/dust_radmc['wl']*1e4
ind = np.argsort(dust_hy['nu'])
dust_hy['nu'] = dust_hy['nu'][ind]
dust_hy['albedo'] = (dust_radmc['scat']/(dust_radmc['abs']+dust_radmc['scat']))[ind]
dust_hy['chi'] = (dust_radmc['abs']+dust_radmc['scat'])[ind]
dust_hy['g'] = dust_radmc['g'][ind]
dust_hy['p_lin_max'] = 0*dust_radmc['wl'][ind] # assume no polarization
d = HenyeyGreensteinDust(dust_hy['nu'], dust_hy['albedo'], dust_hy['chi'], dust_hy['g'], dust_hy['p_lin_max'])
# dust sublimation does not occur
# d.set_sublimation_temperature(None)
d.write(outdir+'oh5.hdf5')
d.plot(outdir+'oh5.png')
# Grids and Density
# Calculation inherited from the script used for RADMC-3D
# Grid Parameters
nx = 300L
if low_res == True:
nx = 100L
ny = 400L
nz = 50L
[nx, ny, nz] = [scale*nx, scale*ny, scale*nz]
if tsc == False:
# Parameters setup
# Import the model parameters from another file
#
params = np.genfromtxt(indir+'/params.dat',dtype=None)
tstar = params[0][1]
mstar = params[1][1]*MS
rstar = params[2][1]*RS
M_env_dot = params[3][1]*MS/yr
M_disk_dot = params[4][1]*MS/yr
R_env_max = params[5][1]*AU
R_env_min = params[6][1]*AU
theta_cav = params[7][1]
R_disk_max = params[8][1]*AU
R_disk_min = params[9][1]*AU
R_cen = R_disk_max
M_disk = params[10][1]*MS
beta = params[11][1]
h100 = params[12][1]*AU
rho_cav = params[13][1]
if denser_wall == True:
wall = params[14][1]*AU
rho_wall = params[15][1]
rho_cav_center = params[16][1]
rho_cav_edge = params[17][1]*AU
# Model Parameters
#
rin = rstar
rout = R_env_max
rcen = R_cen
# Star Parameters
#
mstar = mstar
#.........这里部分代码省略.........
示例4:
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
density[in_box] = rho_0
# Set up sphere 1
in_sphere_1 = (x - 10 * au) ** 2 + (y - 15 * au) ** 2 + (z - 20 * au) ** 2 < r_1 ** 2
density[in_sphere_1] = rho_1
# Set up sphere 2
in_sphere_2 = (x - 26.666667 * au) ** 2 + (y - 31.666667 * au) ** 2 + (z - 28.333333 * au) ** 2 < r_2 ** 2
density[in_sphere_2] = rho_2
# Remove dust close to source
in_rsub = np.sqrt(x * x + y * y + z * z) < RSUB
density[in_rsub] = 0.
m.add_density_grid(density, d)
# m.set_propagation_check_frequency(1.0)
# Set up illuminating source:
s = m.add_spherical_source()
s.radius = 6.6 * rsun
s.temperature = 33000.
s.luminosity = 4 * pi * s.radius ** 2 * sigma * s.temperature ** 4
# Set up number of photons
m.set_n_photons(initial=NPHOTONS, imaging=0)
# Write out and run
m.write(os.path.join('models', 'bm2_eff_vor_temperature.rtin'), overwrite=True)
m.run(os.path.join('models', 'bm2_eff_vor_temperature.rtout'), mpi=True, overwrite=True)
示例5:
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
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)
# Add a fly-around at 500 microns
image = m.add_peeled_images(sed=False, image=True)
image.set_wavelength_range(1, 499., 501.)
image.set_viewing_angles(np.repeat(45., 36), np.linspace(5., 355., 36))
image.set_image_size(200, 200)
image.set_image_limits(-1.5 * pc, 1.5 * pc, -1.5 * pc, 1.5 * pc)
# Set runtime parameters
m.set_n_initial_iterations(5)
m.set_raytracing(True)
m.set_n_photons(initial=1e6, imaging=1e7,
raytracing_sources=1e6, raytracing_dust=0)
# Write out input file
m.write('tutorial_model_noray_dust.rtin')
示例6:
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
# Set up illuminating source:
wav, fnu = np.loadtxt('data/BB_T10000_L100000.dat', usecols=[0,1], unpack=True)
nu = c / (wav * 1.e-4)
nu = nu[::-1]
fnu = fnu[::-1]
s = m.add_point_source()
s.position = (0., 0., 4 * pc)
s.luminosity = 3.839e38
s.spectrum = (nu, fnu)
# Set up number of photons
m.set_n_photons(initial=settings['temperature']['n_photons'], imaging=0)
m.conf.output.output_specific_energy = 'all'
# The settings below converge after 4 iterations, so we force 10 iterations
# instead to be safe since this run doesn't take too long.
# m.set_n_initial_iterations(NITER_MAX)
# m.set_convergence(True, percentile=99.9, absolute=2., relative=1.01)
m.set_n_initial_iterations(settings['temperature']['n_iter'])
# Don't copy input into output
m.set_copy_input(False)
# Write out and run
model_name = 'models/hyper_slab_eff_t{0}_temperature'.format(TAU_LABEL[tau_v])
m.write(model_name + '.rtin', overwrite=True, copy=False)
# m.run(model_name + '.rtout', mpi=True, overwrite=True, n_processes=12)
示例7: setup_model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
def setup_model(cli):
#
# Hyperion setup:
#
model = Model()
if(cli.mode == "temperature"):
#
# Dust properties:
#
dust_properties = SphericalDust('dust_integrated_full_scattering.hdf5')
#
# Write dust properties:
#
dust_properties.write('dust_properties.hdf5')
dust_properties.plot('dust_properties.png')
#
# Grid setup:
#
grid_wmin = 0
grid_wmax = 5.0*pc # 4.0*pc
grid_zmin = 0.0*pc
grid_zmax = 10.0*pc
grid_pmin = 0
grid_pmax = 2*pi
grid_dx = cli.resolution*pc
grid_dw = grid_dx # uniform resolution
grid_dz = grid_dx # uniform resolution
grid_dp = grid_dx # resolution at filament location at r = 1 pc
grid_Nw = int((grid_wmax - grid_wmin) / grid_dw)
grid_Nz = int((grid_zmax - grid_zmin) / grid_dz)
grid_Np = int(2*pi * 1.0*pc / grid_dp)
if(cli.verbose):
print("Grid setup:")
print(" Grid resolution =",cli.resolution, "pc.")
print(" grid_Nw =",grid_Nw)
print(" grid_Nz =",grid_Nz)
print(" grid_Np =",grid_Np)
#grid_w = np.logspace(np.log10(grid_wmin), np.log10(grid_wmax), grid_Nw)
#grid_w = np.hstack([0., grid_w]) # add innermost cell interface at w=0
grid_w = np.linspace(grid_wmin, grid_wmax, grid_Nw+1)
grid_z = np.linspace(grid_zmin, grid_zmax, grid_Nz+1)
grid_p = np.linspace(grid_pmin, grid_pmax, grid_Np+1)
model.set_cylindrical_polar_grid(grid_w, grid_z, grid_p)
#
# Dust density setup:
#
RC = 0.1*pc
nC = 6.6580e+03 # in cm^-3
nC *= cli.opticaldepth # the optical depth at 1 micron
nC *= m_h # in g cm^-3
nC /= 100.0 # converts from gas to dust density
rho = np.zeros(model.grid.shape)
#
# n(r) = nC / [ 1.0 + (r/RC)**2.0 ]
# x = -sin(2.0×pi×t) pc, y = +cos(2.0×pi×t) pc, z = 10.0×t pc, t = [0.0, 1.0]
# => t = m.grid.gz / (10*pc)
# => phi(t) = mod(360*t+270, 360)
#
for k in range(0, grid_Np):
for j in range(0, grid_Nz):
for i in range(0, grid_Nw):
t = model.grid.gz[k,j,i] / (10*pc)
if(cli.filament == "linear"):
filament_center_x = 0
filament_center_y = 0
elif(cli.filament == "spiraling"):
filament_center_x = - math.sin(2*pi*t)*pc
filament_center_y = + math.cos(2*pi*t)*pc
spherical_grid_r = model.grid.gw[k,j,i]
spherical_grid_phi = model.grid.gp[k,j,i]
cartesian_grid_x = spherical_grid_r * math.cos(spherical_grid_phi)
cartesian_grid_y = spherical_grid_r * math.sin(spherical_grid_phi)
rsquared = (
(cartesian_grid_x - filament_center_x)**2
+
(cartesian_grid_y - filament_center_y)**2
)
rho[k,j,i] = nC / (1.0 + (rsquared / (RC*RC)))
#.........这里部分代码省略.........
示例8:
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
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)
# Add a fly-around at 500 microns
image = m.add_peeled_images(sed=False, image=True)
image.set_wavelength_range(1, 499., 501.)
image.set_viewing_angles(np.repeat(45., 36), np.linspace(5., 355., 36))
image.set_image_size(200, 200)
image.set_image_limits(-1.5 * pc, 1.5 * pc, -1.5 * pc, 1.5 * pc)
# Set runtime parameters
m.set_n_initial_iterations(5)
m.set_raytracing(True)
m.set_n_photons(initial=1e6, imaging=1e7,
raytracing_sources=0, raytracing_dust=1e6)
# Write out input file
m.write('tutorial_model_noray_sour.rtin')
示例9: SphericalDust
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
y = np.linspace(-5 * pc, 5 * pc, 100)
z = np.hstack([np.linspace(-5 * pc, -2 * pc, 100), 5 * pc])
m.set_cartesian_grid(x, y, z)
# Grain Properties:
d = SphericalDust('integrated_hg_scattering.hdf5')
chi_v = d.optical_properties.interp_chi_wav(0.55)
# Determine density in slab
rho0 = tau_v / (3 * pc * chi_v)
# Set up density grid
density = np.ones(m.grid.shape) * rho0
density[-1,:,:] = 0.
m.add_density_grid(density, d)
# Set up illuminating source:
s = m.add_point_source()
s.position = (0., 0., 4 * pc)
s.temperature = 10000.0
s.luminosity = 3.839e38
# Set up number of photons
m.set_n_photons(initial=1e9, imaging=0)
# Write out and run
m.write('bm1_slab_eff_tau{0:05.2f}_temperature.rtin'.format(tau_v), overwrite=True)
示例10:
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
s.luminosity = 1000 * lsun
s.temperature = 6000.0
# Add 10 SEDs for different viewing angles
image = m.add_peeled_images(sed=True, image=False)
image.set_wavelength_range(250, 0.01, 5000.0)
image.set_viewing_angles(np.linspace(0.0, 90.0, 10), np.repeat(20.0, 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.0, 1000.0)
image.set_viewing_angles([30.0], [20.0])
image.set_image_size(200, 200)
image.set_image_limits(-1.5 * pc, 1.5 * pc, -1.5 * pc, 1.5 * pc)
# Add a fly-around at 500 microns
image = m.add_peeled_images(sed=False, image=True)
image.set_wavelength_range(1, 499.0, 501.0)
image.set_viewing_angles(np.repeat(45.0, 36), np.linspace(5.0, 355.0, 36))
image.set_image_size(200, 200)
image.set_image_limits(-1.5 * pc, 1.5 * pc, -1.5 * pc, 1.5 * pc)
# Set runtime parameters
m.set_n_initial_iterations(5)
m.set_raytracing(True)
m.set_n_photons(initial=0, imaging=1e7, raytracing_sources=1e6, raytracing_dust=1e6)
# Write out input file
m.write("tutorial_model.rtin")
示例11:
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
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('detailed')
# 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(-15*au, 15*au, -15*au, 15*au)
# Add a fly-around at 500 microns
image = m.add_peeled_images(sed=False, image=True)
image.set_wavelength_range(1, 499., 501.)
image.set_viewing_angles(np.repeat(45., 36), np.linspace(5., 355., 36))
image.set_image_size(200, 200)
image.set_image_limits(-15*au, 15*au, -15*au, 15*au)
# Radiative Transfer
m.set_n_initial_iterations(5)
m.set_raytracing(True)
m.set_n_photons(initial=1000000, imaging=1000000,
raytracing_sources=1000000, raytracing_dust=1000000)
m.set_sample_sources_evenly(True)
m.set_mrw(True, gamma=2.)
#m.set_pda(True)
# Write out and run input.rtin file
m.write('input_withoutproxima.rtin')
m.run('input_withoutproxima.rtout', mpi=True, n_processes = 2)
示例12: zeros
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
m.set_cylindrical_polar_grid(r, z, p)
dens = zeros((nr-1,np-1,nz-1)) + 1.0e-17
m.add_density_grid(dens, d)
source = m.add_spherical_source()
source.luminosity = lsun
source.radius = rsun
source.temperature = 4000.
m.set_n_photons(initial=1000000, imaging=0)
m.set_convergence(True, percentile=99., absolute=2., relative=1.02)
m.write("test_cylindrical.rtin")
#m.run("test_cylindrical.rtout", mpi=False)
n = ModelOutput('test_cylindrical.rtout')
grid = n.get_quantities()
temp = grid.quantities['temperature'][0]
for i in range(9):
plt.imshow(temp[i,:,:],origin="lower",interpolation="nearest", \
vmin=temp.min(),vmax=temp.max())
plt.colorbar()
plt.show()
示例13: setup_model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
def setup_model(outdir,record_dir,outname,params,dust_file,tsc=True,idl=False,plot=False,\
low_res=True,flat=True,scale=1,radmc=False,mono=False,record=True,dstar=178.,\
aperture=None,dyn_cav=False,fix_params=None,alma=False,power=2,better_im=False,ellipsoid=False,\
TSC_dir='~/programs/misc/TSC/', IDL_path='/Applications/exelis/idl83/bin/idl',auto_disk=0.25):
"""
params = dictionary of the model parameters
alma keyword is obsoleted
outdir: The directory for storing Hyperion input files
record_dir: The directory contains "model_list.txt" for recording parameters
TSC_dir: Path the TSC-related IDL routines
IDL_path: The IDL executable
"""
import numpy as np
import astropy.constants as const
import scipy as sci
# to avoid X server error
import matplotlib as mpl
mpl.use('Agg')
#
import matplotlib.pyplot as plt
import os
from matplotlib.colors import LogNorm
from scipy.integrate import nquad
from hyperion.model import Model
from record_hyperion import record_hyperion
from outflow_inner_edge import outflow_inner_edge
from pprint import pprint
# import pdb
# pdb.set_trace()
# Constants setup
c = const.c.cgs.value
AU = 1.49598e13 # Astronomical Unit [cm]
pc = 3.08572e18 # Parsec [cm]
MS = 1.98892e33 # Solar mass [g]
LS = 3.8525e33 # Solar luminosity [erg/s]
RS = 6.96e10 # Solar radius [cm]
G = 6.67259e-8 # Gravitational constant [cm3/g/s^2]
yr = 60*60*24*365 # Years in seconds
PI = np.pi # PI constant
sigma = const.sigma_sb.cgs.value # Stefan-Boltzmann constant
mh = const.m_p.cgs.value + const.m_e.cgs.value
g2d = 100.
mmw = 2.37 # Kauffmann 2008
m = Model()
# Create dust properties
# Hyperion needs nu, albedo, chi, g, p_lin_max
from hyperion.dust import HenyeyGreensteinDust
# Read in the dust opacity table used by RADMC-3D
dust = dict()
# [dust_radmc['wl'], dust_radmc['abs'], dust_radmc['scat'], dust_radmc['g']] = np.genfromtxt(dust_file,skip_header=2).T
[dust['nu'], dust['albedo'], dust['chi'], dust['g']] = np.genfromtxt(dust_file).T
# opacity per mass of dust?
# dust_hy = dict()
# dust_hy['nu'] = c/dust_radmc['wl']*1e4
# ind = np.argsort(dust_hy['nu'])
# dust_hy['nu'] = dust_hy['nu'][ind]
# dust_hy['albedo'] = (dust_radmc['scat']/(dust_radmc['abs']+dust_radmc['scat']))[ind]
# dust_hy['chi'] = (dust_radmc['abs']+dust_radmc['scat'])[ind]
# dust_hy['g'] = dust_radmc['g'][ind]
# dust_hy['p_lin_max'] = 0*dust_radmc['wl'][ind] # assume no polarization
# d = HenyeyGreensteinDust(dust_hy['nu'], dust_hy['albedo'], dust_hy['chi'], dust_hy['g'], dust_hy['p_lin_max'])
d = HenyeyGreensteinDust(dust['nu'], dust['albedo'], dust['chi'], dust['g'], dust['g']*0)
# dust sublimation option
d.set_sublimation_temperature('slow', temperature=1600.0)
d.set_lte_emissivities(n_temp=3000,
temp_min=0.1,
temp_max=2000.)
# try to solve the freq. problem
d.optical_properties.extrapolate_nu(3.28e15, 4e15)
#
d.write(outdir+os.path.basename(dust_file).split('.')[0]+'.hdf5')
d.plot(outdir+os.path.basename(dust_file).split('.')[0]+'.png')
plt.clf()
# Grids and Density
# Calculation inherited from the script used for RADMC-3D
# Grid Parameters
nx = 300L
if low_res == True:
nx = 100L
ny = 400L
nz = 50L
[nx, ny, nz] = [int(scale*nx), int(scale*ny), int(scale*nz)]
# TSC model input setting
# params = np.genfromtxt(indir+'/tsc_params.dat', dtype=None)
dict_params = params # input_reader(params_file)
# TSC model parameter
cs = dict_params['Cs']*1e5
t = dict_params['age'] # year
omega = dict_params['Omega0']
# calculate related parameters
M_env_dot = 0.975*cs**3/G
#.........这里部分代码省略.........
示例14:
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
vx = np.ones(m.grid.shape) * -1e8
vy = np.zeros(m.grid.shape)
vz = np.zeros(m.grid.shape)
m.add_density_grid(density, 'kmh_lite.hdf5', velocity=(vx, vy, vz))
# narrow emission line spectrum at 1 micron
wav = np.array([0.9999, 1.0001])
fnu = np.array([1., 1.])
nu = c / (wav * 1.e-4)
s = m.add_spherical_source()
s.position = 0.5, 0., 0.
s.velocity = -1e8, 0., 0.
s.spectrum = nu[::-1], fnu[::-1]
s.luminosity = 1
s.radius = 0.1
# Set up images
i = m.add_peeled_images(sed=False, image=True)
i.set_wavelength_range(30, 0.99, 1.01)
i.set_image_limits(-1., 1., -1., 1.)
i.set_image_size(100, 100)
i.set_viewing_angles(np.linspace(0., 180, 13), np.repeat(0., 13))
m.set_n_initial_iterations(0)
m.set_n_photons(imaging=1e6)
m.write('moving_scat.rtin', overwrite=True)
m.run('moving_scat.rtout', overwrite=True, mpi=True)
示例15:
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import write [as 别名]
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)
# Add a fly-around at 500 microns
image = m.add_peeled_images(sed=False, image=True)
image.set_wavelength_range(1, 499., 501.)
image.set_viewing_angles(np.repeat(45., 36), np.linspace(5., 355., 36))
image.set_image_size(200, 200)
image.set_image_limits(-1.5 * pc, 1.5 * pc, -1.5 * pc, 1.5 * pc)
# Set runtime parameters
m.set_n_initial_iterations(5)
m.set_raytracing(True)
m.set_n_photons(initial=100, imaging=1e7,
raytracing_sources=1e6, raytracing_dust=1e6)
# Write out input file
m.write('tutorial_model_fewinitials.rtin')