diff --git a/src/py21cmemu/properties.py b/src/py21cmemu/properties.py index 09b0d45..b6569dd 100644 --- a/src/py21cmemu/properties.py +++ b/src/py21cmemu/properties.py @@ -7,44 +7,6 @@ import numpy as np -USER_PARAMS = { - "BOX_LEN": 250, - "DIM": 512, - "HII_DIM": 128, - "USE_FFTW_WISDOM": True, - "HMF": 1, - "USE_RELATIVE_VELOCITIES": False, - "POWER_SPECTRUM": 0, - "N_THREADS": 1, - "PERTURB_ON_HIGH_RES": False, - "NO_RNG": False, - "USE_INTERPOLATION_TABLES": True, - "FAST_FCOLL_TABLES": False, - "USE_2LPT": True, - "MINIMIZE_MEMORY": False, -} - -COSMO_PARAMS = { - "SIGMA_8": 0.82, - "hlittle": 0.6774, - "OMm": 0.3075, - "OMb": 0.0486, - "POWER_INDEX": 0.97, -} - -FLAG_OPTIONS = { - "USE_HALO_FIELD": False, - "USE_MINI_HALOS": False, - "USE_MASS_DEPENDENT_ZETA": True, - "SUBCELL_RSD": True, - "INHOMO_RECO": True, - "USE_TS_FLUCT": True, - "M_MIN_in_Mass": False, - "PHOTON_CONS": True, - "FIX_VCB_AVG": False, -} - - class EmulatorProperties: """A class that contains the properties of the emulator.""" @@ -89,6 +51,43 @@ def __init__(self): self.UVLFs_err = all_emulator_numbers["UVLFs_err"] self.UVLFs_logerr = all_emulator_numbers["UVLFs_logerr"] + USER_PARAMS = { + "BOX_LEN": 250, + "DIM": 512, + "HII_DIM": 128, + "USE_FFTW_WISDOM": True, + "HMF": 1, + "USE_RELATIVE_VELOCITIES": False, + "POWER_SPECTRUM": 0, + "N_THREADS": 1, + "PERTURB_ON_HIGH_RES": False, + "NO_RNG": False, + "USE_INTERPOLATION_TABLES": True, + "FAST_FCOLL_TABLES": False, + "USE_2LPT": True, + "MINIMIZE_MEMORY": False, + } + + COSMO_PARAMS = { + "SIGMA_8": 0.82, + "hlittle": 0.6774, + "OMm": 0.3075, + "OMb": 0.0486, + "POWER_INDEX": 0.97, + } + + FLAG_OPTIONS = { + "USE_HALO_FIELD": False, + "USE_MINI_HALOS": False, + "USE_MASS_DEPENDENT_ZETA": True, + "SUBCELL_RSD": True, + "INHOMO_RECO": True, + "USE_TS_FLUCT": True, + "M_MIN_in_Mass": False, + "PHOTON_CONS": True, + "FIX_VCB_AVG": False, + } + self.flag_options = FLAG_OPTIONS self.user_params = USER_PARAMS self.cosmo_params = COSMO_PARAMS @@ -119,6 +118,45 @@ def __init__(self): self.mean_errors = np.load( here / "models/radio_background/median_test_errors.npz" ) + USER_PARAMS = { + "BOX_LEN": 250, + "DIM": 512, + "HII_DIM": 128, + "USE_FFTW_WISDOM": True, + "HMF": 1, + "USE_RELATIVE_VELOCITIES": False, + "POWER_SPECTRUM": 0, + "N_THREADS": 1, + "PERTURB_ON_HIGH_RES": False, + "NO_RNG": False, + "USE_INTERPOLATION_TABLES": True, + "FAST_FCOLL_TABLES": False, + "USE_2LPT": True, + "MINIMIZE_MEMORY": False, + } + + COSMO_PARAMS = { + "SIGMA_8": 0.82, + "hlittle": 0.6774, + "OMm": 0.3075, + "OMb": 0.0486, + "POWER_INDEX": 0.97, + } + + FLAG_OPTIONS = { + "USE_HALO_FIELD": False, + "USE_MINI_HALOS": False, + "USE_MASS_DEPENDENT_ZETA": True, + "SUBCELL_RSD": True, + "INHOMO_RECO": True, + "USE_TS_FLUCT": True, + "M_MIN_in_Mass": False, + "PHOTON_CONS": True, + "FIX_VCB_AVG": False, + } + self.flag_options = FLAG_OPTIONS + self.user_params = USER_PARAMS + self.cosmo_params = COSMO_PARAMS def emulator_properties(emulator: str = "default") -> EmulatorProperties: diff --git a/tests/test_main.py b/tests/test_main.py index dc31b5b..6ea67a0 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -57,15 +57,21 @@ def test_output(tmp_path): def test_properties(): """Test that the properties are loaded correctly.""" - from py21cmemu.properties import emulator_properties as properties + from py21cmemu.properties import emulator_properties + properties = emulator_properties() properties.limits + properties = emulator_properties(emulator="radio_background") + properties.logTr_mean + def test_inputs(): """Test that we perform parameter normalization properly.""" from py21cmemu import EmulatorInput - from py21cmemu.properties import emulator_properties as properties + from py21cmemu.properties import emulator_properties + + properties = emulator_properties() emu_in = EmulatorInput() limits = properties.limits.copy()