コード例 #1
0
    gpsavedir = os.path.join(plotdir, "nCDM")  #hires_s8")
    #quadsavedir = os.path.join(plotdir, "hires_s8_quad_quad")
    emud = os.path.join(emulator_base_directory, emulator_name)  #hires_s8')
    #quademud = os.path.join(sim_rootdir, "hires_s8_quadratic")
    testdirs = os.path.join('/share/data2/keir/Simulations/',
                            test_name)  #hires_s8_test')

    lyman_data_instance = lyman_data.BoeraData()
    redshifts = lyman_data_instance.redshifts_unique[::-1]
    max_z = np.max(redshifts)
    pixel_resolution_km_s = 1.

    # Get test simulation parameters
    t0_test_value = 1.
    test_simulation_number = 86
    test_emulator_instance = cg.nCDMEmulator(testdirs)
    test_emulator_instance.load(
        dumpfile='emulator_params_batch18_2_TDR_u0.json'
    )  #emulator_params_TDR_u0_original.json')
    test_simulation_directory = test_emulator_instance.get_outdir(
        test_emulator_instance.get_parameters()[test_simulation_number],
        extra_flag=test_simulation_number + 1)[:-7]

    test_simulation_parameters = test_emulator_instance.get_combined_params(
    )[test_simulation_number]
    #test_simulation_parameters = test_emulator_instance.get_parameters()[test_simulation_number]
    #test_simulation_parameters = np.concatenate((np.array([0., t0_test_value]), test_simulation_parameters))
    test_simulation_parameters = np.concatenate((np.array([
        t0_test_value,
    ] * 3), test_simulation_parameters))
    #T_0; gamma power laws
コード例 #2
0
        for simulation_indices_single_emulator in simulation_indices
    ])

    savefile = os.path.join(emulator_base_directory[0], emulator_names[0],
                            'flux_power_nCDM_convergence_mfevol.pdf')
    figure, axes = plt.subplots(nrows=n_simulations,
                                ncols=2,
                                figsize=(20., 20. * 2. / 10.))

    plot_start_index = 0
    input_parameters_all = []
    k_parallel = []
    flux_powers = []
    for a, emulator_name in enumerate(emulator_names):
        emulator_instance = cg.nCDMEmulator(
            os.path.join(emulator_base_directory[a], emulator_name),
            mf=mef.ConstMeanFluxHighRedshift(value=1.5))
        emulator_instance.load(dumpfile=emulator_jsons[a]
                               )  #'emulator_params_batch4_1_TDR_u0.json')

        input_parameters_all_single_emulator, k_parallel_single_emulator, flux_powers_single_emulator = emulator_instance.get_flux_vectors(
            redshifts=emulator_instance.redshifts,
            pixel_resolution_km_s=1.,
            spectral_resolution_km_s='default',
            spectral_resolution_km_s_corrected='default',
            fix_mean_flux_samples=True,
            no_mean_flux_rescaling=False,
            mean_fluxes=np.array(
                [0.17292689701710162, 0.25730327435491956,
                 0.3479585571365616]),
            add_z_evolution=False,
コード例 #3
0
import copy as cp
import numpy as np
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
import astropy.units as u

import lyaemu.coarse_grid as cg
import lyaemu.integrated_heating as ih

if __name__ == "__main__":
    emulator_base_directory = sys.argv[1]  #'/share/data2/keir/Simulations'
    emulator_name = sys.argv[2]  #'nCDM_test_emulator'
    load_file = sys.argv[3]
    dump_file = sys.argv[4]
    emulator_instance = cg.nCDMEmulator(
        os.path.join(emulator_base_directory, emulator_name))
    emulator_instance.load(dumpfile=load_file)
    optimisation_index = int(sys.argv[5])  # 0

    z_ranges = [[6., 13.], [4.6, 13.], [4.2, 12.]]
    helium_mass_fraction = 0.2453
    z_rei_HeII = 3.
    omega_b = emulator_instance.omegab

    integrated_heating = np.zeros(
        (emulator_instance.get_parameters()[optimisation_index:].shape[0],
         emulator_instance.redshifts.shape[0]))
    for i, input_parameters in enumerate(
            emulator_instance.get_parameters()[optimisation_index:]):
        simulation_directory = emulator_instance.get_outdir(
            input_parameters, extra_flag=optimisation_index + i + 1)[:-7]