Skip to content

Commit

Permalink
Hack into CMT and assign MLP maps when asked for CNF maps
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx committed Dec 16, 2024
1 parent 687cd7b commit 62177df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion straxen/analyses/posrec_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def load_corrected_positions(
alt_s1=False,
alt_s2=False,
cmt_version=None,
posrec_algos=("mlp"), # TODO: https://github.com/XENONnT/straxen/issues/1454
posrec_algos=("mlp", "cnf"), # TODO: https://github.com/XENONnT/straxen/issues/1454
):
"""Returns the corrected position for each position algorithm available, without the need to
reprocess event_basics, as the needed information is already stored in event_basics.
Expand Down
13 changes: 10 additions & 3 deletions straxen/corrections_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
export, __all__ = strax.exporter()

corrections_w_file = [
"mlp_model",
"s2_xy_map_mlp",
"s2_xy_map",
"s2_xy_map_cnf",
"s1_xyz_map_mlp",
"s1_xyz_map_cnf",
"fdc_map_mlp",
"fdc_map_cnf",
"s1_aft_xyz_map",
]

Expand Down Expand Up @@ -168,7 +169,13 @@ def _get_correction(self, run_id, correction, version):
df = self.interface.interpolate(df, when)
values.append(df.loc[df.index == when, version].values[0])
else:
df = self.interface.read_at(correction, when)
# TODO: remove this hack when fdc_map_cnf is available
if correction == "fdc_map_cnf":
df = self.interface.read_at("fdc_map_mlp", when)
elif correction == "s1_xyz_map_cnf":
df = self.interface.read_at("s1_xyz_map_mlp", when)
else:
df = self.interface.read_at(correction, when)
if df[version].isnull().values.any():
raise CMTnanValueError(
f"For {correction} there are NaN values, this means no correction available"
Expand Down

0 comments on commit 62177df

Please sign in to comment.