diff --git a/asdf/core/_converters/complex.py b/asdf/core/_converters/complex.py index 44d5b544a..c86209cce 100644 --- a/asdf/core/_converters/complex.py +++ b/asdf/core/_converters/complex.py @@ -1,6 +1,10 @@ import re +import numpy as np + from asdf.extension import Converter +from asdf import util + _REPLACEMENTS = { re.compile("i(?!nf)"): "j", @@ -10,7 +14,8 @@ class ComplexConverter(Converter): tags = ["tag:stsci.edu:asdf/core/complex-1.0.0"] - types = ["builtins.complex", "numpy.complex64", "numpy.complex128", "numpy.complex256"] + + types = [*list(util.iter_subclasses(np.complexfloating)), complex] def to_yaml_tree(self, obj, tag, ctx): return str(obj)