Skip to content

Commit 3e8aa11

Browse files
cache quantum_numbers_to_angular_ket to speed up lifetime calculations
1 parent cf988ee commit 3e8aa11

2 files changed

Lines changed: 3 additions & 1 deletion

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
67

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

8485

86+
@lru_cache(maxsize=1_000)
8587
def quantum_numbers_to_angular_ket(
8688
species: str | SpeciesObject,
8789
s_c: float | None = None,

src/rydstate/rydberg/rydberg_sqdt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(
9090
l_tot=l_tot,
9191
j_tot=j_tot,
9292
f_tot=f_tot,
93-
m=m,
93+
m=m, # type: ignore [arg-type]
9494
)
9595

9696
self.n = n

0 commit comments

Comments
 (0)