Skip to content

Commit

Permalink
Add EventBuilding cut (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx authored Apr 24, 2024
1 parent c2cf907 commit 5a51281
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
2 changes: 2 additions & 0 deletions axidence/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
SaltedEventAmbience,
SaltedEventSEDensity,
)
from axidence import EventBuilding


def unsalted_context(**kwargs):
Expand All @@ -36,5 +37,6 @@ def salt_to_context(self):
SaltedEventShadow,
SaltedEventAmbience,
SaltedEventSEDensity,
EventBuilding,
)
)
3 changes: 3 additions & 0 deletions axidence/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

from . import pairing
from .pairing import *

from . import cuts
from .cuts import *
2 changes: 2 additions & 0 deletions axidence/plugins/cuts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import cut_event_building
from .cut_event_building import *
14 changes: 14 additions & 0 deletions axidence/plugins/cuts/cut_event_building.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from strax import CutPlugin


class EventBuilding(CutPlugin):
__version__ = "0.0.0"
depends_on = "event_basics"
provides = "cut_event_building"
cut_name = "cut_event_building"
cut_description = "Whether the salting S1 or S2 can be the main S1 or S2"

def cut_by(self, events):
mask = events["s1_salt_number"] >= 0
mask &= events["s2_salt_number"] >= 0
return mask
6 changes: 3 additions & 3 deletions tests/test_deps_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def test_deps_tree():
"""This test can tell us whether the dependency tree is correct or not."""
st = axidence.unsalted_context()
st.salt_to_context()
st.dependency_tree("event_shadow", to_dir="./graphs_nT")
st.dependency_tree("event_ambience", to_dir="./graphs_nT")
st.dependency_tree("event_se_density", to_dir="./graphs_nT")
graph_dir = "./graphs_nT"
for p in ["event_shadow", "event_ambience", "event_se_density", "cut_event_building"]:
st.dependency_tree(p, to_dir=graph_dir)

0 comments on commit 5a51281

Please sign in to comment.