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

Rename old PeakletClassification as PeakletClassificationVanilla #1487

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
70 changes: 35 additions & 35 deletions straxen/plugins/events/__init__.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,63 @@
from . import corrected_areas
from .corrected_areas import *
from . import events
from .events import *

from . import distinct_channels
from .distinct_channels import *
from . import event_basics_som
from .event_basics_som import *

from . import energy_estimates
from .energy_estimates import *
from . import event_basics_vanilla
from .event_basics_vanilla import *

from . import event_positions
from .event_positions import *

from . import event_ambience
from .event_ambience import *

from . import event_area_per_channel
from .event_area_per_channel import *
from . import event_shadow
from .event_shadow import *

from . import event_waveform
from .event_waveform import *
from . import event_se_score
from .event_se_score import *

from . import event_top_bottom_params
from .event_top_bottom_params import *
from . import veto_proximity
from .veto_proximity import *

from . import event_basics
from .event_basics import *
from . import distinct_channels
from .distinct_channels import *

from . import energy_estimates
from .energy_estimates import *

from . import corrected_areas
from .corrected_areas import *

from . import event_info
from .event_info import *

from . import event_info_double
from .event_info_double import *
from . import event_area_per_channel
from .event_area_per_channel import *

from . import event_pattern_fit
from .event_pattern_fit import *

from . import event_positions
from .event_positions import *
from . import event_info_double
from .event_info_double import *

from . import event_shadow
from .event_shadow import *
from . import event_nearest_triggering
from .event_nearest_triggering import *

from . import event_waveform
from .event_waveform import *

from . import event_top_bottom_params
from .event_top_bottom_params import *

from . import event_w_bayes_class
from .event_w_bayes_class import *

from . import events
from .events import *

from . import s2_recon_pos_diff
from .s2_recon_pos_diff import *

from . import veto_proximity
from .veto_proximity import *

from . import event_position_uncertainty
from .event_position_uncertainty import *

Expand All @@ -63,12 +72,3 @@

from . import multi_scatter
from .multi_scatter import *

from . import event_basics_som
from .event_basics_som import *

from . import event_nearest_triggering
from .event_nearest_triggering import *

from . import event_se_score
from .event_se_score import *
4 changes: 2 additions & 2 deletions straxen/plugins/events/event_basics_som.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import strax
import numpy as np

from straxen.plugins.events.event_basics import EventBasics
from straxen.plugins.events.event_basics_vanilla import EventBasicsVanilla

export, __all__ = strax.exporter()


@export
class EventBasicsSOM(EventBasics):
class EventBasicsSOM(EventBasicsVanilla):
"""Adds SOM fields for S1 and S2 peaks to event basics."""

__version__ = "0.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


@export
class EventBasics(strax.Plugin):
class EventBasicsVanilla(strax.Plugin):
"""Computes the basic properties of the main/alternative S1/S2 within an event.
The main S1 and alternative S1 are given by the largest two S1-Peaks within the event. The main
Expand Down
2 changes: 1 addition & 1 deletion straxen/plugins/events/event_nearest_triggering.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def compute(self, events, peaks):
split_peaks = strax.split_by_containment(peaks, events)
result = np.zeros(len(events), self.dtype)

straxen.EventBasics.set_nan_defaults(result)
straxen.EventBasicsVanilla.set_nan_defaults(result)

# 1. Assign peaks features to main S1 and main S2 in the event
for event_i, (event, sp) in enumerate(zip(events, split_peaks)):
Expand Down
2 changes: 1 addition & 1 deletion straxen/plugins/events/event_shadow.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def compute(self, events, peaks):
split_peaks = strax.split_by_containment(peaks, events)
result = np.zeros(len(events), self.dtype)

straxen.EventBasics.set_nan_defaults(result)
straxen.EventBasicsVanilla.set_nan_defaults(result)

# 1. Assign peaks features to main S1 and main S2 in the event
for event_i, (event, sp) in enumerate(zip(events, split_peaks)):
Expand Down
2 changes: 1 addition & 1 deletion straxen/plugins/events_nv/event_positions_nv.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def compute(self, events_nv, hitlets_nv):
angle = get_average_angle(hits_in_events, self.pmt_properties)
event_angles["angle"] = angle
compute_positions(event_angles, hits_in_events, self.pmt_properties)
strax.copy_to_buffer(events_nv, event_angles, f"_copy_events_nv")
strax.copy_to_buffer(events_nv, event_angles, "_copy_events_nv")

return event_angles

Expand Down
6 changes: 3 additions & 3 deletions straxen/plugins/peaklets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from . import peaklets
from .peaklets import *

from . import peaklet_classification
from .peaklet_classification import *

from . import peaklet_classification_som
from .peaklet_classification_som import *

from . import peaklet_classification_vanilla
from .peaklet_classification_vanilla import *

from . import peaklet_positions_cnf
from .peaklet_positions_cnf import *

Expand Down
4 changes: 2 additions & 2 deletions straxen/plugins/peaklets/peaklet_classification_som.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import numpy.lib.recfunctions as rfn
from scipy.spatial.distance import cdist
from straxen.plugins.peaklets.peaklet_classification import PeakletClassification
from straxen.plugins.peaklets.peaklet_classification_vanilla import PeakletClassificationVanilla
import numba

import strax
Expand All @@ -11,7 +11,7 @@


@export
class PeakletClassificationSOM(PeakletClassification):
class PeakletClassificationSOM(PeakletClassificationVanilla):
"""
Self-Organizing Maps (SOM)
https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenonnt:lsanchez:unsupervised_neural_network_som_methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@


@export
class PeakletClassification(strax.Plugin):
class PeakletClassificationVanilla(strax.Plugin):
"""Classify peaklets as unknown, S1, or S2."""

__version__ = "3.0.3"

provides: Union[str, tuple] = "peaklet_classification"
depends_on = "peaklets"
provides: Union[str, tuple] = "peaklet_classification"
dtype = strax.peak_interval_dtype + [("type", np.int8, "Classification of the peak(let)")]

s1_risetime_area_parameters = straxen.URLConfig(
Expand Down
11 changes: 6 additions & 5 deletions straxen/plugins/peaklets_he/peaklet_classification_he.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import strax

from straxen.plugins.peaklets.peaklet_classification import PeakletClassification
from straxen.plugins.peaklets.peaklet_classification_vanilla import PeakletClassificationVanilla
from straxen.plugins.defaults import HE_PREAMBLE

export, __all__ = strax.exporter()


@export
class PeakletClassificationHighEnergy(PeakletClassification):
__doc__ = HE_PREAMBLE + (PeakletClassification.__doc__ or "")
provides = "peaklet_classification_he"
depends_on = "peaklets_he"
class PeakletClassificationHighEnergy(PeakletClassificationVanilla):
__doc__ = HE_PREAMBLE + (PeakletClassificationVanilla.__doc__ or "")

__version__ = "0.0.2"
child_plugin = True
depends_on = "peaklets_he"
provides = "peaklet_classification_he"

def compute(self, peaklets_he):
return super().compute(peaklets_he)
52 changes: 26 additions & 26 deletions straxen/plugins/peaks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
from . import peak_top_bottom_params
from .peak_top_bottom_params import *

from . import peak_ambience
from .peak_ambience import *
from . import peaks_som
from .peaks_som import *

from . import peak_basics
from .peak_basics import *
from . import peaks_vanilla
from .peaks_vanilla import *

from . import peak_classification_bayes
from .peak_classification_bayes import *
from . import peak_basics_som
from .peak_basics_som import *

from . import peak_s1_positions_cnn
from .peak_s1_positions_cnn import *
from . import peak_basics_vanilla
from .peak_basics_vanilla import *

from . import peak_positions_cnf
from .peak_positions_cnf import *
Expand All @@ -22,29 +19,32 @@
from . import peak_positions
from .peak_positions import *

from . import peak_proximity
from .peak_proximity import *
from . import peak_ambience
from .peak_ambience import *

from . import peak_shadow
from .peak_shadow import *

from . import peaks
from .peaks import *
from . import peak_se_score
from .peak_se_score import *

from . import peak_proximity
from .peak_proximity import *

from . import peak_nearest_triggering
from .peak_nearest_triggering import *

from . import peak_top_bottom_params
from .peak_top_bottom_params import *

from . import peak_s1_positions_cnn
from .peak_s1_positions_cnn import *

from . import peak_per_event
from .peak_per_event import *

from . import peak_corrections
from .peak_corrections import *

from . import peaks_som
from .peaks_som import *

from . import peak_basics_som
from .peak_basics_som import *

from . import peak_nearest_triggering
from .peak_nearest_triggering import *

from . import peak_se_score
from .peak_se_score import *
from . import peak_classification_bayes
from .peak_classification_bayes import *
4 changes: 2 additions & 2 deletions straxen/plugins/peaks/_peak_positions_base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import strax
from .peaks import Peaks
from .peaks_vanilla import PeaksVanilla

export, __all__ = strax.exporter()


@export
class PeakPositionsBase(Peaks):
class PeakPositionsBase(PeaksVanilla):

__version__ = "0.0.0"
child_plugin = True
Expand Down
4 changes: 2 additions & 2 deletions straxen/plugins/peaks/peak_basics_som.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import numpy as np
import strax
from straxen.plugins.peaks.peak_basics import PeakBasics
from straxen.plugins.peaks.peak_basics_vanilla import PeakBasicsVanilla

export, __all__ = strax.exporter()


@export
class PeakBasicsSOM(PeakBasics):
class PeakBasicsSOM(PeakBasicsVanilla):
"""Adds SOM fields to peak basics to be propgated to event basics."""

__version__ = "0.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


@export
class PeakBasics(strax.Plugin):
class PeakBasicsVanilla(strax.Plugin):
"""Compute the basic peak-properties, thereby dropping structured arrays.

NB: This plugin can therefore be loaded as a pandas DataFrame.
Expand Down
2 changes: 1 addition & 1 deletion straxen/plugins/peaks/peak_nearest_triggering.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def compute_triggering(self, peaks, current_peak):
_peaks = _peaks[_is_triggering]
# init result
result = np.zeros(len(current_peak), self.dtype)
straxen.EventBasics.set_nan_defaults(result)
straxen.EventBasicsVanilla.set_nan_defaults(result)

# use center_time as the anchor of things
things = np.zeros(len(_peaks), dtype=strax.time_fields)
Expand Down
2 changes: 1 addition & 1 deletion straxen/plugins/peaks/peak_per_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def compute(self, events, peaks):
split_peaks = strax.split_by_containment(peaks, events)
split_peaks_ind = strax.fully_contained_in(peaks, events)
result = np.zeros(len(peaks), self.dtype)
straxen.EventBasics.set_nan_defaults(result)
straxen.EventBasicsVanilla.set_nan_defaults(result)

# Assign peaks features to main S1 and main S2 in the event
for event_i, (event, sp) in enumerate(zip(events, split_peaks)):
Expand Down
6 changes: 3 additions & 3 deletions straxen/plugins/peaks/peaks_som.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import strax
import numpy as np
from straxen.plugins.peaks.peaks import Peaks
from straxen.plugins.peaks.peaks_vanilla import PeaksVanilla

export, __all__ = strax.exporter()


@export
class PeaksSOM(Peaks):
class PeaksSOM(PeaksVanilla):
"""Same as Peaks but include in addition SOM type field to be propagated to event_basics.
Thus, only change dtype.
Expand All @@ -30,7 +30,7 @@ def infer_dtype(self):
def compute(self, peaklets, merged_s2s):
result = super().compute(peaklets, merged_s2s)

# For merged S2s SOM and straxen type are undefined:
# For merged_s2s SOM and straxen type are undefined:
_is_merged_s2 = np.isin(result["time"], merged_s2s["time"]) & np.isin(
strax.endtime(result), strax.endtime(merged_s2s)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@export
class Peaks(strax.Plugin):
class PeaksVanilla(strax.Plugin):
"""Merge peaklets and merged S2s such that we obtain our peaks (replacing all peaklets that were
later re-merged as S2s).
Expand Down
Loading