Skip to content

Commit

Permalink
Merging changes from dict update and other param changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Shirley committed May 17, 2024
1 parent 2d33944 commit fb3e8c1
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions src/rail/estimation/algos/lephare.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@
import qp
import importlib

# We start with the COSMOS default and override with LSST specific values.
lsst_default_config=lp.default_cosmos_config
lsst_default_config.update({'CAT_IN': 'bidon',
'ERR_SCALE': '0.02,0.02,0.02,0.02,0.02,0.02',
'FILTER_CALIB': '0,0,0,0,0,0',
'FILTER_FILE': 'filter_lsst',
'FILTER_LIST': 'lsst/total_u.pb,lsst/total_g.pb,lsst/total_r.pb,lsst/total_i.pb,lsst/total_z.pb,lsst/total_y3.pb',
'GAL_LIB': 'LSST_GAL_BIN',
'GAL_LIB_IN': 'LSST_GAL_BIN',
'GAL_LIB_OUT': 'LSST_GAL_MAG',
'GLB_CONTEXT': '63',
'INP_TYPE': 'M',
'MABS_CONTEXT': '63',
'MABS_REF': '1',
'QSO_LIB': 'LSST_QSO_BIN',
'QSO_LIB_IN': 'LSST_QSO_BIN',
'QSO_LIB_OUT': 'LSST_QSO_MAG',
'STAR_LIB': 'LSST_STAR_BIN',
'STAR_LIB_IN': 'LSST_STAR_BIN',
'STAR_LIB_OUT': 'LSST_STAR_MAG',
'ZPHOTLIB': 'LSST_STAR_MAG,LSST_GAL_MAG,LSST_QSO_MAG'})

class LephareInformer(CatInformer):
"""Inform stage for LephareEstimator
Expand All @@ -29,9 +50,13 @@ class LephareInformer(CatInformer):
redshift_col=SHARED_PARAMS,
lephare_config=Param(
dict,
<<<<<<< Updated upstream
lp.keymap_to_string_dict(lp.read_config(
"{}/{}".format(os.path.dirname(os.path.abspath(__file__)), "lsst.para")
)),
=======
lsst_default_config,
>>>>>>> Stashed changes
msg="The lephare config keymap.",
),
star_config=Param(
Expand Down Expand Up @@ -108,10 +133,10 @@ def run(self):

# The three main lephare specific inform tasks
lp.prepare(
lp.string_dict_to_keymap(self.lephare_config),
star_config=lp.string_dict_to_keymap(self.config["star_config"]),
gal_config=lp.string_dict_to_keymap(self.config["gal_config"]),
qso_config=lp.string_dict_to_keymap(self.config["qso_config"]),
self.lephare_config,
star_config=self.config["star_config"],
gal_config=self.config["gal_config"],
qso_config=self.config["qso_config"],
)

# Spectroscopic redshifts
Expand Down Expand Up @@ -213,7 +238,13 @@ def _process_chunk(self, start, end, data, first):
offsets = [a0, a1]
elif not self.config["offsets"]:
offsets = self.model["offsets"]
<<<<<<< Updated upstream
output, pdfs, zgrid = lp.process(lp.string_dict_to_keymap(self.lephare_config), input, offsets=offsets)
=======
output, pdfs, zgrid = lp.process(
self.lephare_config, input, offsets=offsets
)
>>>>>>> Stashed changes
self.zgrid = zgrid

ng = data[self.config.bands[0]].shape[0]
Expand Down

0 comments on commit fb3e8c1

Please sign in to comment.