コード例 #1
0
ファイル: ex6_3.py プロジェクト: kakirastern/PyNeb_devel
def run_grid(models_dir, n_proc):
    pc.print_make_file(models_dir)

    # To have the full list of possible extensions:
    # print pc.config.SAVE_LIST
    # Here we set to nothing the list of cloudy's output files.
    # Only the .lin files will be output
    pc.config.SAVE_LIST = []
    pc.config.SAVE_LIST_ELEMS = []

    # Metallicity table
    Zs = np.array([0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1.0, 1.5])
    # Ionization parameter table
    logUs = [-2, -2.3, -2.7, -3, -3.3, -3.7, -4]

    # loop on the tables to write the input files
    for Z in Zs:
        for logU in logUs:
            make_model(name='G_{0:.1f}_{1:.1f}'.format(logU, Z), logU=logU,
                       logZ=np.log10(Z), models_dir=models_dir)
            
    # Run all the models
    pc.run_cloudy(dir_ = models_dir, n_proc = n_proc)
コード例 #2
0
ファイル: run_ex.py プロジェクト: kakirastern/PyNeb_devel
"""
#-------------------------------------- ex6_1 ----------------------------------------------
"""
CLOUDY WITHOUT PYCLOUDY
"""
import ex6_1
import pyCloudy as pc

"""
Question 6.1.1
"""
models_dir = 'CloudyModels' #Create this directory if necessary
pc.config.cloudy_exe = '/usr/local/Cloudy/c10.00/cloudy.exe' # point to the location of Cloudy.exe

# Print the Makefile in th emodels_dir directory (only needed one time)
pc.print_make_file(models_dir)
# Print a file containing the line for intensities
ex6_1.print_line_file(models_dir)

# prepare models with different Q(H)
for qH in [43, 44, 45, 46, 47, 48]:
    ex6_1.make_mod(models_dir, name='M_61.1_{0}'.format(qH), Teff=5e4, qH=qH, dens=3, r_in=17)
# run all the models in models_dirs starting with M_61.1
pc.run_cloudy(dir_=models_dir, n_proc=3, use_make=True,  model_name='M_61.1')
M43 = pc.CloudyModel('{0}/M_61.1_43'.format(models_dir), read_lin = True)
# load all the models in the models list
models = pc.load_models('{0}/M_61.1_'.format(models_dir), read_lin = True)

# make some plots
ex6_1.plot_Hb(models)
コード例 #3
0
    c_input.set_abund(ab_dict=abund, nograins=True)
    c_input.set_other(options)
    c_input.set_iterate(
    )  # (0) for no iteration, () for one iteration, (N) for N iterations.
    c_input.set_sphere()  # () or (True) : sphere, or (False): open geometry.
    c_input.set_emis_tab(emis_tab)
    c_input.set_distance(dist, 'kpc')
    c_input.print_input(to_file=True, verbose=False)


# The directory in which we will have the model
# You may want to change this to a different place so that the current directory
# will not receive all the Cloudy files.
dir_ = './'
#writing the makefile in the directory dir_
pc.print_make_file(dir_=dir_)

# setting verbosity to high level
pc.log_.level = 3
# Starting the timer
pc.log_.timer('Init', quiet=True)
# Generic name of the models
model_name = 'model_2'
# tables for the values of the density and the log(O/H)
tab_dens = [3, 4, 5, 6]
tab_ab_O = [-3.1, -3.25, -3.4, -3.55, -3.7]

# defining the models and writing 20 input files
for dens in tab_dens:
    for ab_O in tab_ab_O:
        make_model(dir_, model_name, dens, ab_O)
コード例 #4
0
ファイル: test2.py プロジェクト: indiajoe/pyCloudy
    # Defining the inner radius. A second parameter would be the outer radius (matter-bounded nebula).
    c_input.set_radius(np.log10(r_min))
    c_input.set_abund(ab_dict = abund, nograins = True)
    c_input.set_other(options)
    c_input.set_iterate() # (0) for no iteration, () for one iteration, (N) for N iterations.
    c_input.set_sphere() # () or (True) : sphere, or (False): open geometry.
    c_input.set_emis_tab(emis_tab)
    c_input.set_distance(dist, 'kpc')
    c_input.print_input(to_file = True, verbose = False)
    
# The directory in which we will have the model
# You may want to change this to a different place so that the current directory
# will not receive all the Cloudy files.
dir_ = './'
#writing the makefile in the directory dir_
pc.print_make_file(dir_ = dir_)

# setting verbosity to high level
pc.log_.level = 3
# Starting the timer
pc.log_.timer('Init', quiet = True)
# Generic name of the models
model_name = 'model_2'
# tables for the values of the density and the log(O/H)
tab_dens = [3, 4, 5, 6]
tab_ab_O = [-3.1, -3.25, -3.4, -3.55, -3.7]

# defining the models and writing 20 input files
for dens in tab_dens:
    for ab_O in tab_ab_O:
        make_model(dir_, model_name, dens, ab_O)
コード例 #5
0
ファイル: run_ex.py プロジェクト: MJChimal/PyNeb_devel
OoH_4 = ex4_1.get_OoH_4(Tlow, Thigh, mean_dens)
plt.scatter(np.log10(OoH)+12, OoH_4, marker = 'd')
#-------------------------------------- ex5 ------------------------------------------------
"""
# CLOUDY FIRST STEPS
"""
#-------------------------------------- ex6_1 ----------------------------------------------
"""
# CLOUDY WITHOUT PYCLOUDY
"""
import ex6_1
import pyCloudy as pc

"""
# Question 6.1.1
"""
models_dir = 'CloudyModels' #Create this directory if necessary
pc.config.cloudy_exe = '/usr/local/Cloudy/c10.00/cloudy.exe' # point to the location of Cloudy.exe

# Print the Makefile in th emodels_dir directory (only needed one time)
pc.print_make_file(models_dir)
# Print a file containing the line for intensities
ex6_1.print_line_file(models_dir)

# prepare models with different Q(H)
for qH in [43, 44, 45, 46, 47, 48]:
    ex6_1.make_mod(models_dir, name='M_61.1_{0}'.format(qH), Teff=5e4, qH=qH, dens=3, r_in=17)
# run all the models in models_dirs starting with M_61.1
pc.run_cloudy(dir_=models_dir, n_proc=3, use_make=True,  model_name='M_61.1')
M43 = pc.CloudyModel('{0}/M_61.1_43'.format(models_dir), read_lin = True)
# load all the models in the models list