|
9 | 9 | import itertools |
10 | 10 |
|
11 | 11 | from .sensor_utils import (ScannableParameter, CouplingDict, State, States, StateSpec, StateSpecs, TimeFunc, |
12 | | - match_states, _squeeze_dims, expand_statespec, state_tuple_to_str) |
| 12 | + match_states, _squeeze_dims, expand_statespec, state_tuple_to_str, process_scannable_parameter) |
13 | 13 | from .exceptions import RydiquleError, CouplingNotAllowedError |
14 | 14 | from .exceptions import RWAWarning, PopulationNotConservedWarning, RydiquleWarning, debug_state |
15 | 15 |
|
@@ -416,6 +416,7 @@ def add_single_energy_shift(self, state: State, shift: ScannableParameter, label |
416 | 416 | raise RydiquleError(f"state {state} is not a node on the graph") |
417 | 417 |
|
418 | 418 | self._remove_edge_data((state, state), kind="coherent") |
| 419 | + shift = process_scannable_parameter(shift) |
419 | 420 | self.couplings.add_edge(state, state, e_shift=shift, label=label) |
420 | 421 | if debug_state(): |
421 | 422 | print(f' Added energy shift for {state}') |
@@ -856,8 +857,8 @@ def add_single_coupling( |
856 | 857 | field_params_trimmed = {k:v for k,v in field_params.items() if v is not None} |
857 | 858 |
|
858 | 859 | full_edge_data = { |
859 | | - param: np.array(val) |
860 | | - if param in self.scannable_parameters and hasattr(val, "__len__") |
| 860 | + param: process_scannable_parameter(val) |
| 861 | + if param in self.scannable_parameters |
861 | 862 | else val |
862 | 863 | for (param, val) in {**field_params_trimmed, **extra_kwargs}.items() |
863 | 864 | } |
@@ -1718,8 +1719,7 @@ def add_single_decoherence(self, states: States, gamma: ScannableParameter, |
1718 | 1719 |
|
1719 | 1720 | states = self._states_valid(states) |
1720 | 1721 | # coerce gamma to numpy array if a sequence |
1721 | | - if isinstance(gamma, Sized): |
1722 | | - gamma = np.array(gamma) |
| 1722 | + gamma = process_scannable_parameter(gamma) |
1723 | 1723 |
|
1724 | 1724 | gamma_full = decoherent_cc*gamma |
1725 | 1725 | if np.all(gamma_full==0.0): |
|
0 commit comments