Skip to content

Commit

Permalink
Implement Hyperruns (#65)
Browse files Browse the repository at this point in the history
* Implement Hyperruns

* Minor change
  • Loading branch information
dachengx authored May 4, 2024
1 parent b767457 commit e736a92
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions axidence/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
}


allow_hyperrun_suffix = ["Paired"]


default_assign_appended_attributes: dict = {}


Expand Down Expand Up @@ -151,6 +154,9 @@ def assign_plugin_attributes(
if hasattr(old_instance, "loop_over"):
new_plugin.loop_over = old_instance.loop_over + snake

if suffix in allow_hyperrun_suffix:
new_plugin.allow_hyperrun = True

return new_plugin


Expand Down
9 changes: 8 additions & 1 deletion axidence/plugins/cuts/cut_isolated_s2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import strax
from strax import parse_selection, CutPlugin
from strax import SaveWhen
import straxen
from straxen import Events

export, __all__ = strax.exporter()

trigger_min_area = Events.takes_config["trigger_min_area"].default


@export
class IsolatedS2Mask(CutPlugin):
__version__ = "0.0.0"
depends_on = "event_basics"
Expand All @@ -13,7 +20,7 @@ class IsolatedS2Mask(CutPlugin):
save_when = SaveWhen.NEVER

isolated_s2_area_range = straxen.URLConfig(
default=(1e2, 2e4),
default=(trigger_min_area, 2e4),
type=(list, tuple),
help="Range of isolated S2 area",
)
Expand Down
1 change: 1 addition & 0 deletions axidence/plugins/cuts/cut_pairing_exists.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class PairingExists(CutPlugin):
cut_description = (
"Whether isolated S2 influenced by pairing, and whether the event is considered as AC event"
)
allow_hyperrun = True

def cut_by(self, events_paired):
return np.isin(events_paired["event_type"], [1, 3])
2 changes: 2 additions & 0 deletions axidence/plugins/pairing/events_paired.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class EventsForcePaired(OverlapWindowPlugin):
provides = "events_paired"
data_kind = "events_paired"
save_when = strax.SaveWhen.EXPLICIT
allow_hyperrun = True

paring_time_interval = straxen.URLConfig(
default=int(1e8),
Expand Down Expand Up @@ -57,6 +58,7 @@ class EventInfosPaired(Events):
provides = "event_infos_paired"
data_kind = "events_paired"
save_when = strax.SaveWhen.EXPLICIT
allow_hyperrun = True

ambience_fields = straxen.URLConfig(
default=["lh_before", "s0_before", "s1_before", "s2_before", "s2_near"],
Expand Down
3 changes: 3 additions & 0 deletions axidence/plugins/pairing/peaks_paired.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class PeaksPaired(ExhaustPlugin, DownChunkingPlugin):
data_kind = immutabledict(zip(provides, provides))
save_when = immutabledict(zip(provides, [strax.SaveWhen.EXPLICIT, strax.SaveWhen.ALWAYS]))
rechunk_on_save = immutabledict(zip(provides, [False, True]))
allow_hyperrun = True

pairing_seed = straxen.URLConfig(
default=None,
Expand Down Expand Up @@ -750,6 +751,7 @@ class PeakProximityPaired(PeakProximity):
provides = "peak_proximity_paired"
data_kind = "peaks_paired"
save_when = strax.SaveWhen.EXPLICIT
allow_hyperrun = True

use_origin_n_competing = straxen.URLConfig(
default=False,
Expand Down Expand Up @@ -809,6 +811,7 @@ class PeakPositionsPaired(Plugin):
depends_on = "peaks_paired"
provides = "peak_positions_paired"
save_when = strax.SaveWhen.EXPLICIT
allow_hyperrun = True

def infer_dtype(self):
return peak_positions_dtype()
Expand Down

0 comments on commit e736a92

Please sign in to comment.