Skip to content

Commit 5477fa1

Browse files
cache quantum_numbers_to_angular_ket to speed up lifetime calculations
1 parent db67698 commit 5477fa1

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/rydstate/angular/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import contextlib
44
import typing as t
5+
from functools import lru_cache
56
from typing import TYPE_CHECKING, Any, Literal, TypeGuard
67

78
import numpy as np
@@ -80,6 +81,7 @@ def get_possible_quantum_number_values(s_1: float, s_2: float, s_tot: float | No
8081
return [float(s) for s in np.arange(abs(s_1 - s_2), s_1 + s_2 + 1, 1)]
8182

8283

84+
@lru_cache(maxsize=1_000)
8385
def quantum_numbers_to_angular_ket(
8486
species: str | SpeciesObject,
8587
s_c: float | None = None,

0 commit comments

Comments
 (0)