From 59b1cf7b6da8c95755c2ba8a3107d89e9b5551e8 Mon Sep 17 00:00:00 2001 From: dvezinet Date: Fri, 5 Dec 2025 14:49:26 +0000 Subject: [PATCH 01/18] [#1158] try/except --- tofu/imas2tofu/_comp.py | 5 ++++- tofu/imas2tofu/_core.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index 4258ca0c9..a16b70bff 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -44,7 +44,10 @@ _DSHORT = _defimas2tofu._dshort _DCOMP = _defimas2tofu._dcomp -_DDUNITS = imas.dd_units.DataDictionaryUnits() +try: + _DDUNITS = imas.dd_units.DataDictionaryUnits() +except Exception: + _DDUNITS = None _ISCLOSE = True _POS = False diff --git a/tofu/imas2tofu/_core.py b/tofu/imas2tofu/_core.py index ef339fe61..1105c4a0f 100644 --- a/tofu/imas2tofu/_core.py +++ b/tofu/imas2tofu/_core.py @@ -59,7 +59,7 @@ import imas from imas import imasdef except Exception as err: - raise Exception('imas not available') + raise Exception(f'imas not available: {str(err)}') __all__ = [ @@ -2012,14 +2012,14 @@ class with which the output shall be returned # ---------------------- # lids determines order in which ids are read # may be important in case 2d mesh only exists in one ids! - + lids = sorted(dsig.keys()) if 'equilibrium' in lids: lids = ['equilibrium'] + [ids for ids in lids if ids != 'equilibrium'] # ------------------------- # data source consistency - + _, _, shot, Exp = _comp_toobjects.get_lidsidd_shotExp( lids, upper=True, errshot=False, errExp=False, dids=self._dids, didd=self._didd, @@ -3797,4 +3797,4 @@ def _save_to_imas_DataCam1D( # ------------------ _put_ids(idd, ids, shotfile, occ=occ, cls_name='%s_%s'%(obj.Id.Cls,obj.Id.Name), - err=err0, dryrun=dryrun, verb=verb) \ No newline at end of file + err=err0, dryrun=dryrun, verb=verb) From 2d13d938fa19390017d42226f83bdd71c242536c Mon Sep 17 00:00:00 2001 From: dvezinet Date: Tue, 9 Dec 2025 16:10:46 +0000 Subject: [PATCH 02/18] [#1158] More robust coverage plotting --- tofu/data/_class8_plot_coverage_broadband.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tofu/data/_class8_plot_coverage_broadband.py b/tofu/data/_class8_plot_coverage_broadband.py index 763ae6bbc..ef0bda427 100644 --- a/tofu/data/_class8_plot_coverage_broadband.py +++ b/tofu/data/_class8_plot_coverage_broadband.py @@ -338,7 +338,7 @@ def _plot_cross( # prepare figure # ---------------- - if dax.get('ndet_cross') is None: + if dax is None or len(dax) == 0: if fs is None: fs = (16, 7) @@ -430,7 +430,7 @@ def _plot_cross( # check / format dax dax = ds._generic_check._check_dax(dax) - fig = dax['ndet_cross']['handle'].figure + fig = dax[list(dax.keys())[0]]['handle'].figure # --------------- # plot spans From 8cdaf3f5cdc90439c98e022e58c29031e6c1389a Mon Sep 17 00:00:00 2001 From: dvezinet Date: Tue, 9 Dec 2025 16:14:57 +0000 Subject: [PATCH 03/18] [#1158] imasdef not crashing at import --- tofu/imas2tofu/_core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tofu/imas2tofu/_core.py b/tofu/imas2tofu/_core.py index 1105c4a0f..81246fea8 100644 --- a/tofu/imas2tofu/_core.py +++ b/tofu/imas2tofu/_core.py @@ -57,7 +57,10 @@ # imas try: import imas - from imas import imasdef + try: + from imas import imasdef + except Exception: + imasdef = None except Exception as err: raise Exception(f'imas not available: {str(err)}') From 325ef13160ba5814ea3503811415f2cc70435f8c Mon Sep 17 00:00:00 2001 From: Tullio Barbui Date: Wed, 10 Dec 2025 16:38:21 +0100 Subject: [PATCH 04/18] from imas.ids_defs import HDF5_BACKEND --- tofu/imas2tofu/_core.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tofu/imas2tofu/_core.py b/tofu/imas2tofu/_core.py index 81246fea8..cb8c1d0e8 100644 --- a/tofu/imas2tofu/_core.py +++ b/tofu/imas2tofu/_core.py @@ -57,6 +57,7 @@ # imas try: import imas + from imas.ids_defs import HDF5_BACKEND try: from imas import imasdef except Exception: @@ -964,11 +965,7 @@ def _checkformat_idd( if params[kk] is None: params[kk] = vv - # convert backend str => pointer - params['backend'] = getattr( - imasdef, - f"{params['backend']}_BACKEND".upper(), - ) + params['backend'] = HDF5_BACKEND # create entry idd = imas.DBEntry( From c7aab3c0e9a4a2d0aeb46e0890e18ced93ed8390 Mon Sep 17 00:00:00 2001 From: Tullio Barbui Date: Wed, 10 Dec 2025 17:24:11 +0100 Subject: [PATCH 05/18] check ids disabled --- tofu/imas2tofu/_core.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tofu/imas2tofu/_core.py b/tofu/imas2tofu/_core.py index cb8c1d0e8..7ed2fb20b 100644 --- a/tofu/imas2tofu/_core.py +++ b/tofu/imas2tofu/_core.py @@ -1189,13 +1189,13 @@ def _checkformat_ids( ids = [ids] # check ids is allowed - for ids_ in ids: - if not ids_ in self._lidsnames: - msg = ( - "ids {ids_} matched no known imas ids !" - f" => Available ids are:\n{repr(self._lidsnames)}" - ) - raise Exception(msg) + # for ids_ in ids: + # if not ids_ in self._lidsnames: + # msg = ( + # "ids {ids_} matched no known imas ids !" + # f" => Available ids are:\n{repr(self._lidsnames)}" + # ) + # raise Exception(msg) # initialise dict for k in ids: From b31a702c9363d891e57b58f562500422a6b205fc Mon Sep 17 00:00:00 2001 From: Tullio Barbui Date: Wed, 10 Dec 2025 17:42:37 +0100 Subject: [PATCH 06/18] rollback to previous commit --- tofu/imas2tofu/_core.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tofu/imas2tofu/_core.py b/tofu/imas2tofu/_core.py index 7ed2fb20b..cb8c1d0e8 100644 --- a/tofu/imas2tofu/_core.py +++ b/tofu/imas2tofu/_core.py @@ -1189,13 +1189,13 @@ def _checkformat_ids( ids = [ids] # check ids is allowed - # for ids_ in ids: - # if not ids_ in self._lidsnames: - # msg = ( - # "ids {ids_} matched no known imas ids !" - # f" => Available ids are:\n{repr(self._lidsnames)}" - # ) - # raise Exception(msg) + for ids_ in ids: + if not ids_ in self._lidsnames: + msg = ( + "ids {ids_} matched no known imas ids !" + f" => Available ids are:\n{repr(self._lidsnames)}" + ) + raise Exception(msg) # initialise dict for k in ids: From e0252f5cdbb4e177c815f2901746ae4602f88844 Mon Sep 17 00:00:00 2001 From: Tullio Barbui Date: Wed, 10 Dec 2025 17:51:22 +0100 Subject: [PATCH 07/18] rollforward to last commit --- tofu/imas2tofu/_core.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tofu/imas2tofu/_core.py b/tofu/imas2tofu/_core.py index cb8c1d0e8..7ed2fb20b 100644 --- a/tofu/imas2tofu/_core.py +++ b/tofu/imas2tofu/_core.py @@ -1189,13 +1189,13 @@ def _checkformat_ids( ids = [ids] # check ids is allowed - for ids_ in ids: - if not ids_ in self._lidsnames: - msg = ( - "ids {ids_} matched no known imas ids !" - f" => Available ids are:\n{repr(self._lidsnames)}" - ) - raise Exception(msg) + # for ids_ in ids: + # if not ids_ in self._lidsnames: + # msg = ( + # "ids {ids_} matched no known imas ids !" + # f" => Available ids are:\n{repr(self._lidsnames)}" + # ) + # raise Exception(msg) # initialise dict for k in ids: From d1c6a04d1a088d963207c047bd966ea143875b1c Mon Sep 17 00:00:00 2001 From: dvezinet Date: Wed, 10 Dec 2025 17:35:32 +0000 Subject: [PATCH 08/18] [#1158] minor cleanup --- tofu/imas2tofu/_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tofu/imas2tofu/_core.py b/tofu/imas2tofu/_core.py index 81246fea8..194af350f 100644 --- a/tofu/imas2tofu/_core.py +++ b/tofu/imas2tofu/_core.py @@ -960,7 +960,7 @@ def _checkformat_idd( user=user, database=database, version=version, backend=backend, ) - for kk,vv in defidd.items(): + for kk, vv in defidd.items(): if params[kk] is None: params[kk] = vv From 11c1add25d21d5018641970cba3fd3f605602c79 Mon Sep 17 00:00:00 2001 From: dvezinet Date: Thu, 11 Dec 2025 13:46:01 +0000 Subject: [PATCH 09/18] [#1158] More debug --- tofu/imas2tofu/_comp.py | 27 ++++++++++++++++++--------- tofu/imas2tofu/_comp_toobjects.py | 23 +++++++++++++++++++++-- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index a16b70bff..276dadbe8 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -663,12 +663,16 @@ def _check_data(data, pos=None, nan=None, isclose=None, empty=None): isempty = [None for ii in range(len(data))] if empty is True: for ii in range(len(data)): - isempty[ii] = (len(data[ii]) == 0 - or (isinstance(data[ii], np.ndarray) - and (data[ii].size == 0 - or 0 in data[ii].shape))) + isempty[ii] = ( + len(data[ii]) == 0 + or ( + isinstance(data[ii], np.ndarray) + and (data[ii].size == 0 or 0 in data[ii].shape) + ) + ) if isinstance(data[ii], np.ndarray) and data[ii].dtype.kind != 'U': isempty[ii] &= bool(np.all(np.isnan(data[ii]))) + return data, isempty @@ -770,17 +774,22 @@ def _get_data_units(ids=None, sig=None, occ=None, # Check data isempty = None if errdata is None and data is True: - out, isempty = _check_data(out, - pos=pos, nan=nan, - isclose=isclose, empty=empty) + out, isempty = _check_data( + out, + pos=pos, nan=nan, + isclose=isclose, empty=empty, + ) if np.all(isempty): msg = ("empty data in {}.{}".format(ids, sig)) errdata = Exception(msg) elif nocc == 1 and flatocc is True: out = out[0] isempty = isempty[0] - return {'data': out, 'units': unit, - 'isempty': isempty, 'errdata': errdata, 'errunits': errunits} + + return { + 'data': out, 'units': unit, + 'isempty': isempty, 'errdata': errdata, 'errunits': errunits, + } def get_data_units(dsig=None, occ=None, diff --git a/tofu/imas2tofu/_comp_toobjects.py b/tofu/imas2tofu/_comp_toobjects.py index 5cf0be323..838050f53 100644 --- a/tofu/imas2tofu/_comp_toobjects.py +++ b/tofu/imas2tofu/_comp_toobjects.py @@ -633,7 +633,7 @@ def get_plasma( R = out_['2dmeshR']['data'] Z = out_['2dmeshZ']['data'] if R.ndim == 2: - if np.allclose(R[0, :], R[0,0]): + if np.allclose(R[0, :], R[0, 0]): R = R[:, 0] Z = Z[0, :] else: @@ -658,13 +658,32 @@ def get_plasma( # profiles2d on mesh lprof2d = set(out_.keys()).difference(lsigmesh) + + # Check for non-arrays + derr = { + ss: type(out_[ss]['data']) for ss in lprof2d + if not isinstance(out_[ss]['data'], np.ndarray) + } + + if len(derr) > 0: + lstr = [f"\t- {kk}: {vv}" for kk, vv in derr.items()] + msg = ( + "The following keys in profiles2d are not np.ndarrays:\n" + + "\n".join(lstr) + ) + raise Exception(msg) + + # loop for ss in lprof2d: # identify proper 2d mesh lm = [ km for km, vm in dmesh.items() if ( - (km == 'tri' and vm['n1'] in out_[ss]['data'].shape) + ( + km == 'tri' + and vm['n1'] in out_[ss]['data'].shape + ) or ( km == 'rect' and vm['n1'] in out_[ss]['data'].shape From 2ec0bf5af7aecbc3a8bc8e082eee8d5a1008931d Mon Sep 17 00:00:00 2001 From: dvezinet Date: Thu, 11 Dec 2025 14:24:45 +0000 Subject: [PATCH 10/18] [#1158] imas.ids_primitive.IDSNumericArray --- tofu/imas2tofu/_comp.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index 276dadbe8..595e3b536 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -627,6 +627,11 @@ def _check_data(data, pos=None, nan=None, isclose=None, empty=None): # ------------ # Run checks on data + # if imas.ids_primitive.IDSNumericArray + for ii in range(0, len(data)): + if isinstance(data[ii], imas.ids_primitive.IDSNumericArray): + data[ii] = data[ii].value + # If isclose, check data contains a replicated vector (keep vector only) if isclose is True: for ii in range(0, len(data)): From 128c1fb6148d9adfbd5352ec409f231609b6333b Mon Sep 17 00:00:00 2001 From: dvezinet Date: Thu, 11 Dec 2025 14:38:49 +0000 Subject: [PATCH 11/18] [#1158] imas.ids_primitive.IDSNumericArray => array --- tofu/imas2tofu/_comp.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index 595e3b536..76e3fcd4b 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -631,6 +631,17 @@ def _check_data(data, pos=None, nan=None, isclose=None, empty=None): for ii in range(0, len(data)): if isinstance(data[ii], imas.ids_primitive.IDSNumericArray): data[ii] = data[ii].value + if hasattr(data[ii], '__iter__'): + for jj in range(len(data[ii])): + if isinstance(data[ii][jj], imas.ids_primitive.IDSNumericArray): + data[ii][jj] = data[ii][jj].value + + c0 = ( + all([isinstance(vv, np.ndarray) for vv in data[ii]]) + and all([vv.shape == data[ii][0].shape for vv in data[ii]]) + ) + if c0: + data[ii] = np.array(data[ii]) # If isclose, check data contains a replicated vector (keep vector only) if isclose is True: From c691af91b904fe5e905a77f506153265e0816a15 Mon Sep 17 00:00:00 2001 From: Tullio Barbui Date: Thu, 11 Dec 2025 15:44:02 +0100 Subject: [PATCH 12/18] pdb --- tofu/imas2tofu/_comp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index 595e3b536..5f9d72f7e 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -627,6 +627,7 @@ def _check_data(data, pos=None, nan=None, isclose=None, empty=None): # ------------ # Run checks on data + import pdb; pdb.set_trace() #space db # if imas.ids_primitive.IDSNumericArray for ii in range(0, len(data)): if isinstance(data[ii], imas.ids_primitive.IDSNumericArray): From 668e858061379e5bda78e8b1ad33b5be233807d4 Mon Sep 17 00:00:00 2001 From: dvezinet Date: Thu, 11 Dec 2025 15:14:21 +0000 Subject: [PATCH 13/18] [#1158] Handling IMAS new classes where appropriate! --- tofu/imas2tofu/_comp.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index 76e3fcd4b..fb62c8804 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -297,6 +297,19 @@ def fsig(obj, indt=None, indch=None, stack=None, dcond=dcond): raise Exception(msg) sig[jj] = sig[jj][ind[0]] + # convert from IMAS classes to numpy / float etc + for ii in range(len(sig)): + if isinstance(imas.ids_primitive.IDSNumericalArray): + sig[ii] = np.array(sig[ii]) + elif isinstance(sig[ii], imas.ids_primitive.IDSFloat0D): + sig[ii] = float(sig[ii]) + elif isinstance(sig[ii], imas.ids_primitive.IDSInt0D): + sig[ii] = int(sig[ii]) + elif isinstance(sig[ii], imas.ids_primitive.IDSString0D): + sig[ii] = str(sig[ii]) + elif isinstance(sig[ii], imas.ids_primitive.IDSString1D): + sig[ii] = str(sig[ii]) + # Conditions for stacking / sqeezing sig lc = [ ( From 108e0457fc5a5f185ca6ab99ccc31b99085dd2a9 Mon Sep 17 00:00:00 2001 From: Tullio Barbui Date: Thu, 11 Dec 2025 16:15:24 +0100 Subject: [PATCH 14/18] remove pdb --- tofu/imas2tofu/_comp.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index d24ce85c2..fc42c2a0f 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -627,7 +627,6 @@ def _check_data(data, pos=None, nan=None, isclose=None, empty=None): # ------------ # Run checks on data - import pdb; pdb.set_trace() #space db # if imas.ids_primitive.IDSNumericArray for ii in range(0, len(data)): if isinstance(data[ii], imas.ids_primitive.IDSNumericArray): @@ -643,7 +642,7 @@ def _check_data(data, pos=None, nan=None, isclose=None, empty=None): ) if c0: data[ii] = np.array(data[ii]) - + # If isclose, check data contains a replicated vector (keep vector only) if isclose is True: for ii in range(0, len(data)): From 5a9f3023e0830aee312bfe7d65558a96c33083a2 Mon Sep 17 00:00:00 2001 From: dvezinet Date: Thu, 11 Dec 2025 15:18:34 +0000 Subject: [PATCH 15/18] [#1158] Handling IMAS new classes where appropriate2 --- tofu/imas2tofu/_comp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index fb62c8804..d761555ee 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -299,8 +299,10 @@ def fsig(obj, indt=None, indch=None, stack=None, dcond=dcond): # convert from IMAS classes to numpy / float etc for ii in range(len(sig)): - if isinstance(imas.ids_primitive.IDSNumericalArray): + if isinstance(imas.ids_primitive.IDSNumericArray): sig[ii] = np.array(sig[ii]) + elif isinstance(imas.ids_primitive.IDSNumeric0D): + pass elif isinstance(sig[ii], imas.ids_primitive.IDSFloat0D): sig[ii] = float(sig[ii]) elif isinstance(sig[ii], imas.ids_primitive.IDSInt0D): From bc174bcd0c149f7ecf77530850abf2f16b0c0ac4 Mon Sep 17 00:00:00 2001 From: dvezinet Date: Thu, 11 Dec 2025 15:20:02 +0000 Subject: [PATCH 16/18] [#1158] Handling IMAS new classes where appropriate3 --- tofu/imas2tofu/_comp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index d761555ee..97aeb6693 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -299,9 +299,9 @@ def fsig(obj, indt=None, indch=None, stack=None, dcond=dcond): # convert from IMAS classes to numpy / float etc for ii in range(len(sig)): - if isinstance(imas.ids_primitive.IDSNumericArray): + if isinstance(sig[ii], imas.ids_primitive.IDSNumericArray): sig[ii] = np.array(sig[ii]) - elif isinstance(imas.ids_primitive.IDSNumeric0D): + elif isinstance(sig[ii], imas.ids_primitive.IDSNumeric0D): pass elif isinstance(sig[ii], imas.ids_primitive.IDSFloat0D): sig[ii] = float(sig[ii]) From a1e6e47611c7fcee487e4d4b714058c56ca6a53b Mon Sep 17 00:00:00 2001 From: Tullio Barbui Date: Thu, 11 Dec 2025 16:37:07 +0100 Subject: [PATCH 17/18] fixed IDSNumeric0D --- tofu/imas2tofu/_comp.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index be311a41f..7033d4e32 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -301,8 +301,6 @@ def fsig(obj, indt=None, indch=None, stack=None, dcond=dcond): for ii in range(len(sig)): if isinstance(sig[ii], imas.ids_primitive.IDSNumericArray): sig[ii] = np.array(sig[ii]) - elif isinstance(sig[ii], imas.ids_primitive.IDSNumeric0D): - pass elif isinstance(sig[ii], imas.ids_primitive.IDSFloat0D): sig[ii] = float(sig[ii]) elif isinstance(sig[ii], imas.ids_primitive.IDSInt0D): From 81a9bb48a83481fe3448c2509e5e41eec4175d3b Mon Sep 17 00:00:00 2001 From: dvezinet Date: Thu, 11 Dec 2025 15:44:01 +0000 Subject: [PATCH 18/18] [#1158] Clean-up --- tofu/imas2tofu/_comp.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tofu/imas2tofu/_comp.py b/tofu/imas2tofu/_comp.py index 7033d4e32..0622edc31 100644 --- a/tofu/imas2tofu/_comp.py +++ b/tofu/imas2tofu/_comp.py @@ -640,22 +640,6 @@ def _check_data(data, pos=None, nan=None, isclose=None, empty=None): # ------------ # Run checks on data - # if imas.ids_primitive.IDSNumericArray - for ii in range(0, len(data)): - if isinstance(data[ii], imas.ids_primitive.IDSNumericArray): - data[ii] = data[ii].value - if hasattr(data[ii], '__iter__'): - for jj in range(len(data[ii])): - if isinstance(data[ii][jj], imas.ids_primitive.IDSNumericArray): - data[ii][jj] = data[ii][jj].value - - c0 = ( - all([isinstance(vv, np.ndarray) for vv in data[ii]]) - and all([vv.shape == data[ii][0].shape for vv in data[ii]]) - ) - if c0: - data[ii] = np.array(data[ii]) - # If isclose, check data contains a replicated vector (keep vector only) if isclose is True: for ii in range(0, len(data)):