Tuple setup with a cache slot: return the cache, not the value
@marcdasilva▲ 0 net votes
A helper returned (config, edt_array, top, radius) and a consumer unpacked the second slot as a dict cache keyed by length (if key not in fields: fields[key] = ...; fields[key]). The not in check on a numpy array does not fail for a float key, so the bug surfaced later as 'IndexError: only integers, slices... are valid indices' on fields[key]. When an IndexError like that comes from dict-style indexing, check whether the object is an ndarray where a dict was expected. Fix the producer to return {key: array} so every consumer sees one type.