本文整理汇总了Python中hyperion.model.Model.add_peeled_images方法的典型用法代码示例。如果您正苦于以下问题:Python Model.add_peeled_images方法的具体用法?Python Model.add_peeled_images怎么用?Python Model.add_peeled_images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyperion.model.Model
的用法示例。
在下文中一共展示了Model.add_peeled_images方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_peeled_images [as 别名]
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)
# 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))
示例2: setup_model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_peeled_images [as 别名]
#.........这里部分代码省略.........
print(" photons_imaging total =", grid_N * cli.photons_imaging)
file = filename(cli, "")
file += ".rtin"
##
## Temperature, Images, and SEDs:
##
if(cli.mode == "temperature"):
model.set_raytracing(True)
model.set_n_photons(
initial = grid_N * cli.photons_temperature,
raytracing_sources = grid_N * cli.photons_raytracing,
raytracing_dust = grid_N * cli.photons_raytracing,
imaging = grid_N * cli.photons_imaging
)
elif(cli.mode == "images"):
model.set_n_initial_iterations(0)
model.set_raytracing(True)
# old setup: model.set_monochromatic(True, wavelengths=[0.4, 1.0, 10.0, 100.0, 500.0])
model.set_monochromatic(True, wavelengths=[0.45483, 1.2520, 26.114, 242.29])
model.set_n_photons(
raytracing_sources = grid_N * cli.photons_raytracing,
raytracing_dust = grid_N * cli.photons_raytracing,
imaging_sources = grid_N * cli.photons_imaging,
imaging_dust = grid_N * cli.photons_imaging
)
# group = 0
image1 = model.add_peeled_images(sed=False, image=True)
image1.set_image_size(501, 501)
image1.set_image_limits(-12500.0*pc, +12500.0*pc, -12500.0*pc, +12500.0*pc)
image1.set_viewing_angles([30],[0])
image1.set_uncertainties(True)
image1.set_output_bytes(8)
image1.set_track_origin('basic')
# group = 1
image2 = model.add_peeled_images(sed=False, image=True)
image2.set_image_size(501, 501)
image2.set_image_limits(-12500.0*pc, +12500.0*pc, -12500.0*pc, +12500.0*pc)
image2.set_viewing_angles([80],[90])
image2.set_uncertainties(True)
image2.set_output_bytes(8)
image2.set_track_origin('basic')
# group = 2
image3 = model.add_peeled_images(sed=False, image=True)
image3.set_image_size(501, 501)
image3.set_image_limits(-12500.0*pc, +12500.0*pc, -12500.0*pc, +12500.0*pc)
image3.set_viewing_angles([88],[0]) # mostly edge-on
image3.set_uncertainties(True)
image3.set_output_bytes(8)
image3.set_track_origin('basic')
elif(cli.mode == "seds"):
model.set_n_initial_iterations(0)
model.set_raytracing(True)
model.set_n_photons(
raytracing_sources = grid_N * cli.photons_raytracing,
raytracing_dust = grid_N * cli.photons_raytracing,
示例3: setup_model_shell
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_peeled_images [as 别名]
#.........这里部分代码省略.........
rho[ir,itheta,iphi] = rho_env[ir,itheta,iphi]
else:
rho[ir,itheta,iphi] = 1e-25
rho_env = rho_env + 1e-40
rho = rho + 1e-40
# Call function to plot the density
plot_density(rho, rc, thetac,'/Users/yaolun/bhr71/hyperion/', plotname='shell')
# Insert the calculated grid and dust density profile into hyperion
m.set_spherical_polar_grid(ri, thetai, phii)
m.add_density_grid(rho.T, outdir+'oh5.hdf5') # numpy read the array in reverse order
# Define the luminsoity source
source = m.add_spherical_source()
source.luminosity = (4*PI*rstar**2)*sigma*(tstar**4) # [ergs/s]
source.radius = rstar # [cm]
source.temperature = tstar # [K]
source.position = (0., 0., 0.)
print 'L_center = % 5.2f L_sun' % ((4*PI*rstar**2)*sigma*(tstar**4)/LS)
# Setting up the wavelength for monochromatic radiative transfer
lambda0 = 0.1
lambda1 = 2.0
lambda2 = 50.0
lambda3 = 95.0
lambda4 = 200.0
lambda5 = 314.0
lambda6 = 670.0
n01 = 10.0
n12 = 20.0
n23 = (lambda3-lambda2)/0.02
n34 = (lambda4-lambda3)/0.03
n45 = (lambda5-lambda4)/0.1
n56 = (lambda6-lambda5)/0.1
lam01 = lambda0 * (lambda1/lambda0)**(np.arange(n01)/n01)
lam12 = lambda1 * (lambda2/lambda1)**(np.arange(n12)/n12)
lam23 = lambda2 * (lambda3/lambda2)**(np.arange(n23)/n23)
lam34 = lambda3 * (lambda4/lambda3)**(np.arange(n34)/n34)
lam45 = lambda4 * (lambda5/lambda4)**(np.arange(n45)/n45)
lam56 = lambda5 * (lambda6/lambda5)**(np.arange(n56+1)/n56)
lam = np.concatenate([lam01,lam12,lam23,lam34,lam45,lam56])
nlam = len(lam)
# Create camera wavelength points
n12 = 70.0
n23 = 70.0
n34 = 70.0
n45 = 50.0
n56 = 50.0
lam12 = lambda1 * (lambda2/lambda1)**(np.arange(n12)/n12)
lam23 = lambda2 * (lambda3/lambda2)**(np.arange(n23)/n23)
lam34 = lambda3 * (lambda4/lambda3)**(np.arange(n34)/n34)
lam45 = lambda4 * (lambda5/lambda4)**(np.arange(n45)/n45)
lam56 = lambda5 * (lambda6/lambda5)**(np.arange(n56+1)/n56)
lam_cam = np.concatenate([lam12,lam23,lam34,lam45,lam56])
n_lam_cam = len(lam_cam)
# Radiative transfer setting
# number of photons for temp and image
m.set_raytracing(True)
m.set_monochromatic(True, wavelengths=[3.6, 4.5, 5.8, 8.0, 24, 70, 100, 160, 250, 350, 500])
m.set_n_photons(initial=1000000, imaging_sources=1000000, imaging_dust=1000000,raytracing_sources=1000000, raytracing_dust=1000000)
# imaging=100000, raytracing_sources=100000, raytracing_dust=100000
# number of iteration to compute dust specific energy (temperature)
m.set_n_initial_iterations(5)
m.set_convergence(True, percentile=99., absolute=1.5, relative=1.02)
m.set_mrw(True) # Gamma = 1 by default
# m.set_forced_first_scattering(forced_first_scattering=True)
# Setting up images and SEDs
image = m.add_peeled_images()
# image.set_wavelength_range(300, 2.0, 670.0)
# use the index of wavelength array used by the monochromatic radiative transfer
image.set_wavelength_index_range(2,12)
# pixel number
image.set_image_size(300, 300)
image.set_image_limits(-R_env_max, R_env_max, -R_env_max, R_env_max)
image.set_viewing_angles([82.0], [0.0])
image.set_uncertainties(True)
# output as 64-bit
image.set_output_bytes(8)
# Output setting
# Density
m.conf.output.output_density = 'last'
# Density difference (shows where dust was destroyed)
m.conf.output.output_density_diff = 'none'
# Energy absorbed (using pathlengths)
m.conf.output.output_specific_energy = 'last'
# Number of unique photons that passed through the cell
m.conf.output.output_n_photons = 'last'
m.write(outdir+outname+'.rtin')
示例4: setup_model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_peeled_images [as 别名]
#.........这里部分代码省略.........
print('L_center = % 5.2f L_sun' % ((4*PI*rstar**2)*sigma*(tstar**4)/LS))
# radiative transfer settigs
m.set_raytracing(True)
# determine the number of photons for imaging
# the case of monochromatic
if mono_wave != None:
if (type(mono_wave) == int) or (type(mono_wave) == float) or (type(mono_wave) == str):
mono_wave = float(mono_wave)
mono_wave = [mono_wave]
# Monochromatic radiative transfer setting
m.set_monochromatic(True, wavelengths=mono_wave)
m.set_n_photons(initial=mc_photons, imaging_sources=im_photon,
imaging_dust=im_photon, raytracing_sources=im_photon,
raytracing_dust=im_photon)
# regular SED
else:
m.set_n_photons(initial=mc_photons, imaging=im_photon * wav_num,
raytracing_sources=im_photon,
raytracing_dust=im_photon)
# number of iteration to compute dust specific energy (temperature)
m.set_n_initial_iterations(20)
m.set_convergence(True, percentile=dict_params['percentile'],
absolute=dict_params['absolute'],
relative=dict_params['relative'])
m.set_mrw(True) # Gamma = 1 by default
# Setting up images and SEDs
if not image_only:
# SED setting
# Infinite aperture
syn_inf = m.add_peeled_images(image=False)
# use the index of wavelength array used by the monochromatic radiative transfer
if mono_wave == None:
syn_inf.set_wavelength_range(wav_num, wav_min, wav_max)
syn_inf.set_viewing_angles([dict_params['view_angle']], [0.0])
syn_inf.set_uncertainties(True)
syn_inf.set_output_bytes(8)
# aperture
# 7.2 in 10 um scaled by lambda / 10
# flatten beyond 20 um
# default aperture (should always specify a set of apertures)
# assign wl_aper and aper from dictionary of aperture
wl_aper = aperture['wave']
aper = aperture['aperture']
# create the non-repetitive aperture list and index array
aper_reduced = sorted(list(set(aper)))
index_reduced = np.arange(1, len(aper_reduced)+1)
dict_peel_sed = {}
for i in range(0, len(aper_reduced)):
aper_dum = aper_reduced[i]/2 * (1/3600.*np.pi/180.)*dstar*pc
dict_peel_sed[str(index_reduced[i])] = m.add_peeled_images(image=False)
# use the index of wavelength array used by the monochromatic radiative transfer
if mono == False:
dict_peel_sed[str(index_reduced[i])].set_wavelength_range(wav_num, wav_min, wav_max)
dict_peel_sed[str(index_reduced[i])].set_viewing_angles([dict_params['view_angle']], [0.0])
# aperture should be given in cm and its the radius of the aperture
dict_peel_sed[str(index_reduced[i])].set_aperture_range(1, aper_dum, aper_dum)
dict_peel_sed[str(index_reduced[i])].set_uncertainties(True)
dict_peel_sed[str(index_reduced[i])].set_output_bytes(8)
示例5: Model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_peeled_images [as 别名]
if not os.path.exists("models/basic"):
os.mkdir("models/basic")
seed = -43912
for model_name in sky_model:
m = Model("models/basic/basic_%s" % model_name)
seed += 1
m.set_seed(seed)
m = setup_sources(m, model_name, sky_model[model_name][0])
m = setup_dust(m, **sky_model[model_name][1])
image = m.add_peeled_images(image=True, sed=False)
image.set_image_size(1, 1)
image.set_viewing_angles([90.0], [180.0])
image.set_image_limits(65.0, -65.0, -1.0, 1.0)
image.set_inside_observer((8.5 * kpc, 0.0 * kpc, 0.015 * kpc))
image.set_wavelength_range(160, 3.0, 140.0)
image.set_track_origin("detailed")
image = m.add_peeled_images(image=True, sed=False)
image.set_image_size(130, 1)
image.set_viewing_angles([90.0], [180.0])
image.set_image_limits(65.0, -65.0, -1.0, 1.0)
image.set_inside_observer((8.5 * kpc, 0.0 * kpc, 0.015 * kpc))
image.set_wavelength_range(160, 3.0, 140.0)
image.set_track_origin("detailed")
示例6: setup_model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_peeled_images [as 别名]
#.........这里部分代码省略.........
# else:
# mu_o_dum = roots[imu]
# if mu_o_dum == -0.5:
# print 'Problem with cubic solving, roots are: ', roots
# mu_o = mu_o_dum.real
# rho_env[ir,itheta,iphi] = M_env_dot/(4*PI*(G*mstar*rcen**3)**0.5)*(rc[ir]/rcen)**(-3./2)*(1+mu/mu_o)**(-0.5)*(mu/mu_o+2*mu_o**2*rcen/rc[ir])**(-1)
# # Disk profile
# if ((w >= R_disk_min) and (w <= R_disk_max)) == True:
# h = ((w/(100*AU))**beta)*h100
# rho_disk[ir,itheta,iphi] = rho_0*(1-np.sqrt(rstar/w))*(rstar/w)**(beta+1)*np.exp(-0.5*(z/h)**2)
# # Combine envelope and disk
# rho[ir,itheta,iphi] = rho_disk[ir,itheta,iphi] + rho_env[ir,itheta,iphi]
else:
rho[ir,itheta,iphi] = 1e-30
rho_env = rho_env + 1e-40
rho_disk = rho_disk + 1e-40
rho = rho + 1e-40
else:
for ir in range(0,len(rc)):
for itheta in range(0,len(thetac)):
for iphi in range(0,len(phic)):
# Envelope profile
w = abs(rc[ir]*np.cos(thetac[itheta]))
z = rc[ir]*np.sin(thetac[itheta])
z_cav = c*abs(w)**1.5
z_cav_wall = c*abs(w-wall)**1.5
if z_cav == 0:
z_cav = R_env_max
if abs(z) > abs(z_cav):
# rho_env[ir,itheta,iphi] = rho_cav
# Modification for using density gradient in the cavity
if rc[ir] <= 20*AU:
rho_env[ir,itheta,iphi] = rho_cav_center*((rc[ir]/AU)**2)
else:
rho_env[ir,itheta,iphi] = rho_cav_center*discont*(20*AU/rc[ir])**2
i += 1
elif (abs(z) > abs(z_cav_wall)) and (abs(z) < abs(z_cav)):
rho_env[ir,itheta,iphi] = rho_wall
else:
j += 1
mu = abs(np.cos(thetac[itheta]))
mu_o = np.abs(fsolve(func,[0.5,0.5,0.5],args=(rc[ir],rcen,mu))[0])
rho_env[ir,itheta,iphi] = M_env_dot/(4*PI*(G*mstar*rcen**3)**0.5)*(rc[ir]/rcen)**(-3./2)*(1+mu/mu_o)**(-0.5)*(mu/mu_o+2*mu_o**2*rcen/rc[ir])**(-1)
# Disk profile
if ((w >= R_disk_min) and (w <= R_disk_max)) == True:
h = ((w/(100*AU))**beta)*h100
rho_disk[ir,itheta,iphi] = rho_0*(1-np.sqrt(rstar/w))*(rstar/w)**(beta+1)*np.exp(-0.5*(z/h)**2)
# Combine envelope and disk
rho[ir,itheta,iphi] = rho_disk[ir,itheta,iphi] + rho_env[ir,itheta,iphi]
rho_env = rho_env + 1e-40
rho_disk = rho_disk + 1e-40
rho = rho + 1e-40
# Insert the calculated grid and dust density profile into hyperion
m.set_spherical_polar_grid(ri, thetai, phii)
m.add_density_grid(rho.T, outdir+'oh5.hdf5') # numpy read the array in reverse order
# Define the luminsoity source
source = m.add_spherical_source()
source.luminosity = (4*PI*rstar**2)*sigma*(tstar**4) # [ergs/s]
source.radius = rstar # [cm]
source.temperature = tstar # [K]
source.position = (0., 0., 0.)
print 'L_center = % 5.2f L_sun' % ((4*PI*rstar**2)*sigma*(tstar**4)/LS)
# Setting up images and SEDs
image = m.add_peeled_images()
image.set_wavelength_range(300, 2.0, 670.0)
# pixel number
image.set_image_size(300, 300)
image.set_image_limits(-R_env_max, R_env_max, -R_env_max, R_env_max)
image.set_viewing_angles([82.0], [0.0])
image.set_uncertainties(True)
# output as 64-bit
image.set_output_bytes(8)
# Radiative transfer setting
# number of photons for temp and image
m.set_raytracing(True)
m.set_n_photons(initial=1000000, imaging=1000000, raytracing_sources=1000000, raytracing_dust=1000000)
# number of iteration to compute dust specific energy (temperature)
m.set_n_initial_iterations(5)
m.set_convergence(True, percentile=99., absolute=1.5, relative=1.02)
m.set_mrw(True) # Gamma = 1 by default
# Output setting
# Density
m.conf.output.output_density = 'last'
# Density difference (shows where dust was destroyed)
m.conf.output.output_density_diff = 'none'
# Energy absorbed (using pathlengths)
m.conf.output.output_specific_energy = 'last'
# Number of unique photons that passed through the cell
m.conf.output.output_n_photons = 'last'
m.write(outdir+'old_setup2.rtin')
示例7: setup_model
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import add_peeled_images [as 别名]
#.........这里部分代码省略.........
lam_cam = np.concatenate([lam12,lam23,lam34,lam45,lam56])
n_lam_cam = len(lam_cam)
# Radiative transfer setting
# number of photons for temp and image
lam_list = lam.tolist()
# print lam_list
m.set_raytracing(True)
# option of using more photons for imaging
if better_im == False:
im_photon = 1e6
else:
im_photon = 5e7
if mono == True:
# Monechromatic radiative transfer setting
m.set_monochromatic(True, wavelengths=lam_list)
m.set_n_photons(initial=1000000, imaging_sources=im_photon, imaging_dust=im_photon,raytracing_sources=1000000, raytracing_dust=1000000)
else:
# regular wavelength grid setting
m.set_n_photons(initial=1000000, imaging=im_photon,raytracing_sources=1000000, raytracing_dust=1000000)
# number of iteration to compute dust specific energy (temperature)
m.set_n_initial_iterations(20)
# m.set_convergence(True, percentile=95., absolute=1.5, relative=1.02)
m.set_convergence(True, percentile=dict_params['percentile'], absolute=dict_params['absolute'], relative=dict_params['relative'])
m.set_mrw(True) # Gamma = 1 by default
# m.set_forced_first_scattering(forced_first_scattering=True)
# Setting up images and SEDs
# SED setting
# Infinite aperture
syn_inf = m.add_peeled_images(image=False)
# use the index of wavelength array used by the monochromatic radiative transfer
if mono == False:
syn_inf.set_wavelength_range(1400, 2.0, 1400.0)
syn_inf.set_viewing_angles([dict_params['view_angle']], [0.0])
syn_inf.set_uncertainties(True)
syn_inf.set_output_bytes(8)
# aperture
# 7.2 in 10 um scaled by lambda / 10
# flatten beyond 20 um
# default aperture
if aperture == None:
aperture = {'wave': [3.6, 4.5, 5.8, 8.0, 8.5, 9, 9.7, 10, 10.5, 11, 16, 20, 24, 35, 70, 100, 160, 250, 350, 500, 1300],\
'aperture': [7.2, 7.2, 7.2, 7.2, 7.2, 7.2, 7.2, 7.2, 7.2, 7.2, 20.4, 20.4, 20.4, 20.4, 24.5, 24.5, 24.5, 24.5, 24.5, 24.5, 101]}
# assign wl_aper and aper from dictionary of aperture
wl_aper = aperture['wave']
aper = aperture['aperture']
# create the non-repetitive aperture list and index array
aper_reduced = list(set(aper))
index_reduced = np.arange(1, len(aper_reduced)+1)
# name = np.arange(1,len(wl_aper)+1)
# aper = np.empty_like(wl_aper)
# for i in range(0, len(wl_aper)):
# if wl_aper[i] < 5:
# # aper[i] = 1.2 * 7
# aper[i] = 1.8 * 4
# elif (wl_aper[i] < 14) & (wl_aper[i] >=5):
# # aper[i] = 7.2 * wl_aper[i]/10.
# aper[i] = 1.8 * 4
# elif (wl_aper[i] >= 14) & (wl_aper[i] <40):
# # aper[i] = 7.2 * 2