Replies: 3 comments 3 replies
-
In the case of arrays, will this allow obtaining information about the array (size, shape, type, etc) without loading it? |
Beta Was this translation helpful? Give feedback.
2 replies
-
Also, the current functionality of the |
Beta Was this translation helpful? Give feedback.
1 reply
-
FYI: this feature is implemented in #1733 which is currently targeting 3.3 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For an as-yet undetermined upcoming asdf version (possibly 3.x) we're considering adding a new way of interacting with the tree. The general idea is that when an ASDF file is opened the components/nodes of the tree will not be immediately converted to custom objects. Conversion of a node from a tagged to a custom object would only occur when the node is accessed (except for the top level
AsdfObject
which is accessed as part of opening the file.Example
For example, suppose you have an ASDF file with a tree with a custom object (a
ndarray
instance) attree['a']['b']
where 'a' is adict
instance. With the super dictionary approach something like the following would occur when the file is opened:Note that the
tree_type
argument above is only an example, this may not be the final API.Similarity with lazy_load
There are some ways in which this is similar to the lazy loading currently used for blocks (and NDArrayType) but is a more generic lazy loading mechanism that would work for objects that are difficult to lazy load (such as astropy Quantity instances which force array loading when they are created). For example, consider a tree with a quantity as tree['science']['data']:
Super dictionary tree does not use builtin
dict
andlist
for mappings and sequencesOne change to using super dictionaries will be that previous
dict
andlist
instances in the ASDF tree will be returned as dict-like and list-like objects (possibly subclasses ofdict
mapping
orUserDict
). Any code that checks specifically fordict
(orlist
) instances may need to be updated or continue to use the non-super dictionary interface (at the moment we're planning to keep both).Performance tradeoffs
It also seems likely that all accesses will be slightly slower. Loading files should be significantly faster (as not all objects will need to be converted) but first access for nodes will be slower (when the object is converted and cached).
Additional features
Although not planned for the initial implementation, super-dictionaries might allow for per-node or per-branch methods and options. Some examples would be:
Beta Was this translation helpful? Give feedback.
All reactions