straxen.plugins.peaks package

Submodules

straxen.plugins.peaks.peak_ambience module

class straxen.plugins.peaks.peak_ambience.PeakAmbience[source]

Bases: OverlapWindowPlugin

Calculate Ambience of peaks. Features are the number of lonehits, small S0, S1, S2 in a time window before peaks, and the number of small S2 in circle near the S2 peak in a time window.

References:
  • v0.0.7 reference: xenon:xenonnt:ac:prediction:shadow_ambience

ambience_area_parameters

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

ambience_divide_r

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

ambience_divide_t

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

ambience_time_window_backward

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

ambient_radius

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

compute(lone_hits, peaks)[source]
compute_ambience(lone_hits, peaks, current_peak)[source]
config: Dict
data_kind: str | immutabledict | dict = 'peaks'
depends_on: tuple = ('lone_hits', 'peak_basics', 'peak_positions')
deps: Dict
dtype: tuple | dtype | immutabledict | dict
get_window_size()[source]

Return the required window size in nanoseconds.

infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

input_buffer: Dict[str, Chunk]
static lonehits_ambience(peaks, pre_hits, touching_windows, num_array, sum_array, ambience_divide_t)[source]
property origin_dtype
static peaks_ambience(peaks, pre_peaks, touching_windows, ambient_radius, num_array, sum_array, ambience_divide_t, ambience_divide_r)[source]
provides: tuple = ('peak_ambience',)
run_i: int
run_id: str
save_when = 1
takes_config = immutabledict({'ambience_time_window_backward': <straxen.url_config.URLConfig object>, 'ambience_divide_t': <straxen.url_config.URLConfig object>, 'ambience_divide_r': <straxen.url_config.URLConfig object>, 'ambient_radius': <straxen.url_config.URLConfig object>, 'ambience_area_parameters': <straxen.url_config.URLConfig object>})

straxen.plugins.peaks.peak_basics module

class straxen.plugins.peaks.peak_basics.PeakBasics[source]

Bases: Plugin

Compute the basic peak-properties, thereby dropping structured arrays.

NB: This plugin can therefore be loaded as a pandas DataFrame.

static check_area(area_per_channel_sum, peaks, rtol) None[source]

Check if the area of the sum-wf is the same as the total area (if the area of the peak is positively defined).

Parameters:
  • area_per_channel_sum – the summation of the peaks[‘area_per_channel’] which will be checked against the values of peaks[‘area’].

  • peaks – array of peaks.

  • rtol – relative tolerance for difference between area_per_channel_sum and peaks[‘area’]. See np.isclose.

Raises:

ValueError if the peak area and the area-per-channel sum are not sufficiently close

check_peak_sum_area_rtol

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

compute(peaks)[source]
static compute_center_times(peaks)[source]
config: Dict
data_kind: str | immutabledict | dict
depends_on: tuple = 'peaks'
deps: Dict
dtype: tuple | dtype | immutabledict | dict
infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

input_buffer: Dict[str, Chunk]
n_top_pmts

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

parallel: str | bool = True
provides: tuple = ('peak_basics',)
run_i: int
run_id: str
takes_config = immutabledict({'n_top_pmts': <straxen.url_config.URLConfig object>, 'check_peak_sum_area_rtol': <straxen.url_config.URLConfig object>})

straxen.plugins.peaks.peak_classification_bayes module

class straxen.plugins.peaks.peak_classification_bayes.BayesPeakClassification[source]

Bases: Plugin

Bayes Peak classification Returns the ln probability of a each event belonging to the S1 and S2 class. Uses conditional probabilities and data parameterization learned from wfsim data. More info can be found here xenon:xenonnt:ahiguera:bayespeakclassification.

Parameters:
  • peaks – peaks

  • waveforms – peaks waveforms in PE/ns

  • quantiles – quantiles in ns, calculate from a cumulative sum over the waveform, from zero to the total area with normalized cumulative sum to determine the time

Returns:

the ln probability of a each peak belonging to S1 and S2 class

bayes_config_file

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

bayes_n_nodes

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

compute(peaks)[source]
config: Dict
data_kind: str | immutabledict | dict
depends_on: tuple = 'peaks'
deps: Dict
dtype: tuple | dtype | immutabledict | dict = [(('Start time since unix epoch [ns]', 'time'), <class 'numpy.int64'>), (('Exclusive end time since unix epoch [ns]', 'endtime'), <class 'numpy.int64'>), ('ln_prob_s1', <class 'numpy.float32'>, 'S1 ln probability'), ('ln_prob_s2', <class 'numpy.float32'>, 'S2 ln probability')]
input_buffer: Dict[str, Chunk]
n_bayes_classes

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

provides: tuple = ('peak_classification_bayes',)
run_i: int
run_id: str
setup()[source]

Hook if plugin wants to do something on initialization.

takes_config = immutabledict({'bayes_config_file': <straxen.url_config.URLConfig object>, 'bayes_n_nodes': <straxen.url_config.URLConfig object>, 'n_bayes_classes': <straxen.url_config.URLConfig object>})

straxen.plugins.peaks.peak_corrections module

class straxen.plugins.peaks.peak_corrections.PeakCorrectedAreas[source]

Bases: CorrectedAreas

Pluging to apply corrections on peak level assuming that the main S1 is the only physical S1.

compute(peaks)[source]
config: Dict
data_kind: Union[str, immutabledict, dict] = 'peaks'
depends_on: Tuple[str, ...] = ('peak_basics', 'peak_positions', 'peak_per_event')
deps: Dict
dtype: Union[tuple, np.dtype, immutabledict, dict]
electron_drift_time_gate

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

electron_drift_velocity

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

input_buffer: Dict[str, strax.Chunk]
provides: tuple = ('peak_corrections',)
run_i: int
run_id: str
takes_config = immutabledict({'elife': <straxen.url_config.URLConfig object>, 'default_reconstruction_algorithm': <straxen.url_config.URLConfig object>, 's1_xyz_map': <straxen.url_config.URLConfig object>, 's2_xy_map': <straxen.url_config.URLConfig object>, 'avg_se_gain': <straxen.url_config.URLConfig object>, 'se_gain': <straxen.url_config.URLConfig object>, 'rel_extraction_eff': <straxen.url_config.URLConfig object>, 'rel_light_yield': <straxen.url_config.URLConfig object>, 'region_linear': <straxen.url_config.URLConfig object>, 'region_circular': <straxen.url_config.URLConfig object>, 'cs2_bottom_top_ratio_correction': <straxen.url_config.URLConfig object>, 'electron_drift_velocity': <straxen.url_config.URLConfig object>, 'electron_drift_time_gate': <straxen.url_config.URLConfig object>})

straxen.plugins.peaks.peak_per_event module

class straxen.plugins.peaks.peak_per_event.EventPeaks[source]

Bases: Plugin

Add event number for peaks and drift times of all s2 depending on the largest s1.

Link - https://xe1t-wiki.lngs.infn.it/doku.php?id=weiss:analysis:ms_plugin

compute(events, peaks)[source]
config: Dict
data_kind: str | immutabledict | dict = 'peaks'
depends_on: tuple = ('event_basics', 'peak_basics', 'peak_positions')
deps: Dict
dtype: tuple | dtype | immutabledict | dict
infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

input_buffer: Dict[str, Chunk]
provides: tuple = ('peak_per_event',)
run_i: int
run_id: str
save_when = 2

straxen.plugins.peaks.peak_positions module

class straxen.plugins.peaks.peak_positions.PeakPositionsNT[source]

Bases: MergeOnlyPlugin

Merge the reconstructed algorithms of the different algorithms into a single one that can be used in Event Basics.

Select one of the plugins to provide the ‘x’ and ‘y’ to be used further down the chain. Since we already have the information needed here, there is no need to wait until events to make the decision.

Since the computation is trivial as it only combined the three input plugins, don’t save this plugins output.

compute(peaks)[source]
config: Dict
data_kind: str | immutabledict | dict
default_reconstruction_algorithm

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

depends_on: tuple = ('peak_positions_cnn', 'peak_positions_mlp', 'peak_positions_gcn')
deps: Dict
dtype: tuple | dtype | immutabledict | dict
infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

input_buffer: Dict[str, Chunk]
provides: tuple = ('peak_positions',)
run_i: int
run_id: str
save_when = 0
takes_config = immutabledict({'default_reconstruction_algorithm': <straxen.url_config.URLConfig object>})

straxen.plugins.peaks.peak_positions_cnn module

class straxen.plugins.peaks.peak_positions_cnn.PeakPositionsCNN[source]

Bases: PeakPositionsBaseNT

Convolutional Neural Network (CNN) neural net for position reconstruction.

algorithm: str | None = 'cnn'
provides: tuple = ('peak_positions_cnn',)
takes_config = immutabledict({'min_reconstruction_area': <straxen.url_config.URLConfig object>, 'n_top_pmts': <straxen.url_config.URLConfig object>, 'tf_model_cnn': <straxen.url_config.URLConfig object>})
tf_model_cnn

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

straxen.plugins.peaks.peak_positions_gcn module

class straxen.plugins.peaks.peak_positions_gcn.PeakPositionsGCN[source]

Bases: PeakPositionsBaseNT

Graph Convolutional Network (GCN) neural net for position reconstruction.

algorithm: str | None = 'gcn'
provides: tuple = ('peak_positions_gcn',)
takes_config = immutabledict({'min_reconstruction_area': <straxen.url_config.URLConfig object>, 'n_top_pmts': <straxen.url_config.URLConfig object>, 'tf_model_gcn': <straxen.url_config.URLConfig object>})
tf_model_gcn

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

straxen.plugins.peaks.peak_positions_mlp module

class straxen.plugins.peaks.peak_positions_mlp.PeakPositionsMLP[source]

Bases: PeakPositionsBaseNT

Multilayer Perceptron (MLP) neural net for position reconstruction.

algorithm: str | None = 'mlp'
provides: tuple = ('peak_positions_mlp',)
takes_config = immutabledict({'min_reconstruction_area': <straxen.url_config.URLConfig object>, 'n_top_pmts': <straxen.url_config.URLConfig object>, 'tf_model_mlp': <straxen.url_config.URLConfig object>})
tf_model_mlp

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

straxen.plugins.peaks.peak_proximity module

class straxen.plugins.peaks.peak_proximity.PeakProximity[source]

Bases: OverlapWindowPlugin

Look for peaks around a peak to determine how many peaks are in proximity (in time) of a peak.

compute(peaks)[source]
config: Dict
data_kind: str | immutabledict | dict
depends_on: tuple = 'peak_basics'
deps: Dict
dtype: tuple | dtype | immutabledict | dict = [('n_competing', <class 'numpy.int32'>, 'Number of nearby larger or slightly smaller peaks'), ('n_competing_left', <class 'numpy.int32'>, 'Number of larger or slightly smaller peaks left of the main peak'), ('t_to_prev_peak', <class 'numpy.int64'>, 'Time between end of previous peak and start of this peak [ns]'), ('t_to_next_peak', <class 'numpy.int64'>, 'Time between end of this peak and start of next peak [ns]'), ('t_to_nearest_peak', <class 'numpy.int64'>, 'Smaller of t_to_prev_peak and t_to_next_peak [ns]'), (('Start time since unix epoch [ns]', 'time'), <class 'numpy.int64'>), (('Exclusive end time since unix epoch [ns]', 'endtime'), <class 'numpy.int64'>)]
static find_n_competing(peaks, windows, fraction)[source]
get_window_size()[source]

Return the required window size in nanoseconds.

input_buffer: Dict[str, Chunk]
min_area_fraction

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

nearby_window

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

peak_max_proximity_time

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

provides: tuple = ('peak_proximity',)
run_i: int
run_id: str
takes_config = immutabledict({'min_area_fraction': <straxen.url_config.URLConfig object>, 'nearby_window': <straxen.url_config.URLConfig object>, 'peak_max_proximity_time': <straxen.url_config.URLConfig object>})

straxen.plugins.peaks.peak_s1_positions_cnn module

class straxen.plugins.peaks.peak_s1_positions_cnn.PeakS1PositionCNN[source]

Bases: PeakS1PositionBase

S1 CNN for (x,y,z) position S1 reconstruction at peak level.

algorithm: str | None = 's1_cnn'
provides: tuple = ('peak_s1_positions_cnn',)
takes_config = immutabledict({'min_s1_area_s1_posrec': <straxen.url_config.URLConfig object>, 'tf_model_s1_cnn': <straxen.url_config.URLConfig object>})
tf_model_s1_cnn

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

straxen.plugins.peaks.peak_shadow module

class straxen.plugins.peaks.peak_shadow.PeakShadow[source]

Bases: OverlapWindowPlugin

This plugin can find and calculate the time & position shadow from previous peaks in time. It also gives the area and (x,y) of the previous peaks.

References:
  • v0.1.5 reference: xenon:xenonnt:ac:prediction:shadow_ambience

compute(peaks)[source]
compute_shadow(peaks, current_peak)[source]
config: Dict
data_kind: str | immutabledict | dict
depends_on: tuple = ('peak_basics', 'peak_positions')
deps: Dict
dtype: tuple | dtype | immutabledict | dict
get_window_size()[source]

Return the required window size in nanoseconds.

static getsigma(sigma_and_baseline, s2)[source]
infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

input_buffer: Dict[str, Chunk]
static peaks_shadow(peaks, pre_peaks, touching_windows, exponent, result, pos_corr, sigmas=None)[source]

For each peak in peaks, check if there is a shadow-casting peak and check if it casts the largest shadow.

provides: tuple = ('peak_shadow',)
run_i: int
run_id: str
save_when = 1
shadow_deltatime_exponent

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

shadow_sigma_and_baseline

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

shadow_threshold

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

shadow_time_window_backward

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

property shadowdtype
takes_config = immutabledict({'shadow_time_window_backward': <straxen.url_config.URLConfig object>, 'shadow_threshold': <straxen.url_config.URLConfig object>, 'shadow_deltatime_exponent': <straxen.url_config.URLConfig object>, 'shadow_sigma_and_baseline': <straxen.url_config.URLConfig object>})

straxen.plugins.peaks.peak_top_bottom_params module

class straxen.plugins.peaks.peak_top_bottom_params.PeakTopBottomParams[source]

Bases: Plugin

Pluging that computes timing characteristics of top and bottom waveforms based on waveforms stored at peak level.

compute(peaks)[source]
config: Dict
data_kind: str | immutabledict | dict
depends_on: tuple = ('peaks', 'peak_basics')
deps: Dict
dtype: tuple | dtype | immutabledict | dict
infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

input_buffer: Dict[str, Chunk]
provides: tuple = ('peak_top_bottom_params',)
run_i: int
run_id: str

straxen.plugins.peaks.peaks module

class straxen.plugins.peaks.peaks.Peaks[source]

Bases: Plugin

Merge peaklets and merged S2s such that we obtain our peaks (replacing all peaklets that were later re-merged as S2s).

As this step is computationally trivial, never save this plugin.

compressor = 'zstd'
compute(peaklets, merged_s2s)[source]
config: Dict
data_kind: str | immutabledict | dict = 'peaks'
depends_on: tuple = ('peaklets', 'peaklet_classification', 'merged_s2s')
deps: Dict
diagnose_sorting

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

dtype: tuple | dtype | immutabledict | dict
infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

input_buffer: Dict[str, Chunk]
merge_without_s1

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

parallel: str | bool = True
provides: tuple = ('peaks',)
run_i: int
run_id: str
save_when = 1
takes_config = immutabledict({'diagnose_sorting': <straxen.url_config.URLConfig object>, 'merge_without_s1': <straxen.url_config.URLConfig object>})

straxen.plugins.peaks.peaks_subtyping module

Module contents