def main(config): dic_init = parser.parse_chi2(config) chi = chi2.chi2(dic_init) chi.minimize() chi.minos() chi.chi2scan() chi.fastMC() chi.export()
#!/usr/bin/env python from picca.fitter2 import chi2, parser import argparse if __name__ == '__main__': pars = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='Fit the correlation function.') pars.add_argument('config', type=str, default=None, help='Config file') args = pars.parse_args() dic_init = parser.parse_chi2(args.config) chi = chi2.chi2(dic_init) chi.minimize() chi.minos() chi.chi2scan() chi.fastMC() chi.export()
default=['all'], required=False, nargs='*', help="List of the fitted parameters, if 'all' in list compute all") parser.add_argument( '--plot-effective-bins', action='store_true', help= 'Display an image with the bins involved in the fit of each selected parameter' ) args = parser.parse_args() ### Open files dic_init = fit_parser.parse_chi2(args.chi2_file) free_pars, fixed_pars, best_fit_pars, err_best_fit_pars = extract_h5file( dic_init['outfile']) if 'all' in args.params: args.params = free_pars.copy() if sp.any(~np.in1d(args.params, free_pars)): print( 'ERROR: Some parameters are not fitted {}, the list is {}'.format( args.params, free_pars)) sys.exit(12) ### Computing derivatives for each parameter, in each correlation for data in dic_init['data sets']['data']: print('\n data: {}\n'.format(data.name)) data.dm_dp = compute_dm_dp(data, dic_init, free_pars, best_fit_pars)
required=False, nargs='*', help="List of the fitted parameters, if 'all' in list compute all") parser.add_argument( '--plot-effective-bins', action='store_true', help= 'Display an image with the bins involved in the fit of each selected parameter' ) args = parser.parse_args() chi2_file = args.chi2_file ### Open files dic_init = fit_parser.parse_chi2(chi2_file) h5_file = dic_init['outfile'] free_pars, fixed_pars, best_fit_pars, err_best_fit_pars, xi_best_fit = extract_h5file( h5_file, args.cor_name) if 'all' in args.params: args.params = free_pars.copy() if sp.any(~sp.in1d(args.params, free_pars)): print( 'ERROR: Some parameters are not fitted {}, the list is {}'.format( args.params, free_pars)) sys.exit(12) ico, rp, rt, np, nt, rp_min, rp_max, rt_min, rt_max, r_min, r_max, z = extract_data( chi2_file, dic_init) ### Computation of the effective bins dm_dp = compute_dm_dp(free_pars, best_fit_pars)