File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/oqd_core/interface/atomic Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,23 @@ class Ion(TypeReflectBaseModel):
162162 transitions : List [Transition ]
163163 position : List [float ]
164164
165+ @property
166+ def _level_dict (self ):
167+ return {level .label : level for level in self .levels }
168+
169+ @property
170+ def _transition_dict (self ):
171+ return {transition .label : transition for transition in self .transitions }
172+
173+ def __getitem__ (self , label ):
174+ if label in self ._level_dict .keys ():
175+ return self ._level_dict [label ]
176+
177+ if label in self ._transition_dict .keys ():
178+ return self ._transition_dict [label ]
179+
180+ raise KeyError ("Invalid key, label not in levels or transitions." )
181+
165182
166183########################################################################################
167184
You can’t perform that action at this time.
0 commit comments