From 7b3df2af7e4c5abcf0320747ff37d233fdad3273 Mon Sep 17 00:00:00 2001 From: Eugene M Date: Fri, 8 Nov 2024 10:25:29 -0500 Subject: [PATCH] ENH: add alias to_numpy_descr to BuiltinDtype --- tiled/server/pydantic_array.py | 3 +++ tiled/structures/array.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tiled/server/pydantic_array.py b/tiled/server/pydantic_array.py index 2c37a51dc..be92991cf 100644 --- a/tiled/server/pydantic_array.py +++ b/tiled/server/pydantic_array.py @@ -70,6 +70,9 @@ def to_numpy_str(self): # we need to divide by 4. size = self.itemsize if self.kind != Kind.unicode else self.itemsize // 4 return f"{endianness}{self.kind.value}{size}{self.dt_units or ''}" + + def to_numpy_descr(self): + return self.to_numpy_str() # Alias to match StructDtype API @classmethod def from_json(cls, structure): diff --git a/tiled/structures/array.py b/tiled/structures/array.py index 23b625d51..7524ff853 100644 --- a/tiled/structures/array.py +++ b/tiled/structures/array.py @@ -119,6 +119,9 @@ def to_numpy_str(self): # we need to divide by 4. size = self.itemsize if self.kind != Kind.unicode else self.itemsize // 4 return f"{endianness}{self.kind.value}{size}{self.dt_units or ''}" + + def to_numpy_descr(self): + return self.to_numpy_str() # Alias to match StructDtype API @classmethod def from_json(cls, structure):