From 4ab29a3ffd8621a74699c3e8197c2b01f506f318 Mon Sep 17 00:00:00 2001 From: Orso Meneghini Date: Wed, 13 Mar 2024 14:37:32 -0700 Subject: [PATCH] Allow errors (with warning) when asking for keys() on machine mappings --- omas/machine_mappings/d3d.json | 1 + omas/omas_machine.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/omas/machine_mappings/d3d.json b/omas/machine_mappings/d3d.json index 7199e87e9..a79b7cf32 100644 --- a/omas/machine_mappings/d3d.json +++ b/omas/machine_mappings/d3d.json @@ -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": { diff --git a/omas/omas_machine.py b/omas/omas_machine.py index b2d24c42a..37ccedf1d 100644 --- a/omas/omas_machine.py +++ b/omas/omas_machine.py @@ -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( [