Skip to content

Commit

Permalink
Allow errors (with warning) when asking for keys() on machine mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
orso82 committed Mar 13, 2024
1 parent 110ba8b commit 4ab29a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions omas/machine_mappings/d3d.json
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@
"PYTHON": "magnetics_hardware(ods, {pulse})"
},
"magnetics.flux_loop.:.flux.data": {
"COCOSIO": 11,
"PYTHON": "magnetics_floops_data(ods, {pulse}, {nref!r})"
},
"magnetics.flux_loop.:.flux.data_error_upper": {
Expand Down
6 changes: 5 additions & 1 deletion omas/omas_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,11 @@ def __contains__(self, location):
def keys(self, location):
ulocation = (o2u(location) + ".").lstrip('.')
if ulocation + ':' in machine_mappings(self.kw['machine'], self.kw['branch'], self.kw['user_machine_mappings']):
return list(range(self[ulocation + ':']))
try:
return list(range(self[ulocation + ':']))
except Exception as _excp:
printe(f'{ulocation}: issue:' + repr(_excp))
return []
else:
tmp = numpy.unique(
[
Expand Down

0 comments on commit 4ab29a3

Please sign in to comment.