|
2 | 2 | Utilities for interacting with atomic parameters and ARC. |
3 | 3 | """ |
4 | 4 |
|
5 | | -import arc.alkali_atom_data as arc_atoms |
6 | 5 | from scipy.constants import epsilon_0, hbar, c |
7 | 6 | import numpy as np |
8 | | -import re |
| 7 | +import re |
9 | 8 | from .sensor_utils import expand_statespec |
10 | 9 |
|
11 | | -from typing import Union, Optional, Literal, Tuple, List, Dict, Callable, NamedTuple |
| 10 | +from typing import Union, Optional, Literal, Tuple, List, Dict, Callable, NamedTuple, TYPE_CHECKING |
12 | 11 |
|
13 | | -from .exceptions import RydiquleError |
| 12 | +from .exceptions import RydiquleError, AtomError |
| 13 | + |
| 14 | +if TYPE_CHECKING: |
| 15 | + import arc.alkali_atom_data |
14 | 16 |
|
15 | 17 | ATOMS = { |
16 | | - 'H': arc_atoms.Hydrogen, |
17 | | - 'Li6': arc_atoms.Lithium6, 'Li7': arc_atoms.Lithium7, |
18 | | - 'Na': arc_atoms.Sodium, |
19 | | - 'K39': arc_atoms.Potassium39, 'K40': arc_atoms.Potassium40, 'K41': arc_atoms.Potassium41, |
20 | | - 'Rb85': arc_atoms.Rubidium85, 'Rb87': arc_atoms.Rubidium87, |
21 | | - 'Cs': arc_atoms.Caesium |
| 18 | + 'H': 'Hydrogen', |
| 19 | + 'Li6': 'Lithium6', 'Li7': 'Lithium7', |
| 20 | + 'Na': 'Sodium', |
| 21 | + 'K39': 'Potassium39', 'K40': 'Potassium40', 'K41': 'Potassium41', |
| 22 | + 'Rb85': 'Rubidium85', 'Rb87': 'Rubidium87', |
| 23 | + 'Cs': 'Caesium' |
22 | 24 | } |
23 | 25 | """ |
24 | 26 | Alkali atoms defined by ARC that can be used with :class:`~.Cell`. |
25 | 27 | """ |
26 | 28 |
|
| 29 | +def _load_arc_atom(atom_flag: str) -> 'arc.alkali_atom_data.AlkaliAtom': |
| 30 | + """ |
| 31 | + Function that lazy loads ARC atoms from :external+arc:module:`~arc.alkali_atom_data` |
| 32 | +
|
| 33 | + Returns |
| 34 | + ------- |
| 35 | + arc.alkali_atom_data.AlkaliAtom |
| 36 | + ARC alkali atom class associated with the provided atom_flag. |
| 37 | + """ |
| 38 | + |
| 39 | + import arc.alkali_atom_data as arc_atoms |
| 40 | + |
| 41 | + if atom_flag not in ATOMS.keys(): |
| 42 | + raise AtomError(f"Atom flag must be one of {ATOMS.keys()}") |
| 43 | + |
| 44 | + return getattr(arc_atoms, ATOMS[atom_flag])() # instantiate the class here |
| 45 | + |
| 46 | + |
27 | 47 | ground_n = { |
28 | 48 | "H": 1, |
29 | 49 | "Li": 2, |
|
0 commit comments