You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The NDArrayType is a bit different from other asdf types in that the from_tree returns an instance of the NDArrayType (instead of the mapped python types)
This also means that you can access the classattributes .name='core/ndarray' and .version='1.0.0' from any instance. From my understanding, these attributes are only used for generating the appropriate tag mapping for the asdf extension?
Unfortunately this can have unexpected results when using the loaded array with other libraries that check for these attributes on class creation, see here BAMWelDX/weldx#110
In the attributes are not needed on the instances returned by from_tree by asdf after creation, can they be set to None so that other code is less likely to pick them up? see CagtayFabry@603b016
The text was updated successfully, but these errors were encountered:
From my understanding, these attributes are only used for generating the appropriate tag mapping for the asdf extension?
Yes, that's right. The instance of NDArrayType wraps np.ndarray, while the NDArrayType class methods implement the ExtensionType interface. I find this terribly confusing.
Ideally I think we'd just separate NDArrayType into two different classes, one for the np.ndarray wrapper and another for the ExtensionType implementation. I was planning to do that when switching the built-in types to the new converter API, but we can try to get it done earlier if it's causing problems for you.
The
NDArrayType
is a bit different from other asdf types in that thefrom_tree
returns an instance of theNDArrayType
(instead of the mapped python types)This also means that you can access the classattributes
.name='core/ndarray'
and.version='1.0.0'
from any instance. From my understanding, these attributes are only used for generating the appropriate tag mapping for the asdf extension?Unfortunately this can have unexpected results when using the loaded array with other libraries that check for these attributes on class creation, see here BAMWelDX/weldx#110
In the attributes are not needed on the instances returned by
from_tree
by asdf after creation, can they be set toNone
so that other code is less likely to pick them up? see CagtayFabry@603b016The text was updated successfully, but these errors were encountered: