Skip to content

Commit

Permalink
remove archive from gp emulator (no longer needed)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavesmontero committed Sep 20, 2024
1 parent e213a3c commit 9da68cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
15 changes: 9 additions & 6 deletions lace/cosmo/camb_cosmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@


def get_cosmology(
H0=67.0,
H0=67.66,
mnu=0.0,
omch2=0.12,
ombh2=0.022,
omch2=0.119,
ombh2=0.0224,
omk=0.0,
As=2.1e-09,
ns=0.965,
As=2.105e-09,
ns=0.9665,
nrun=0.0,
pivot_scalar=0.05,
w=-1,
):
"""Given set of cosmological parameters, return CAMB cosmology object."""
"""Given set of cosmological parameters, return CAMB cosmology object.
Fiducial values for Planck 2018
"""

pars = camb.CAMBparams()
# set background cosmology
Expand Down
18 changes: 10 additions & 8 deletions lace/emulator/gp_emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,17 @@ def __init__(
)

# read Gadget archive with the right postprocessing
self.archive = gadget_archive.GadgetArchive(postproc=training_set)
archive = gadget_archive.GadgetArchive(postproc=training_set)

elif archive != None and training_set == None:
elif (archive is not None) and (training_set is None):
print("Use custom archive provided by the user")
self.archive = archive
pass

elif (archive == None) & (training_set == None):
elif (archive is None) & (training_set is None):
raise (ValueError("Archive or training_set must be provided"))
self.kp_Mpc = self.archive.kp_Mpc

self.list_sim_cube = archive.list_sim_cube
self.kp_Mpc = archive.kp_Mpc

emulator_label_all = [
"Pedersen21",
Expand Down Expand Up @@ -277,13 +279,13 @@ def __init__(
# GPs should probably avoid rescalings (low performance with large N)
average = "both"
val_scaling = 1
if self.archive.training_average != "both":
if archive.training_average != "both":
warn("Enforce average=both in training of GP emulator")
if self.archive.training_val_scaling != 1:
if archive.training_val_scaling != 1:
warn("Enforce val_scalinge=1 in training of GP emulator")

# keep track of training data to be used in emulator
self.training_data = self.archive.get_training_data(
self.training_data = archive.get_training_data(
emu_params=self.emu_params,
drop_sim=self.drop_sim,
average=average,
Expand Down

0 comments on commit 9da68cc

Please sign in to comment.