當前位置: 首頁>>代碼示例>>Python>>正文


Python Model.read方法代碼示例

本文整理匯總了Python中hyperion.model.Model.read方法的典型用法代碼示例。如果您正苦於以下問題:Python Model.read方法的具體用法?Python Model.read怎麽用?Python Model.read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hyperion.model.Model的用法示例。


在下文中一共展示了Model.read方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setup_model

# 需要導入模塊: from hyperion.model import Model [as 別名]
# 或者: from hyperion.model.Model import read [as 別名]
# Resolution in pc:
cli.resolution          = 100.0

# Photons per grid cell:
cli.photons_temperature = 1
cli.photons_raytracing  = 1
cli.photons_imaging     = 1

for cli.case in [1, 2]:
    for cli.opticaldepth in [0.256434, 1.28217, 6.41084]:
        for cli.mode in ["temperature", "images", "seds"]:
            
            # Setup step:
            setup_model(cli);
            
            # Compute step:
            file = filename(cli, cli.mode)
            model = Model.read(file+".rtin")
            model.write("temp.rtin")
            model.run(filename=file+".rtout", logfile=file+".hyout", overwrite=True)
            
            # Plotting step:
            #TODO: if(cli.mode == "temperature"): visualize_setup + visualize_results => plot_setup
            if(cli.mode != "temperature"):
                plot_results(cli);
            
            # Export to fits format:
            if(cli.mode == "images"):
                export_to_fits(cli);
開發者ID:hyperion-rt,項目名稱:hyperion-trust,代碼行數:31,代碼來源:run_all.py

示例2:

# 需要導入模塊: from hyperion.model import Model [as 別名]
# 或者: from hyperion.model.Model import read [as 別名]
import glob

import numpy as np

from hyperion.model import Model
from hyperion.dust import SphericalDust
from hyperion.util.constants import pc

import yaml
settings = yaml.load(open('settings.yml'))
 
WAV = np.logspace(-1, 3, 45)

for model_path in glob.glob(os.path.join('models', '*_temperature.rtout')):

    m = Model.read(model_path, only_initial=False)

    m.set_n_initial_iterations(0)

    del m.n_photons['initial']
    del m.n_photons['last']

    i = m.add_peeled_images(sed=True, image=False)
    i.set_viewing_angles([0., 30., 60., 90., 120., 150., 180.],
                         [0., 0., 0., 0., 0., 0., 0.])
    i.set_track_origin('basic')

    i = m.add_peeled_images(sed=True, image=False)
    i.set_viewing_angles([0., 30., 60., 90., 120., 150., 180.],
                         [0., 0., 0., 0., 0., 0., 0.])
    i.set_track_origin('basic')
開發者ID:hyperion-rt,項目名稱:hyperion-trust,代碼行數:33,代碼來源:setup_seds.py

示例3:

# 需要導入模塊: from hyperion.model import Model [as 別名]
# 或者: from hyperion.model.Model import read [as 別名]
import numpy as np
from hyperion.model import Model
from hyperion.dust import SphericalDust
from hyperion.util.constants import pc

for tau_v in [0.1, 1.0, 20.0]:

    m = Model.read('bm1_slab_eff_tau{0:05.2f}_temperature.rtout'.format(tau_v), only_initial=False)

    m.set_n_initial_iterations(0)

    del m.n_photons['initial']
    del m.n_photons['last']

    i = m.add_peeled_images()
    i.set_viewing_angles([0., 30., 60., 90., 120., 150., 180.], [0., 0., 0., 0., 0., 0., 0.])
    i.set_image_limits(-7.5 * pc, 7.5 * pc, -7.5 * pc, 7.5 * pc)
    i.set_image_size(300, 300)

    # Set up monochromatic mode
    m.set_monochromatic(True, wavelengths=[0.165, 0.570, 21.3, 161.6])

    # Use raytracing
    m.set_raytracing(True)

    # Set up number of photons
    m.set_n_photons(imaging_sources=1e9, imaging_dust=1e9,
                    raytracing_sources=1, raytracing_dust=1e9)

    # Write out and run
    m.write('bm1_slab_effgrain_tau_{0:05.2f}_images.rtin'.format(tau_v), overwrite=True)
開發者ID:rolfkuiper,項目名稱:hyperion-trust,代碼行數:33,代碼來源:setup_images.py

示例4:

# 需要導入模塊: from hyperion.model import Model [as 別名]
# 或者: from hyperion.model.Model import read [as 別名]
import numpy as np
from hyperion.model import Model
from hyperion.dust import SphericalDust
from hyperion.util.constants import au

m = Model.read('bm2_eff_vor_temperature.rtout', only_initial=False)

m.set_n_initial_iterations(0)

del m.n_photons['initial']
del m.n_photons['last']

i = m.add_peeled_images()
i.set_viewing_angles([0., 90., 90., 90., 90., 180.], [0., 0., 90., 180., 270., 0.])
i.set_image_limits(-60 * au, 60 * au, -60 * au, 60 * au)
i.set_image_size(300, 300)

# Set up monochromatic mode
m.set_monochromatic(True, wavelengths=[0.10019, 0.55165, 2.00293, 10.03850, 101.15800])

# Use raytracing
m.set_raytracing(True)

# Set up number of photons
m.set_n_photons(imaging_sources=1e7, imaging_dust=1e7,
                raytracing_sources=1, raytracing_dust=1e7)

# Write out and run
m.write('bm2_eff_images.rtin', overwrite=True)
m.run('bm2_eff_images.rtout', mpi=True)
開發者ID:hyperion-rt,項目名稱:hyperion-trust,代碼行數:32,代碼來源:setup_images.py


注:本文中的hyperion.model.Model.read方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。