config = configparser.ConfigParser() config.optionxform = str config.read(config_file) read_config.check_sections_in_config(config) # Read general options: out = read_config.read_general_options(config) (skycoord, methods, file_all_models) = out[:3] (files, files_formats, files_kwargs, parameters_fixed) = out[3:] # Read MN options: out = read_config.read_MultiNest_options(config, config_file) (mn_min, mn_max, parameters_to_fit, MN_args) = out # Read MCPM options: MCPM_options = read_config.read_MCPM_options(config) # other constraints: other_constraints = read_config.read_other_constraints(config) # End of settings. ################################################################### n_params = len(parameters_to_fit) config_file_root = os.path.splitext(config_file)[0] if file_all_models is None: file_all_models = config_file_root + ".models" # read datasets datasets = [] if skycoord is not None: coords = MM.Coordinates(skycoord)
import read_config if len(sys.argv) != 2: raise ValueError('Exactly one argument needed - cfg file') config_file = sys.argv[1] parameters = ['t_E', 'pi_E_N', 'pi_E_E'] config = configparser.ConfigParser() config.optionxform = str config.read(config_file) read_config.check_sections_in_config(config) MCPM_options = read_config.read_MCPM_options(config, check_fits_files=False) out = read_config.read_EMCEE_options(config) parameters_to_fit = out[1] emcee_settings = out[4] if 'file_posterior' not in emcee_settings: raise ValueError('file_posterior missing in EMCEE settings') if len(emcee_settings['file_posterior']) == 0: config_file_root = os.path.splitext(config_file)[0] emcee_settings['file_posterior'] = config_file_root + ".posterior.npy" data = np.load(emcee_settings['file_posterior']) indexes = [parameters_to_fit.index(p) for p in parameters] selected = np.array([data[:, index] for index in indexes]).T