Skip to content

Manually adjusting SEG or EE will trigger numpy errors #320

@sebvetter

Description

@sebvetter

In the Electron Extraction plugin we sample the number of extracted electrons according to a binomial distribution with a probability distribution according to the CY.

If we adjust the SE gain, or manually set the EE, this number can be arbitrary (and therefore no longer fit as a probability for the binomial) resulting in this numpy error:

File /opt/XENONnT/anaconda/envs/XENONnT_el7.2025.03.1/lib/python3.11/site-packages/fuse/plugins/detector_physics/electron_extraction.py:121, in ElectronExtraction.compute(self, interactions_in_roi)
118 else:
119 cy = self.electron_extraction_yield
--> 121 n_electron = self.rng.binomial(n=interactions_in_roi[mask]["n_electron_interface"], p=cy)
123 result = np.zeros(len(interactions_in_roi), dtype=self.dtype)
124 result["n_electron_extracted"][mask] = n_electron

File numpy/random/_generator.pyx:3089, in numpy.random._generator.Generator.binomial()

File _common.pyx:396, in numpy.random._common.check_array_constraint()

File _common.pyx:382, in numpy.random._common._check_array_cons_bounded_0_1()

ValueError: p < 0, p > 1 or p contains NaNs

An if + normalizing factor should solve this I believe.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions