Skip to content

Commit

Permalink
Deprecate selection_str (#1424)
Browse files Browse the repository at this point in the history
* Deprecate selection_str

* Ignore untested scripts
  • Loading branch information
dachengx authored Sep 13, 2024
1 parent f436f7f commit 7f7e0c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
9 changes: 5 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# .coveragerc to control coverage.py
[report]
omit =
./straxen/storage/rucio_remote.py
./straxen/legacy/plugins_1t/pax_interface.py
./straxen/entry_points.py
./straxen/daq_core.py
straxen/storage/rucio_remote.py
straxen/legacy/plugins_1t/pax_interface.py
straxen/entry_points.py
straxen/daq_core.py
straxen/scripts/*.py

# Regexes for lines to exclude from consideration
exclude_lines =
Expand Down
8 changes: 4 additions & 4 deletions straxen/mini_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def wrapped_f(context: strax.Context, run_id: str, **kwargs):
known_kwargs = (
"time_range seconds_range time_within time_selection "
"ignore_time_warning "
"selection_str t_reference to_pe config"
"selection t_reference to_pe config"
).split()
for k in kwargs:
if k not in known_kwargs and k not in parameters:
Expand Down Expand Up @@ -76,7 +76,7 @@ def wrapped_f(context: strax.Context, run_id: str, **kwargs):
**{k: kwargs.get(k) for k in ("time_range seconds_range time_within".split())},
)
kwargs.setdefault("time_selection", default_time_selection)
kwargs.setdefault("selection_str", None)
kwargs.setdefault("selection", None)

kwargs["t_reference"], _ = context.estimate_run_start_and_end(run_id, requires)

Expand All @@ -103,15 +103,15 @@ def wrapped_f(context: strax.Context, run_id: str, **kwargs):
# Already have data, just apply cuts
kwargs[dkind] = strax.apply_selection(
kwargs[dkind],
selection_str=kwargs["selection_str"],
selection=kwargs["selection"],
time_range=kwargs["time_range"],
time_selection=kwargs["time_selection"],
)
else:
kwargs[dkind] = context.get_array(
run_id,
dtypes,
selection_str=kwargs["selection_str"],
selection=kwargs["selection"],
time_range=kwargs["time_range"],
time_selection=kwargs["time_selection"],
# Arguments for new context, if needed
Expand Down
6 changes: 3 additions & 3 deletions straxen/plugins/online_peak_monitor/online_peak_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class OnlinePeakMonitor(strax.Plugin):
type=str,
default="",
help=(
"Selection (like selection_str) applied to data for "
"Selection (like selection) applied to data for "
'"area_vs_width_hist_clean", cuts should be separated using "&"'
"For example: (tight_coincidence > 2) & (area_fraction_top < 0.1)"
'Default is no selection (other than "area_vs_width_min_gap")'
Expand All @@ -70,7 +70,7 @@ class OnlinePeakMonitor(strax.Plugin):
type=str,
default="(area >= 50) & (area <= 250)",
help=(
"Selection (like selection_str) applied to data for "
"Selection (like selection) applied to data for "
'"lone-hits", cuts should be separated using "&")'
),
)
Expand Down Expand Up @@ -149,7 +149,7 @@ def compute(self, peaks, lone_hits, start, end):
mask &= np.hstack([lh_timedelta > self.lone_hits_min_gap, True])
else:
mask = []
masked_lh = strax.apply_selection(lone_hits[mask], selection_str=self.lone_hits_cut_string)
masked_lh = strax.apply_selection(lone_hits[mask], selection=self.lone_hits_cut_string)

# Make histogram of ADC counts
# NB: LONE HITS AREA ARE IN ADC!
Expand Down
4 changes: 2 additions & 2 deletions straxen/scripts/microstrax.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_data(
max_n: hug.types.number = 1000,
start: hug.types.float_number = None,
end: hug.types.float_number = None,
selection_str: hug.types.text = None,
selection: hug.types.text = None,
):
try:
st
Expand Down Expand Up @@ -116,7 +116,7 @@ def get_data(
f"take more than {max_load_mb} MB RAM to load."
)

x = st.get_array(run_id, target, time_range=time_range, selection_str=selection_str)
x = st.get_array(run_id, target, time_range=time_range, selection=selection)
if max_n:
x = x[:max_n]
size_mb = x.nbytes / int(1e6)
Expand Down

0 comments on commit 7f7e0c1

Please sign in to comment.