('m2l', np.float)]),
    shape=(n_z, n_t, n_models))

# m2l_spec = np.zeros((n_z, n_t, n_models, len(config["m2l_lambdas"])))

bt = StarlightBase(config['base_file'], config['base_path'])
bt.ageBase[bt.ageBase == 0] = 1e5  # Avoid NaN on log10(age)
i_norm = np.argmin((bt.l_ssp - config['lambda_norm']) ** 2)
# i_met = int(np.argwhere(bt.metBase == metallicity))
l2m_norm_ssp = np.empty((len(bt.metBase), len(bt.ageBase)))
for i_met in range(len(bt.metBase)):
    for i_age in range(len(bt.ageBase)):
        l2m_norm_ssp[i_met, i_age] = bt.f_ssp[i_met, i_age, i_norm]

# from pystarlight, eval l2m on filter
filter_m2l = readfilterfile(config['filter_m2l'], ).data
aux_l = np.arange(filter_m2l['lambda'].min(), filter_m2l['lambda'].max())
filter_m2l_new = np.empty(len(aux_l), dtype=filter_m2l.dtype)
filter_m2l_new['lambda'] = aux_l
filter_m2l_new['transm'] = np.interp(aux_l, filter_m2l['lambda'], filter_m2l['transm'])
filter_m2l = filter_m2l_new
LsunFilter = calc_LsunFilter(filter_m2l)

aux_m2l_lambdas_i = [int(np.argwhere(bt.l_ssp == i)) for i in config['m2l_lambdas']]

av_step = 1e-3
av_sampling = np.arange(config['AV_min'], config['AV_max'], av_step)
av_sampling = np.append(av_sampling, config['AV_max']) # to deal with boundaries
q_lambda = Cardelli_RedLaw(filter_m2l['lambda'])

# l2m_ssp_spec = np.zeros((len(bt.metBase), len(bt.ageBase), len(config["m2l_lambdas"])))
Beispiel #2
0
from model import Model

filters_plot = [['F_458', 'F_768'], ['F_365', 'F_644']]

i_z = 0

fnumbers = np.sort(config['filters'].keys())
fid = [[int(np.argwhere(fnumbers == j)) for j in i] for i in filters_plot]

# For the A_V Arrow:
e_c1 = Cardelli_RedLaw([4580])[0] - Cardelli_RedLaw([7680])[0]
e_c2 = Cardelli_RedLaw([3650])[0] - Cardelli_RedLaw([6440])[0]

# M/L calculations
## Filter
filter_m2l = readfilterfile(config['filter_m2l'], norm=False).data
aux_l = np.arange(filter_m2l['lambda'].min(), filter_m2l['lambda'].max())
filter_m2l_new = np.empty(len(aux_l), dtype=filter_m2l.dtype)
filter_m2l_new['lambda'] = aux_l
filter_m2l_new['transm'] = np.interp(aux_l, filter_m2l['lambda'], filter_m2l['transm'])
filter_m2l = filter_m2l_new
LsunFilter = calc_LsunFilter(filter_m2l)

## Base
bt = StarlightBase(config['base_file'], config['base_path'])
m2l_ssp = np.empty((len(bt.metBase), len(bt.ageBase)))
i_norm = np.argmin((bt.l_ssp - config['lambda_norm']) ** 2)
l2m_norm_ssp = np.empty((len(bt.metBase), len(bt.ageBase)))
for i_met in range(len(bt.metBase)):
    for i_age in range(len(bt.ageBase)):
        aux = np.interp(filter_m2l['lambda'], bt.l_ssp, bt.f_ssp[i_met, i_age])