Example #1
0
    parser.add('--'+i, type=str, required=False, \
               help=param.help[i], default=param.dic_init_string[i])
for i in param.dic_init_list_string:
    parser.add('--'+i, type=str, required=False, \
               help=param.help[i], \
               default=param.dic_init_list_string[i],nargs="*")

parser.add('--out', required=True, help='output text file with model')
parser.add('--plot', required=False, action='store_true', default=False)

args, unknown = parser.parse_known_args()
param.set_parameters_from_parser(args=args, unknown=unknown)
param.test_init_is_valid()
dic_init = param.dic_init

m = model(dic_init)
m.add_auto(dic_init)

met = None
if dic_init['metals'] is not None:
    met = metals.model(dic_init)
    met.templates = not dic_init['metal_dmat']
    met.grid = not dic_init['metal_xdmat']
    met.add_auto()

data = fits.open(dic_init['data_auto'])[1].data

xi = m.valueAuto(data.RP, data.RT, data.Z, dic_init)
if met:
    xi += met.valueAuto(dic_init)
Example #2
0
    met.templates = not dic_init['metal_dmat']
    met.grid = not dic_init['metal_xdmat']
    if not dic_init['data_auto'] is None: met.add_auto()
    if not dic_init['data_cross'] is None: met.add_cross(dic_init)

    fix_met = met.fix
    for i in fix_met:
        kw['fix_' + i] = True

    for n, v in zip(met.pname, met.pinit):
        print(n, v)
        kw[n] = v
        kw['error_' + n] = 0.005
    print()

m = cosmo.model(dic_init)
if not dic_init['data_auto'] is None:
    m.add_auto(dic_init)
if not dic_init['data_cross'] is None:
    m.add_cross(dic_init)
if not dic_init['data_autoQSO'] is None:
    m.add_autoQSO(dic_init)

chi2 = Chi2.Chi2(dic_init, cosmo=m, met=met)

for n, v in zip(m.pall, m.pinit):
    #print(n,v)
    kw[n] = v
    if abs(v) != 0:
        kw['error_' + n] = abs(v) / 10.
    else: