Skip to content

Commit

Permalink
mg25 - reformatted mg25 and test_mg25_consts
Browse files Browse the repository at this point in the history
  • Loading branch information
mollysmith23 committed Nov 13, 2023
1 parent cfcf933 commit e39cfdd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 25 deletions.
27 changes: 15 additions & 12 deletions atomic_physics/ions/mg25.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
P12 = ap.Level(n=3, S=1 / 2, L=1, J=1 / 2)
P32 = ap.Level(n=3, S=1 / 2, L=1, J=3 / 2)


class Mg25(ap.Atom):
def __init__(
self,
Expand All @@ -38,33 +39,35 @@ def __init__(
"""
levels = {
ground_level: ap.LevelData(
g_J=2.002, # [1] (approximate)
g_I=(2 / 5) * -0.85545, # [7]
Ahfs=-596.2542487e6 * consts.h, # [5] (or —596.254376(54)e6 [1])
g_J=2.002, # [1] (approximate)
g_I=(2 / 5) * -0.85545, # [7]
Ahfs=-596.2542487e6 * consts.h, # [5] (or —596.254376(54)e6 [1])
),
P12: ap.LevelData(
Ahfs=102.16e6 * consts.h, # [6]
g_I=(2 / 5) * -0.85545, # [7]
Ahfs=102.16e6 * consts.h, # [6]
g_I=(2 / 5) * -0.85545, # [7]
),
P32: ap.LevelData(
Ahfs=-19.0972e6 * consts.h, # [8]
g_I=(2 / 5) * -0.85545, # [7]
Bhfs=22.3413e6 * consts.h, # [8]
Ahfs=-19.0972e6 * consts.h, # [8]
g_I=(2 / 5) * -0.85545, # [7]
Bhfs=22.3413e6 * consts.h, # [8]
),
}

transitions = {
"280": ap.Transition(
lower=S12,
upper=P12,
A=5.58e8, # [4]
freq=1069.339957e12 * 2 * np.pi, # [3]
A=5.58e8, # [4]
freq=1069.339957e12 * 2 * np.pi, # [3]
),
"279": ap.Transition(
lower=S12,
upper=P32,
A=2.60e8, # [4]
freq=1072.084547e12 * 2 * np.pi, # [3] (or 1072084547e6 * 2 * np.pi [2])
A=2.60e8, # [4]
freq=1072.084547e12
* 2
* np.pi, # [3] (or 1072084547e6 * 2 * np.pi [2])
),
}

Expand Down
32 changes: 19 additions & 13 deletions atomic_physics/tests/test_mg25_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@
import numpy as np

S12_31_21_clock_field = 212.8e-4 # [1]
MW_transition_freqs = {(3,2):1.326456e9,
(2,2):1.460516e9,
(1,2):1.573543e9,
(2,1):1.573432e9,
(1,1):1.686459e9,
(0,1):1.786044e9,
(0,-1):1.975445e9} # [1]
MW_transition_freqs = {
(3, 2): 1.326456e9,
(2, 2): 1.460516e9,
(1, 2): 1.573543e9,
(2, 1): 1.573432e9,
(1, 1): 1.686459e9,
(0, 1): 1.786044e9,
(0, -1): 1.975445e9,
} # [1]


class TestMg25Consts(unittest.TestCase):
def test_s12_clock(self):
"""Look for field-insensitive S1/2 3,1 -> S1/2 2,1 transition at 212.8 G
"""
"""Look for field-insensitive S1/2 3,1 -> S1/2 2,1 transition at 212.8 G"""
ion = mg25.Mg25(level_filter=[mg25.S12])

ion.setB(S12_31_21_clock_field)
Expand Down Expand Up @@ -53,8 +54,13 @@ def test_mw_transitions(self):
ion.setB(model_field_independent_point)

for key, value in MW_transition_freqs:
freq_model = ion.delta(ion.index(mg25.S12, F=3, M=key[0]), ion.index(mg25.S12, F=2, M=key[1])) / 2*np.pi
freq_model = (
ion.delta(
ion.index(mg25.S12, F=3, M=key[0]),
ion.index(mg25.S12, F=2, M=key[1]),
)
/ 2
* np.pi
)

self.assertAlmostEqual(
freq_model, value, places=4
)
self.assertAlmostEqual(freq_model, value, places=4)

0 comments on commit e39cfdd

Please sign in to comment.