Skip to content

Commit 4ca0dff

Browse files
fix cached properties
1 parent a7c9a38 commit 4ca0dff

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/rydstate/rydberg/rydberg_mqdt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from functools import cached_property
34
import logging
45
from typing import TYPE_CHECKING, Any, Generic, TypeVar, overload
56

@@ -67,7 +68,7 @@ def norm(self) -> float:
6768
"""Return the norm of the state (should be 1)."""
6869
return np.linalg.norm(self.coefficients) # type: ignore [return-value]
6970

70-
@property
71+
@cached_property
7172
def angular(self) -> AngularState[Any]:
7273
"""Return the angular part of the MQDT state as an AngularState."""
7374
angular_kets = [ket.angular for ket in self.sqdt_states]

src/rydstate/rydberg/rydberg_sqdt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __repr__(self) -> str:
9999
def __str__(self) -> str:
100100
return self.__repr__()
101101

102-
@property
102+
@cached_property
103103
def radial(self) -> RadialKet:
104104
"""The radial part of the Rydberg electron."""
105105
radial_ket = RadialKet(self.species, nu=self.nu, l_r=self.angular.l_r)

0 commit comments

Comments
 (0)