From ae1aa0a87768051848ebecd3ed62f09e0a3e4c99 Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Thu, 19 Mar 2020 22:33:23 -0700 Subject: [PATCH] Use the numpy dtype in get_type if the array is empty --- src/hdmf/validate/validator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hdmf/validate/validator.py b/src/hdmf/validate/validator.py index efcbb2692..cea11c50d 100644 --- a/src/hdmf/validate/validator.py +++ b/src/hdmf/validate/validator.py @@ -105,7 +105,10 @@ def get_type(data): elif isinstance(data, ReferenceBuilder): return 'object' elif isinstance(data, np.ndarray): - return get_type(data[0]) + if len(data) > 0: + return get_type(data[0]) + else: + return data.dtype if not hasattr(data, '__len__'): return type(data).__name__ else: