Skip to content

Commit

Permalink
fix get_transition_for_states
Browse files Browse the repository at this point in the history
  • Loading branch information
hartytp committed Jan 22, 2025
1 parent c7e6cd8 commit de3d9d3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
10 changes: 7 additions & 3 deletions atomic_physics/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,13 @@ def get_transition_frequency_for_states(
if relative:
return f_rel

transition = self.get_transition_for_levels(
levels=(self.get_level_for_state(lower), self.get_level_for_state(upper))
)
lower_level = self.get_level_for_state(lower)
upper_level = self.get_level_for_state(upper)

if lower_level == upper_level:
return f_rel

transition = self.get_transition_for_levels(levels=(lower_level, upper_level))
f_abs = f_rel + transition.frequency

return f_abs
Expand Down
9 changes: 9 additions & 0 deletions atomic_physics/tests/test_atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ def test_state_energies(self):
atol=1,
)

np.testing.assert_allclose(
ion.get_transition_frequency_for_states(
states=(F_4_ind, F_3_ind), relative=False
)
/ (2 * np.pi),
ref_frequency * 1e9,
atol=1,
)

def test_magnetic_dipoles(self):
"""
Check the calculation for `state_vectors` for 43Ca+ at 146G against [1] table E.4.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "atomic_physics"
version = "2.0.0"
version = "2.0.1"
description = "Lightweight python library for calculations based on atomic structure"
authors = ["hartytp <thomas.peter.harty@gmail.com>"]

Expand Down

0 comments on commit de3d9d3

Please sign in to comment.