Exemple #1
0
 def simulation_run(widget):
     run_count = frame.get_state_data("run_count")
     run_count += 1
     data = None
     name = frame.get_attribute("run_name", "value")
     if name == "":
         name="Run: "+"%03d" % (run_count,)
     
     select_table = yield_tables[frame.get_attribute("select_table", "value")]
     data = omega.omega(galaxy='milky_way', table=select_table)
     
     add_run(data, name)
     frame.update()
     frame.set_attributes("run_name", value="")
     frame.set_state_data("run_count", run_count)
Exemple #2
0
def test_timestep(timestepsize):
    """
    For a given length of timestep; test both default omega (old),
    and new omega. 
    Return the result as strings:
    HOW DOES STRINGS APPEAR??
    """
    #allocate resulting strings
    result_old = ""
    result_new = ""

    #calculate result for 'old' omega
    try:
        O_obj = omega(dt=timestepsize, special_timesteps=0)
        n_steps = len(O_obj.history.age)
        time_string = O_obj._gettime()
    except IndexError:  #same old error, cannot create timestep-list
        result_old += "IndexError"
    except RuntimeWarning:  #invalid value in slope in double_scalars
        result_old += "RuntimeWarning"
    except:  #Some other error
        result_old += "Unknown Error"
    else:  #Did not fail
        result_old += "Success! %d timesteps %s" % (n_steps, time_string)

    #calculate result for 'new' omega
    try:
        cbf.bestfit_special_timesteps = 0
        cbf.bestfit_dt = timestepsize
        O_obj = omega_new(cbf)
        n_steps = len(O_obj.history.age)
        time_string = O_obj._gettime()
    except IndexError:  #same old error, cannot create timestep-list
        result_new += "IndexError"
    except RuntimeWarning:  #invalid value in slope in double_scalars
        result_old += "RuntimeWarning"
    except:  #Some other error
        raise
        result_new += "Unknown Error"
    else:  #Did not fail
        result_new += "Success! %d timesteps %s" % (n_steps, time_string)

    return result_old, result_new
Exemple #3
0
 def simulation_run(widget):
     run_count = frame.get_state_data("run_count")
     run_count += 1
     state = frame.get_state()
     data = None
     name = frame.get_attribute("run_name", "value")
     if name == "":
         name="Run: "+"%03d" % (run_count,)
     f_baryon = frame.get_attribute("f_baryon", "value")
     loading_mass = float(frame.get_attribute("loading_mass", "value"))
     sn1a_pmil = float(frame.get_attribute("sn1a_pmil", "value"))
     
     mgal = f_baryon * mgal_factor[state]
     data = omega.omega(galaxy=state, in_out_control=True, mgal=mgal, mass_loading=loading_mass, 
                        nb_1a_per_m=sn1a_pmil, table=yield_table, Z_trans=-1, in_out_ratio=2.0)
     
     add_run(state, data, name)
     frame.update()
     frame.set_attributes("run_name", value="")
     frame.set_state_data("run_count", run_count)
try:
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_norm_vals, save_name = read_param(
    "sfh_array_norm")  #get values from 'parameter_space.txt'
bestfit_mgal = 4.0e+10
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          sfh_array_norm=norm,
          mgal=bestfit_mgal,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table) for norm in loa_norm_vals
]  #omega-instances with new m_gal
loa_omega_names = ["$f_{norm,sfr}$=%1.2f" % norm for norm in loa_norm_vals]
norm_eris = eris_data().sfr["m_growth"][-1]
print norm_eris
loa_omega_inst += [
    omega(special_timesteps=timesteps,
          sfh_array_norm=norm_eris,
          mgal=bestfit_mgal,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table)
Exemple #5
0
 def run_omega(self):
     import omega as o
     o1 = o.omega()
try:
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_coaltime_vals, save_name = read_param(
    "t_nsm_coal")  #get values from 'parameter_space.txt'
bestfit_mgal = 4.0e+10
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          t_nsm_coal=coaltime,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table,
          mgal=bestfit_mgal) for coaltime in loa_coaltime_vals
]  #omega-instances with new parameter
loa_omega_names = [
    "$t_{coal,nsm}$=%1.2e" % coaltime for coaltime in loa_coaltime_vals
]

#visualize masses and sfr with 'visualize'
title = "Vary coallesence time of NSM"
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4, yields=True)
plot_obj.add_time_relabu("[Eu/H]", index_yaxis=0)
plot_obj.add_yields("Eu", index_yaxis=1, time="sum")
plot_obj.add_time_rate("kn", index_yaxis=2)
try:
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_pop3yields_vals, save_name = read_param(
    "imf_yields_range_pop3")  #get values from 'parameter_space.txt'
bestfit_mgal = 4.0e+10
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          imf_yields_range_pop3=pop3yields,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table,
          mgal=bestfit_mgal) for pop3yields in loa_pop3yields_vals
]  #omega-instances with new parameter
loa_omega_names = [
    "$Y_{pop3}\in$%s" % pop3yields for pop3yields in loa_pop3yields_vals
]

#visualize masses and sfr with 'visualize'
title = "Vary yield range for population 3 stars"
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4, yields=True)
plot_obj.add_time_relabu("[Fe/H]", index_yaxis=0)
plot_obj.add_time_relabu("[O/H]", index_yaxis=1)
plot_obj.add_time_mass("ism", index_yaxis=2)
Exemple #8
0
try:
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_fraction_vals, save_name = read_param(
    "f_arfo")  #get values from 'parameter_space.txt'
bestfit_mgal = 3.5e+10
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          f_arfo=fraction,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table,
          mgal=bestfit_mgal) for fraction in loa_fraction_vals
]  #omega-instances with new m_gal
loa_omega_names = ["f=%1.2e" % fraction for fraction in loa_fraction_vals]

#visualize masses and sfr with 'visualize'
title = "Vary fractional yield of massive stars"
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4, yields=True)
plot_obj.add_yields("O", index_yaxis=0, time="sum")
plot_obj.add_yields("Eu", index_yaxis=1, time="sum")
plot_obj.add_time_mass("locked", index_yaxis=2)
plot_obj.add_time_rate("sf", index_yaxis=3)
#get some bestfit-value from 'Eris'
from bestfit_param_omega.find_bestfit_param_v0.set_param_from_eris import *
#get values and filename from document
from read_parameter_space import read_param

#Set cmdline arguments
try:
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10
    
#Run calculations of GCE with 'Omega'
timesteps = n
loa_mgal_vals, save_name = read_param("mgal") #get values from 'parameter_space.txt'
loa_omega_inst = [omega(special_timesteps=timesteps, mgal=mgal,
                        imf_type=bestfit_imf_type, sfh_array=bestfit_sfh_array, ns_merger_on=bestfit_ns_merger_on, nsmerger_table=bestfit_nsmerger_table)
                   for mgal in loa_mgal_vals] #omega-instances with new m_gal
loa_omega_names = ["$M_{gal}$=%1.2e"%mgal for mgal in loa_mgal_vals]

#visualize masses and sfr with 'visualize'
title = "Vary initial galactic mass $M_{gal}(t_0)$"
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4)
plot_obj.add_time_mass("total", index_yaxis=0)
plot_obj.add_time_mass("ism", index_yaxis=1)
plot_obj.add_time_mass("locked", index_yaxis=2)
plot_obj.add_time_rate("sf", index_yaxis=3)

plot_obj.finalize(show=True, title=title, save=save_name)
Exemple #10
0
     def run_omega(self):
	  import omega as o
	  o1 = o.omega() 
#current mass of stars, used to calibrate SFH
M_star_f = 5.84e10 #[M_sol]
M_star_f_sigma_val = 1.17e10 #[M_sol]
M_star_f_sigma_rel = sigma_val2rel(M_star_f, M_star_f_sigma_val)
M_star_f_tuple = (M_star_f_slope, M_star_f_sigma_val, M_star_f_sigma_val)

#current mass of galactic gas
M_gas_f = 9.2e9 #[M_sol]
M_gas_f_sigma_val = 5.3e9 #[M_sol]
M_gas_f_sigma_rel = sigma_val2rel(M_gas_f, M_gas_f_sigma_val)
M_gas_f_tuple = (M_gas_f_slope, M_gas_f_sigma_val, M_gas_f_sigma_val)

if __name__ == '__main__':
    from directory_master import Foldermap
    folder = Foldermap()
    fodler.activate_environ()
    from omega import omega
    from visualize import visualize
    
    #for each parameter... plot 'Eris', empty 'Omega' and parameter +/- sigma
    loa_param_tuples = [M_lower_tuple, M_upper_tuple, imf_slope_tuple,
                        DTD1a_slope_tuple, Num1a_slope_tuple,
                        M_star_f_slope_tuple, M_gas_f_tuple]
    loa_param_names = ["Mlower", "Mupper", "imfslope",
                        "DTD1aSlope", "Num1aSlope",
                        "Mstar", "Mgas"]
    #Use 'visualize' to plot spectro-scopic data from 'Omega'
    loa_omega = [omega()] + [omega(
    plot_obj = visualize(loa_omega, loa_omega_names, num_yaxes=3)
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_nbnsm_vals, save_name = read_param(
    "nb_nsm_per_m")  #get values from 'parameter_space.txt'
bestfit_mgal = 3.0e+10
bestfit_t_nsm_coal = 1e+9
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          nb_nsm_per_m=nbnsm,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table,
          mgal=bestfit_mgal) for nbnsm in loa_nbnsm_vals
]  #omega-instances with new outflow
loa_omega_names = ["#NSM/M=%1.2f" % nbnsm for nbnsm in loa_nbnsm_vals]

#visualize masses and sfr with 'visualize'
title = "Vary number of NSM per mass"
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4, yields=True)
plot_obj.add_time_relabu("[Eu/H]", index_yaxis=0)
#plot_obj.add_yields("Re", index_yaxis=1, time="sum")
plot_obj.add_yields("Eu", index_yaxis=1, time="sum")
plot_obj.add_time_rate("kn", index_yaxis=2)
plot_obj.add_time_rate("sf", index_yaxis=3)
Exemple #13
0
import matplotlib.pyplot as pl
from scipy.interpolate import interp1d, CubicSpline
import time, sys

#Make GCE-instances for different dt-values
eris_dict = eris_data().sfgas #spectrographic data from Eris
t_end = 14e+9
loa_dt_values = [2e+7, 4e+7, 5e+7, 7e+7, 8e+7, 1e+8, 2e+8, 4e+8, 5e+8, 7e+8, 1e+9, 2e+9]
loa_dt_values = loa_dt_values[::-1]
loa_omega_dicts = []
loa_omega_timing = []
loa_omega_length = []
for dt_value in loa_dt_values:
    t0 = time.clock()
    instance = omega(special_timesteps=0,
                         dt=dt_value,
                         tend=t_end,
                         galaxy=bestfit_galaxy, in_out_control=bestfit_in_out_control, SF_law=bestfit_SF_law, DM_evolution=bestfit_DM_evolution, Z_trans=bestfit_Z_trans, f_dyn=bestfit_f_dyn, sfe=bestfit_sfe, outflow_rate=bestfit_outflow_rate, inflow_rate=bestfit_inflow_rate, rand_sfh=bestfit_rand_sfh, cte_sfr=bestfit_cte_sfr, m_DM_0=bestfit_m_DM_0, mass_loading=bestfit_mass_loading, t_star=bestfit_t_star, sfh_file=bestfit_sfh_file, in_out_ratio=bestfit_in_out_ratio, stellar_mass_0=bestfit_stellar_mass_0, z_dependent=bestfit_z_dependent, exp_ml=bestfit_exp_ml, nsmerger_bdys=bestfit_nsmerger_bdys, imf_type=bestfit_imf_type, alphaimf=bestfit_alphaimf, imf_bdys=bestfit_imf_bdys, sn1a_rate=bestfit_sn1a_rate, iniZ=bestfit_iniZ, mgal=bestfit_mgal, transitionmass=bestfit_transitionmass, iolevel=bestfit_iolevel, ini_alpha=bestfit_ini_alpha, nb_nsm_per_m=bestfit_nb_nsm_per_m, t_nsm_coal=bestfit_t_nsm_coal, table=bestfit_table, hardsetZ=bestfit_hardsetZ, sn1a_on=bestfit_sn1a_on, nsm_dtd_power=bestfit_nsm_dtd_power, sn1a_table=bestfit_sn1a_table, ns_merger_on=bestfit_ns_merger_on, f_binary=bestfit_f_binary, f_merger=bestfit_f_merger, t_merger_max=bestfit_t_merger_max, m_ej_nsm=bestfit_m_ej_nsm, nsmerger_table=bestfit_nsmerger_table, bhns_merger_on=bestfit_bhns_merger_on, m_ej_bhnsm=bestfit_m_ej_bhnsm, bhnsmerger_table=bestfit_bhnsmerger_table, iniabu_table=bestfit_iniabu_table, extra_source_on=bestfit_extra_source_on, extra_source_table=bestfit_extra_source_table, f_extra_source=bestfit_f_extra_source, pre_calculate_SSPs=bestfit_pre_calculate_SSPs, extra_source_mass_range=bestfit_extra_source_mass_range, extra_source_exclude_Z=bestfit_extra_source_exclude_Z, pop3_table=bestfit_pop3_table, imf_bdys_pop3=bestfit_imf_bdys_pop3, imf_yields_range_pop3=bestfit_imf_yields_range_pop3, starbursts=bestfit_starbursts, beta_pow=bestfit_beta_pow, gauss_dtd=bestfit_gauss_dtd, exp_dtd=bestfit_exp_dtd, nb_1a_per_m=bestfit_nb_1a_per_m, f_arfo=bestfit_f_arfo, t_merge=bestfit_t_merge, imf_yields_range=bestfit_imf_yields_range, exclude_masses=bestfit_exclude_masses, netyields_on=bestfit_netyields_on, wiersmamod=bestfit_wiersmamod, skip_zero=bestfit_skip_zero, redshift_f=bestfit_redshift_f, print_off=bestfit_print_off, long_range_ref=bestfit_long_range_ref, f_s_enhance=bestfit_f_s_enhance, m_gas_f=bestfit_m_gas_f, cl_SF_law=bestfit_cl_SF_law, external_control=bestfit_external_control, calc_SSP_ej=bestfit_calc_SSP_ej, tau_ferrini=bestfit_tau_ferrini, input_yields=bestfit_input_yields, popIII_on=bestfit_popIII_on, t_sf_z_dep=bestfit_t_sf_z_dep, m_crit_on=bestfit_m_crit_on, norm_crit_m=bestfit_norm_crit_m, mass_frac_SSP=bestfit_mass_frac_SSP, sfh_array_norm=bestfit_sfh_array_norm, imf_rnd_sampling=bestfit_imf_rnd_sampling, out_follows_E_rate=bestfit_out_follows_E_rate, r_gas_star=bestfit_r_gas_star, cte_m_gas=bestfit_cte_m_gas, t_dtd_poly_split=bestfit_t_dtd_poly_split, stellar_param_on=bestfit_stellar_param_on, delayed_extra_log=bestfit_delayed_extra_log, bhnsmerger_dtd_array=bestfit_bhnsmerger_dtd_array, dt_in_SSPs=bestfit_dt_in_SSPs, DM_array=bestfit_DM_array, nsmerger_dtd_array=bestfit_nsmerger_dtd_array, sfh_array=bestfit_sfh_array, ism_ini=bestfit_ism_ini, mdot_ini=bestfit_mdot_ini, mdot_ini_t=bestfit_mdot_ini_t, ytables_in=bestfit_ytables_in, zm_lifetime_grid_nugrid_in=bestfit_zm_lifetime_grid_nugrid_in, isotopes_in=bestfit_isotopes_in, ytables_pop3_in=bestfit_ytables_pop3_in, zm_lifetime_grid_pop3_in=bestfit_zm_lifetime_grid_pop3_in, ytables_1a_in=bestfit_ytables_1a_in, ytables_nsmerger_in=bestfit_ytables_nsmerger_in, SSPs_in=bestfit_SSPs_in, dt_in=bestfit_dt_in, dt_split_info=bestfit_dt_split_info, ej_massive=bestfit_ej_massive, ej_agb=bestfit_ej_agb, ej_sn1a=bestfit_ej_sn1a, ej_massive_coef=bestfit_ej_massive_coef, ej_agb_coef=bestfit_ej_agb_coef, ej_sn1a_coef=bestfit_ej_sn1a_coef, dt_ssp=bestfit_dt_ssp, yield_interp=bestfit_yield_interp, mass_sampled=bestfit_mass_sampled, scale_cor=bestfit_scale_cor, poly_fit_dtd_5th=bestfit_poly_fit_dtd_5th, poly_fit_range=bestfit_poly_fit_range, m_tot_ISM_t_in=bestfit_m_tot_ISM_t_in, delayed_extra_dtd=bestfit_delayed_extra_dtd, delayed_extra_dtd_norm=bestfit_delayed_extra_dtd_norm, delayed_extra_yields=bestfit_delayed_extra_yields, delayed_extra_yields_norm=bestfit_delayed_extra_yields_norm)
    t1 = time.clock()
    data_dict = omega_data(instance).get_dictionary()
    loa_omega_dicts.append(data_dict) #store data from omega
    loa_omega_timing.append(t1-t0)
    loa_omega_length.append(len(data_dict["time"]))

#Interpolate [Eu/H] over a common time-array
mask_of_infvalues = np.logical_not(np.isinf(eris_dict["[Eu/H]"]))
func_europium_eris = interp1d(x=eris_dict["time"][mask_of_infvalues],
                              y=eris_dict["[Eu/H]"][mask_of_infvalues],
                              bounds_error=False,
                              fill_value="extrapolate")
loa_func_europium_omega = []
for omega_dict in loa_omega_dicts:
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_outflow_vals, save_name = read_param(
    "outflow_rate")  #get values from 'parameter_space.txt'
bestfit_mgal = 4.0e+10
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          in_out_control=True,
          outflow_rate=outflow,
          out_follows_E_rate=False,
          in_out_ratio=0.0,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table,
          mgal=bestfit_mgal) for outflow in loa_outflow_vals
]  #omega-instances with new outflow
loa_omega_names = [
    "$\dot{M}_{out}$=%1.2e" % outflow for outflow in loa_outflow_vals
]

#visualize masses and sfr with 'visualize'
title = "Vary constant outflow $\dot{M}_{out}$ \n $M_{gal}(t_0)$=%1.1e" % (
    bestfit_mgal)
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4)
plot_obj.add_time_mass("total", index_yaxis=0)
try:
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_binaryfrac_vals, save_name = read_param(
    "f_binary")  #get values from 'parameter_space.txt'
bestfit_mgal = 4.0e+10
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          f_binary=binaryfrac,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table,
          mgal=bestfit_mgal) for binaryfrac in loa_binaryfrac_vals
]  #omega-instances with new parameter
loa_omega_names = [
    "$f_{bin}$=%1.2e" % binaryfrac for binaryfrac in loa_binaryfrac_vals
]

#visualize masses and sfr with 'visualize'
title = "Vary fraction of binary systems"
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4, yields=True)
plot_obj.add_time_relabu("[Eu/H]", index_yaxis=0)
plot_obj.add_yields("Eu", index_yaxis=1, time="sum")
plot_obj.add_time_rate("kn", index_yaxis=2)
Exemple #16
0
try:
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_imfboundary_vals, save_name = read_param(
    "imf_bdys")  #get values from 'parameter_space.txt'
bestfit_mgal = 4.0e+10
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          imf_bdys=imfboundary,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table,
          mgal=bestfit_mgal) for imfboundary in loa_imfboundary_vals
]  #omega-instances with new outflow
loa_omega_names = [
    "$IMF\in$%s" % imf_bound for imf_bound in loa_imfboundary_vals
]

#visualize masses and sfr with 'visualize'
title = "Vary IMF boundary"
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4, yields=True)
plot_obj.add_yields("Fe", index_yaxis=0, time="sum")
plot_obj.add_yields("Eu", index_yaxis=1, time="sum")
plot_obj.add_time_mass("locked", index_yaxis=2)
Exemple #17
0
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_inflow_vals, save_name = read_param(
    "inflow_rate")  #get values from 'parameter_space.txt'
print "Using inflow values: ", loa_inflow_vals
bestfit_mgal = 1.0e+10
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          in_out_control=True,
          inflow_rate=inflow,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table,
          mgal=bestfit_mgal) for inflow in loa_inflow_vals
]  #omega-instances with new inflow_rate
loa_omega_names = [
    "$\dot{M}_{in}$=%1.2e" % inflow for inflow in loa_inflow_vals
]

#visualize masses and sfr with 'visualize'
title = "Vary constant inflow $\dot{M}_{in}$ \n $M_{gal}(t_0)$=%1.1e" % (
    bestfit_mgal)
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4)
plot_obj.add_time_mass("total", index_yaxis=0)
plot_obj.add_time_mass("inflow", index_yaxis=1)
    from sys import argv
    n = int(argv[1])
except IndexError:
    n = 10

#Run calculations of GCE with 'Omega'
timesteps = n
loa_massload_vals, save_name = read_param(
    "mass_loading")  #get values from 'parameter_space.txt'
bestfit_mgal = 4.0e+10
loa_omega_inst = [
    omega(special_timesteps=timesteps,
          in_out_control=True,
          mass_loading=massload,
          out_follows_E_rate=False,
          in_out_ratio=0.0,
          imf_type=bestfit_imf_type,
          sfh_array=bestfit_sfh_array,
          ns_merger_on=bestfit_ns_merger_on,
          nsmerger_table=bestfit_nsmerger_table,
          mgal=bestfit_mgal) for massload in loa_massload_vals
]  #omega-instances with new outflow
loa_omega_names = [
    "$\dot{M}_{out}$=%1.2e*SFR" % massload for massload in loa_massload_vals
]

#visualize masses and sfr with 'visualize'
title = "Vary $\dot{M}_{out}$ by mass_loading \n $M_{gal}(t_0)$=%1.1e" % (
    bestfit_mgal)
#plot sfr, ism-mass, locked_mass, total_mass
plot_obj = visualize(loa_omega_inst, loa_omega_names, num_yaxes=4)
plot_obj.add_time_mass("total", index_yaxis=0)