Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CMT URLs #1235

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e3e141e
remove cmt from contexts.py
jmosbacher Aug 11, 2023
1de9017
remove cmt from plugin config defaults
jmosbacher Aug 11, 2023
abf44ab
Merge branch 'master' into remove_cmt_urls
dachengx Sep 3, 2023
5fe5727
Merge branch 'master' into remove_cmt_urls
WenzDaniel Nov 6, 2023
c6a049c
merge with master
LuisSanchez25 Apr 2, 2024
5533548
merge conflicts with master
LuisSanchez25 Apr 3, 2024
cdb575b
solve context conflicts + merge with master
LuisSanchez25 Apr 3, 2024
2b6bb96
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 3, 2024
6136791
global_version -> xedocs_version
LuisSanchez25 Apr 3, 2024
e7d238b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 3, 2024
86a21a8
Merge branch 'master' into remove_cmt_urls
MerzJohannes Nov 28, 2024
52baf56
Merge branch 'master' into remove_cmt_urls
MerzJohannes Dec 11, 2024
e5a95c4
Update peak_positions_mlp.py
MerzJohannes Dec 11, 2024
4e2caa6
Resolved changes between master and
MerzJohannes Dec 13, 2024
0c882b8
Merge remote-tracking branch 'refs/remotes/origin/remove_cmt_urls' in…
MerzJohannes Dec 13, 2024
6bd3143
Resolve differences between main and
MerzJohannes Dec 13, 2024
736efba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
25bc267
Changed paths from cmt to xedocs
MerzJohannes Dec 13, 2024
611e67a
Merge remote-tracking branch 'refs/remotes/origin/remove_cmt_urls' in…
MerzJohannes Dec 13, 2024
e9d7ec8
Changed some links from cmt to xedocs
MerzJohannes Dec 13, 2024
8b5f898
Merge branch 'master' into remove_cmt_urls
dachengx Dec 16, 2024
04088ad
Minor format change
dachengx Dec 16, 2024
098778e
Merge branch 'master' into remove_cmt_urls
dachengx Dec 16, 2024
f5868aa
Debug
dachengx Dec 16, 2024
2ebf132
Debug
dachengx Dec 16, 2024
cc8cd60
Debug
dachengx Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 41 additions & 27 deletions straxen/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,30 @@
common_config = dict(
n_tpc_pmts=straxen.n_tpc_pmts,
n_top_pmts=straxen.n_top_pmts,
gain_model="cmt://to_pe_model?version=ONLINE&run_id=plugin.run_id",
gain_model_nv="cmt://to_pe_model_nv?version=ONLINE&run_id=plugin.run_id",
gain_model_mv="cmt://to_pe_model_mv?version=ONLINE&run_id=plugin.run_id",
gain_model="list-to-array://"
"xedocs://pmt_area_to_pes"
"?as_list=True"
"&sort=pmt"
"&detector=tpc"
"&run_id=plugin.run_id"
"&version=ONLINE"
"&attr=value",
gain_model_nv="list-to-array://"
"xedocs://pmt_area_to_pes"
"?as_list=True"
"&sort=pmt"
"&detector=neutron_veto"
"&run_id=plugin.run_id"
"&version=ONLINE"
"&attr=value",
gain_model_mv="list-to-array://"
"xedocs://pmt_area_to_pes"
"?as_list=True"
"&sort=pmt"
"&detector=muon_veto"
"&run_id=plugin.run_id"
"&version=ONLINE"
"&attr=value",
channel_map=immutabledict(
# (Minimum channel, maximum channel)
# Channels must be listed in a ascending order!
Expand All @@ -57,38 +78,31 @@
),
# Clustering/classification parameters
# Event level parameters
fdc_map=(
"itp_map://"
"resource://"
"cmt://"
"format://fdc_map_{alg}"
"?alg=plugin.default_reconstruction_algorithm"
"&version=ONLINE"
"&run_id=plugin.run_id"
"&fmt=binary"
"&scale_coordinates=plugin.coordinate_scales"
),
z_bias_map=(
"itp_map://"
"resource://"
"XnT_z_bias_map_chargeup_20230329.json.gz?"
"fmt=json.gz"
"&method=RegularGridInterpolator"
),
fdc_map="itp_map://"
"resource://"
"xedocs://fdc_maps"
"?algorithm=plugin.default_reconstruction_algorithm"
Copy link
Contributor

@GiovanniVolta GiovanniVolta Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot work! I suggest putting mlp as default for ONLINE

"&version=ONLINE"
"&attr=value"
"&run_id=plugin.run_id"
"&fmt=binary"
"&scale_coordinates=plugin.coordinate_scales",
z_bias_map="itp_map://"
"resource://"
"XnT_z_bias_map_chargeup_20230329.json.gz?"
"fmt=json.gz"
"&method=RegularGridInterpolator",
)
# these are placeholders to avoid calling cmt with non integer run_ids. Better solution pending.
# s1, s2 and fd corrections are still problematic


def xenonnt(cmt_version="global_ONLINE", xedocs_version=None, _from_cutax=False, **kwargs):
def xenonnt(xedocs_version="global_ONLINE", _from_cutax=False, **kwargs):
"""XENONnT context."""
if not _from_cutax and cmt_version != "global_ONLINE":
if not _from_cutax and xedocs_version != "global_ONLINE":
warnings.warn("Don't load a context directly from straxen, use cutax instead!")
st = straxen.contexts.xenonnt_online(**kwargs)
st.apply_cmt_version(cmt_version)

if xedocs_version is not None:
st.apply_xedocs_configs(version=xedocs_version, **kwargs)
st = straxen.contexts.xenonnt_online(xedocs_version=xedocs_version, **kwargs)

return st

Expand Down
21 changes: 15 additions & 6 deletions straxen/plugins/afterpulses/afterpulse_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ class LEDAfterpulseProcessing(strax.Plugin):
hit_min_amplitude = straxen.URLConfig(
track=True,
infer_type=False,
default="cmt://hit_thresholds_tpc?version=ONLINE&run_id=plugin.run_id",
help=(
"Minimum hit amplitude in ADC counts above baseline. "
"Specify as a tuple of length n_tpc_pmts, or a number, "
'or url string like "cmt://hit_thresholds_tpc?version=ONLINE" which means'
"calling cmt."
default=(
"list-to-array://"
"xedocs://hit_thresholds"
"?as_list=True"
"&sort=pmt"
"&attr=value"
"&detector=tpc"
"&run_id=plugin.run_id"
"&version=ONLINE"
),
help="Minimum hit amplitude in ADC counts above baseline. "
"Specify as a tuple of length n_tpc_pmts, or a number,"
'or a string like "legacy-thresholds://pmt_commissioning_initial" which means calling'
"hitfinder_thresholds.py"
'or url string like "cmt://hit_thresholds_tpc?version=ONLINE" which means'
"calling cmt.",
)

hit_min_height_over_noise = straxen.URLConfig(
Expand Down
22 changes: 20 additions & 2 deletions straxen/plugins/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,30 @@

NV_HIT_DEFAULTS = {
"save_outside_hits_nv": (3, 15),
"hit_min_amplitude_nv": "cmt://hit_thresholds_nv?version=ONLINE&run_id=plugin.run_id",
"hit_min_amplitude_nv": (
"list-to-array://"
"xedocs://hit_thresholds"
"?as_list=True"
"&sort=pmt"
"&attr=value"
"&detector=neutron_veto"
"&run_id=plugin.run_id"
"&version=ONLINE"
),
}

MV_HIT_DEFAULTS = {
"save_outside_hits_mv": (2, 5),
"hit_min_amplitude_mv": "cmt://hit_thresholds_mv?version=ONLINE&run_id=plugin.run_id",
"hit_min_amplitude_mv": (
"list-to-array://"
"xedocs://hit_thresholds"
"?as_list=True"
"&sort=pmt"
"&attr=value"
"&detector=muon_veto"
"&run_id=plugin.run_id"
"&version=ONLINE"
),
}

FAKE_MERGED_S2_TYPE = -42
37 changes: 18 additions & 19 deletions straxen/plugins/events/corrected_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,55 +30,54 @@ class CorrectedAreas(strax.Plugin):

# Descriptor configs
elife = straxen.URLConfig(
default="cmt://elife?version=ONLINE&run_id=plugin.run_id", help="electron lifetime in [ns]"
default="xedocs://electron_lifetimes?attr=value&run_id=plugin.run_id&version=ONLINE",
help="electron lifetime in [ns]",
)

default_reconstruction_algorithm = straxen.URLConfig(
default=DEFAULT_POSREC_ALGO, help="default reconstruction algorithm that provides (x,y)"
)
s1_xyz_map = straxen.URLConfig(
default=(
"itp_map://resource://cmt://format://"
"s1_xyz_map_{algo}?version=ONLINE&run_id=plugin.run_id"
"&fmt=json&algo=plugin.default_reconstruction_algorithm"
),
default="itp_map://"
"resource://"
"xedocs://s1_xyz_maps"
"?version=ONLINE&run_id=plugin.run_id&attr=value"
"&fmt=json&algorithm=plugin.default_reconstruction_algorithm",
cache=True,
)
s2_xy_map = straxen.URLConfig(
default=(
"itp_map://resource://cmt://format://"
"s2_xy_map_{algo}?version=ONLINE&run_id=plugin.run_id"
"&fmt=json&algo=plugin.default_reconstruction_algorithm"
),
default="itp_map://"
"resource://"
"xedocs://s2_xy_maps"
"?version=ONLINE&run_id=plugin.run_id&attr=value"
"&fmt=json&algorithm=plugin.default_reconstruction_algorithm",
cache=True,
)

# average SE gain for a given time period. default to the value of this run in ONLINE model
# thus, by default, there will be no time-dependent correction according to se gain
avg_se_gain = straxen.URLConfig(
default="cmt://avg_se_gain?version=ONLINE&run_id=plugin.run_id",
help=(
"Nominal single electron (SE) gain in PE / electron extracted. "
"Data will be corrected to this value"
),
default="xedocs://avg_se_gains?run_id=plugin.run_id&version=ONLINE&attr=value",
help="Nominal single electron (SE) gain in PE / electron extracted. "
"Data will be corrected to this value",
)

# se gain for this run, allowing for using CMT. default to online
se_gain = straxen.URLConfig(
default="cmt://se_gain?version=ONLINE&run_id=plugin.run_id",
default="objects-to-dict://xedocs://se_gains?run_id=plugin.run_id&version=ONLINE&partition=ab&partition=cd&as_list=True&sort=partition&key_attr=partition&value_attr=value",
help="Actual SE gain for a given run (allows for time dependence)",
)

# relative extraction efficiency which can change with time and modeled by CMT.
rel_extraction_eff = straxen.URLConfig(
default="cmt://rel_extraction_eff?version=ONLINE&run_id=plugin.run_id",
default="objects-to-dict://xedocs://rel_extraction_effs?partition=ab&partition=cd&run_id=plugin.run_id&sort=partition&as_list=True&version=ONLINE&key_attr=partition&value_attr=value",
help="Relative extraction efficiency for this run (allows for time dependence)",
)

# relative light yield
# defaults to no correction
rel_light_yield = straxen.URLConfig(
default="cmt://relative_light_yield?version=ONLINE&run_id=plugin.run_id",
default="xedocs://relative_light_yield?attr=value&run_id=plugin.run_id&version=ONLINE",
help="Relative light yield (allows for time dependence)",
)

Expand Down
2 changes: 1 addition & 1 deletion straxen/plugins/events/event_basics_vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class EventBasicsVanilla(strax.Plugin):
data_kind = "events"

electron_drift_velocity = straxen.URLConfig(
default="cmt://electron_drift_velocity?version=ONLINE&run_id=plugin.run_id",
default="xedocs://electron_drift_velocities?attr=value&run_id=plugin.run_id&version=ONLINE",
cache=True,
help="Vertical electron drift velocity in cm/ns (1e4 m/ms)",
)
Expand Down
8 changes: 3 additions & 5 deletions straxen/plugins/events/event_pattern_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,18 @@ class EventPatternFit(strax.Plugin):

# Getting S1 AFT maps
s1_aft_map = straxen.URLConfig(
default=(
"itp_map://resource://cmt://s1_aft_xyz_map?version=ONLINE&run_id=plugin.run_id&fmt=json"
),
default="itp_map://resource://xedocs://s1_aft_xyz_maps?attr=value&fmt=json&run_id=plugin.run_id&version=ONLINE",
cache=True,
)

electron_drift_velocity = straxen.URLConfig(
default="cmt://electron_drift_velocity?version=ONLINE&run_id=plugin.run_id",
default="xedocs://electron_drift_velocities?attr=value&run_id=plugin.run_id&version=ONLINE",
cache=True,
help="Vertical electron drift velocity in cm/ns (1e4 m/ms)",
)

electron_drift_time_gate = straxen.URLConfig(
default="cmt://electron_drift_time_gate?version=ONLINE&run_id=plugin.run_id",
default="xedocs://electron_drift_time_gates?attr=value&run_id=plugin.run_id&version=ONLINE",
help="Electron drift time from the gate in ns",
cache=True,
)
Expand Down
2 changes: 1 addition & 1 deletion straxen/plugins/events/event_position_uncertainty.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class EventPositionContour(strax.Plugin):
)

electron_drift_velocity = straxen.URLConfig(
default="cmt://electron_drift_velocity?version=ONLINE&run_id=plugin.run_id",
default="xedocs://electron_drift_velocities?attr=value&run_id=plugin.run_id&version=ONLINE",
cache=True,
help="Vertical electron drift velocity in cm/ns (1e4 m/ms)",
)
Expand Down
4 changes: 2 additions & 2 deletions straxen/plugins/events/event_positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class EventPositions(strax.Plugin):
)

electron_drift_velocity = straxen.URLConfig(
default="cmt://electron_drift_velocity?version=ONLINE&run_id=plugin.run_id",
default="xedocs://electron_drift_velocities?attr=value&run_id=plugin.run_id&version=ONLINE",
cache=True,
help="Vertical electron drift velocity in cm/ns (1e4 m/ms)",
)

electron_drift_time_gate = straxen.URLConfig(
default="cmt://electron_drift_time_gate?version=ONLINE&run_id=plugin.run_id",
default="xedocs://electron_drift_time_gates?attr=value&run_id=plugin.run_id&version=ONLINE",
help="Electron drift time from the gate in ns",
cache=True,
)
Expand Down
14 changes: 7 additions & 7 deletions straxen/plugins/events/event_s2_positions_mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ class EventS2PositionMLP(EventS2PositionBase):
default=(
"tf://"
"resource://"
f"cmt://{algorithm}_model"
"?version=ONLINE"
"&run_id=plugin.run_id"
"xedocs://posrec_models"
"?attr=value"
"&fmt=abs_path"
"&kind=mlp"
"&run_id=plugin.run_id"
"&version=ONLINE"
),
help=(
'MLP model. Should be opened using the "tf" descriptor. '
'Set to "None" to skip computation'
),
help='MLP model. Should be opened using the "tf" descriptor. '
'Set to "None" to skip computation',
cache=3,
)
2 changes: 1 addition & 1 deletion straxen/plugins/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Events(strax.OverlapWindowPlugin):
events_seen = 0

electron_drift_velocity = straxen.URLConfig(
default="cmt://electron_drift_velocity?version=ONLINE&run_id=plugin.run_id",
default="xedocs://electron_drift_velocities?attr=value&run_id=plugin.run_id&version=ONLINE",
cache=True,
help="Vertical electron drift velocity in cm/ns (1e4 m/ms)",
)
Expand Down
2 changes: 1 addition & 1 deletion straxen/plugins/events/multi_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class EventInfoMS(strax.Plugin):
)
lxe_w = straxen.URLConfig(default=13.7e-3, help="LXe work function in quanta/keV")
electron_drift_velocity = straxen.URLConfig(
default="cmt://electron_drift_velocity?version=ONLINE&run_id=plugin.run_id",
default="xedocs://electron_drift_velocities?attr=value&run_id=plugin.run_id&version=ONLINE",
cache=True,
help="Vertical electron drift velocity in cm/ns (1e4 m/ms)",
)
Expand Down
11 changes: 10 additions & 1 deletion straxen/plugins/events_nv/event_waveform_nv.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ class nVETOEventWaveform(strax.Plugin):
compressor = "zstd"

gain_model_nv = straxen.URLConfig(
default="cmt://to_pe_model_nv?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://"
"xedocs://pmt_area_to_pes"
"?as_list=True"
"&sort=pmt"
"&detector=neutron_veto"
"&run_id=plugin.run_id"
"&version=ONLINE"
"&attr=value"
),
infer_type=False,
help="PMT gain model. Specify as (model_type, model_config, nT = True)",
)
Expand Down
11 changes: 10 additions & 1 deletion straxen/plugins/hitlets_mv/hitlets_mv.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,16 @@ class muVETOHitlets(nVETOHitlets):
)

gain_model_mv = straxen.URLConfig(
default="cmt://to_pe_model_mv?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://"
"xedocs://pmt_area_to_pes"
"?as_list=True"
"&sort=pmt"
"&detector=muon_veto"
"&run_id=plugin.run_id"
"&version=ONLINE"
"&attr=value"
),
infer_type=False,
child_option=True,
parent_option_name="gain_model_nv",
Expand Down
13 changes: 11 additions & 2 deletions straxen/plugins/hitlets_nv/hitlets_nv.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,20 @@ class nVETOHitlets(strax.Plugin):
channel_map = straxen.URLConfig(
track=False,
type=immutabledict,
help="immutabledict mapping subdetector to (min, max) " "channel number.",
help="immutabledict mapping subdetector to (min, max) channel number.",
)

gain_model_nv = straxen.URLConfig(
default="cmt://to_pe_model_nv?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://"
"xedocs://pmt_area_to_pes"
"?as_list=True"
"&sort=pmt"
"&detector=neutron_veto"
"&run_id=plugin.run_id"
"&version=ONLINE"
"&attr=value"
),
infer_type=False,
help="PMT gain model. Specify as (model_type, model_config, nT = True)",
)
Expand Down
Loading
Loading