当前位置: 首页>>代码示例>>Python>>正文


Python Model.run方法代码示例

本文整理汇总了Python中hyperion.model.Model.run方法的典型用法代码示例。如果您正苦于以下问题:Python Model.run方法的具体用法?Python Model.run怎么用?Python Model.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hyperion.model.Model的用法示例。


在下文中一共展示了Model.run方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [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)
开发者ID:koepferl,项目名称:tutorial_arbitrary,代码行数:32,代码来源:input.py

示例2:

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
fnu = np.array([1., 1.])
nu = c / (wav * 1.e-4)

s = m.add_point_source_collection()
s.position = np.array([x, y, z]).transpose()
s.velocity = np.array([vx, vy, vz]).transpose()
s.spectrum = (nu[::-1], fnu[::-1])
s.luminosity = np.repeat(1., N)

# Set up images

i = m.add_peeled_images(sed=False, image=True)
i.set_wavelength_range(30, 0.995, 1.005)
i.set_image_limits(-1., 1., -1., 1.)
i.set_image_size(100, 100)
i.set_viewing_angles(np.linspace(0., 180, 13), np.linspace(0., 360, 13))

i = m.add_binned_images(sed=False, image=True)
i.set_wavelength_range(30, 0.995, 1.005)
i.set_image_limits(-1., 1., -1., 1.)
i.set_image_size(100, 100)
i.set_viewing_bins(500, 1)

m.set_forced_first_scattering(False)

m.set_n_initial_iterations(0)
m.set_n_photons(imaging=1e6)

m.write('disk_collection.rtin', overwrite=True)
m.run('disk_collection.rtout', overwrite=True, mpi=False)
开发者ID:hyperion-rt,项目名称:hyperion-test-models,代码行数:32,代码来源:setup_collection.py

示例3:

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [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)
开发者ID:hyperion-rt,项目名称:hyperion-trust,代码行数:32,代码来源:setup_effgrain_temperature_vor.py

示例4:

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
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("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.0, 1000.0)
image.set_viewing_angles([30.0], [20.0])
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.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(-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.0)
# m.set_pda(True)

# Write out and run input.rtin file
m.write("input_lessdense.rtin")
m.run("input_lessdense.rtout", mpi=True, n_processes=2)
开发者ID:koepferl,项目名称:tutorial_arbitrary,代码行数:32,代码来源:input_lessdense.py

示例5: run_thermal_hyperion

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
    def run_thermal_hyperion(self, nphot=1e6, mrw=False, pda=False, \
            niterations=20, percentile=99., absolute=2.0, relative=1.02, \
            max_interactions=1e8, mpi=False, nprocesses=None):
        d = []
        for i in range(len(self.grid.dust)):
            d.append(IsotropicDust( \
                    self.grid.dust[i].nu[::-1].astype(numpy.float64), \
                    self.grid.dust[i].albedo[::-1].astype(numpy.float64), \
                    self.grid.dust[i].kext[::-1].astype(numpy.float64)))

        m = HypModel()
        if (self.grid.coordsystem == "cartesian"):
            m.set_cartesian_grid(self.grid.w1*AU, self.grid.w2*AU, \
                    self.grid.w3*AU)
        elif (self.grid.coordsystem == "cylindrical"):
            m.set_cylindrical_polar_grid(self.grid.w1*AU, self.grid.w3*AU, \
                    self.grid.w2)
        elif (self.grid.coordsystem == "spherical"):
            m.set_spherical_polar_grid(self.grid.w1*AU, self.grid.w2, \
                    self.grid.w3)

        for i in range(len(self.grid.density)):
            if (self.grid.coordsystem == "cartesian"):
                m.add_density_grid(numpy.transpose(self.grid.density[i], \
                        axes=(2,1,0)), d[i])
            if (self.grid.coordsystem == "cylindrical"):
                m.add_density_grid(numpy.transpose(self.grid.density[i], \
                        axes=(1,2,0)), d[i])
            if (self.grid.coordsystem == "spherical"):
                m.add_density_grid(numpy.transpose(self.grid.density[i], \
                        axes=(2,1,0)), d[i])

        sources = []
        for i in range(len(self.grid.stars)):
            sources.append(m.add_spherical_source())
            sources[i].luminosity = self.grid.stars[i].luminosity * L_sun
            sources[i].radius = self.grid.stars[i].radius * R_sun
            sources[i].temperature = self.grid.stars[i].temperature

        m.set_mrw(mrw)
        m.set_pda(pda)
        m.set_max_interactions(max_interactions)
        m.set_n_initial_iterations(niterations)
        m.set_n_photons(initial=nphot, imaging=0)
        m.set_convergence(True, percentile=percentile, absolute=absolute, \
                relative=relative)

        m.write("temp.rtin")

        m.run("temp.rtout", mpi=mpi, n_processes=nprocesses)

        n = ModelOutput("temp.rtout")

        grid = n.get_quantities()

        self.grid.temperature = []
        temperature = grid.quantities['temperature']
        for i in range(len(temperature)):
            if (self.grid.coordsystem == "cartesian"):
                self.grid.temperature.append(numpy.transpose(temperature[i], \
                        axes=(2,1,0)))
            if (self.grid.coordsystem == "cylindrical"):
                self.grid.temperature.append(numpy.transpose(temperature[i], \
                        axes=(2,0,1)))
            if (self.grid.coordsystem == "spherical"):
                self.grid.temperature.append(numpy.transpose(temperature[i], \
                        axes=(2,1,0)))

        os.system("rm temp.rtin temp.rtout")
开发者ID:psheehan,项目名称:mcrt3d,代码行数:71,代码来源:Model.py

示例6: zeros

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
m.set_spherical_polar_grid(r, t, p)

dens = zeros((nr-1,nt-1,np-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_spherical.rtin")

m.run("test_spherical.rtout", mpi=False)

n = ModelOutput('test_spherical.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()
开发者ID:psheehan,项目名称:mcrt3d,代码行数:31,代码来源:test_spherical.py

示例7:

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
# Add density grid with constant density and add a higher density cube inside to
# cause a shadow.
density = np.ones(m.grid.shape) * 1e-21
density[26:38, 26:38, 26:38] = 1.e-18
m.add_density_grid(density, 'kmh_lite.hdf5')

# Add a point source in the center
s = m.add_point_source()
s.position = (0.4 * pc, 0., 0.)
s.luminosity = 1000 * lsun
s.temperature = 6000.

# Add multi-wavelength image for a single viewing angle
image = m.add_peeled_images(sed=False, image=True)
image.set_wavelength_range(1, 190., 210.)
image.set_viewing_angles(np.repeat(45., 36), np.linspace(5., 355., 36))
image.set_image_size(400, 400)
image.set_image_limits(-1.5 * pc, 1.5 * pc, -1.5 * pc, 1.5 * pc)

# Set runtime parameters. We turn off scattering for the imaging since it is not
# important at these wavelengths.
m.set_n_initial_iterations(5)
m.set_raytracing(True)
m.set_n_photons(initial=4e6, imaging=0,
                raytracing_sources=1, raytracing_dust=1e7)

# Write out input file
m.write('flyaround_cube.rtin')
m.run('flyaround_cube.rtout', mpi=True)
开发者ID:ApolloVonSol,项目名称:hyperion,代码行数:31,代码来源:flyaround_cube_setup.py

示例8:

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
density = np.zeros(m.grid.shape)
density[:, :, 0] = 1.0

m.add_density_grid(density, "kmh_lite.hdf5")

# narrow emission line spectrum at 1 micron
wav = np.array([0.9999, 1.0001])
fnu = np.array([1.0, 1.0])
nu = c / (wav * 1.0e-4)

s = m.add_spherical_source()
s.position = 0.5, 0.0, 0.0
s.velocity = -1e8, 0.0, 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.0, 1.0, -1.0, 1.0)
i.set_image_size(100, 100)
i.set_viewing_angles(np.linspace(0.0, 180, 13), np.repeat(0.0, 13))

m.set_n_initial_iterations(0)
m.set_n_photons(imaging=1e6)

m.write("simple_scat.rtin", overwrite=True)
m.run("simple_scat.rtout", overwrite=True, mpi=True)
开发者ID:hyperion-rt,项目名称:hyperion-test-models,代码行数:32,代码来源:setup_scat_still.py

示例9: zeros

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
z = (arange(nz)-(float(nz)-1)/2)*au/1

m.set_cartesian_grid(x, y, z)

dens = zeros((nx-1,ny-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_cartesian.rtin")

m.run("test_cartesian.rtout", mpi=False)

n = ModelOutput('test_cartesian.rtout')

grid = n.get_quantities()

temp = grid.quantities['temperature'][0]

plt.imshow(temp[:,4,:],origin="lower",interpolation="nearest", \
        vmin=temp.min(),vmax=temp.max())
plt.colorbar()
plt.show()
开发者ID:psheehan,项目名称:mcrt3d,代码行数:32,代码来源:test_cartesian.py

示例10: Model

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
# Define cell walls
x = np.linspace(-10., 10., 101) * pc
y = np.linspace(-10., 10., 101) * pc
z = np.linspace(-10., 10., 101) * pc

# Initialize model and set up density grid
m = Model()
m.set_cartesian_grid(x, y, z)
m.add_density_grid(np.ones((100, 100, 100)) * 1.e-20, 'kmh_lite.hdf5')

# Generate random sources
for i in range(100):
    s = m.add_point_source()
    xs = random.uniform(-10., 10.) * pc
    ys = random.uniform(-10., 10.) * pc
    zs = random.uniform(-10., 10.) * pc
    s.position = (xs, ys, zs)
    s.luminosity = 10. ** random.uniform(0., 3.) * lsun
    s.temperature = random.uniform(3000., 8000.)

# Specify that the specific energy and density are needed
m.conf.output.output_specific_energy = 'last'
m.conf.output.output_density = 'last'

# Set the number of photons
m.set_n_photons(initial=10000000, imaging=0)

# Write output and run model
m.write('example_cartesian.rtin')
m.run('example_cartesian.rtout', mpi=True)
开发者ID:koepferl,项目名称:tutorial_visualizing,代码行数:32,代码来源:setup.py

示例11:

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [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)
开发者ID:koepferl,项目名称:tutorial_arbitrary,代码行数:32,代码来源:input_withoutproxima.py

示例12:

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
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)
开发者ID:hyperion-rt,项目名称:hyperion-test-models,代码行数:32,代码来源:setup_scat_moving.py

示例13: source

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [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')
开发者ID:hyperion-rt,项目名称:hyperion,代码行数:32,代码来源:setup_example_isrf.py

示例14:

# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import run [as 别名]
m.set_cartesian_grid(w, w, w)

# Add density grid with constant density and add a higher density cube inside to
# cause a shadow.
density = np.ones(m.grid.shape) * 1e-21
density[26:38, 26:38, 26:38] = 1.e-18
m.add_density_grid(density, 'kmh_lite.hdf5')

# Add a point source in the center
s = m.add_point_source()
s.position = (0.4 * pc, 0., 0.)
s.luminosity = 1000 * lsun
s.temperature = 6000.

# Add multi-wavelength image for a single viewing angle
image = m.add_peeled_images(sed=False, image=True)
image.set_wavelength_range(20, 1., 1000.)
image.set_viewing_angles([60.], [80.])
image.set_image_size(400, 400)
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=4e6, imaging=4e7,
                raytracing_sources=1, raytracing_dust=1e7)

# Write out input file
m.write('simple_cube.rtin')
m.run('simple_cube.rtout', mpi=True)
开发者ID:ApolloVonSol,项目名称:hyperion,代码行数:32,代码来源:simple_cube_setup.py


注:本文中的hyperion.model.Model.run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。