Skip to content
Snippets Groups Projects
Commit 5ecac3e5 authored by Johannes Schumann's avatar Johannes Schumann
Browse files

Merge branch 'lru_particle_masses' into 'master'

Cache particle masses

See merge request !89
parents 95d963a6 ffff8321
No related branches found
No related tags found
1 merge request!89Cache particle masses
Pipeline #51532 passed
Unreleased changes
------------------
* Use LRU in particle mass lookup
v1.8.1
----------------------------
......
......@@ -20,6 +20,7 @@ import awkward as ak
from particle import Particle
import mendeleev
import scipy.constants as constants
from functools import lru_cache
from .config import read_default_media_compositions
......@@ -196,6 +197,7 @@ def get_targets_per_volume(targetZ,
def _get_particle_rest_mass(pdgid):
@np.vectorize
@lru_cache
def vfunc(x):
try:
return Particle.from_pdgid(x).mass * 1e-3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment