Allow lazy loading of Quantity instances created during deserialization
Opened this issue · 1 comments
Currently the Quantity converter calls _make_array
before creating the Quantity:
When the array is stored as an internal ASDF block this will force the block to be loaded at the time of deserialization.
Initial attempts to enable lazy loading by removing the above mentioned line do not prevent the ASDF block from being loaded possibly because NDArrayType is not a subclass of ndarray and astropy will attempt to iterate through the array during loading:
https://github.com/astropy/astropy/blob/79dd50f61ef5e0a568dd42549319db38fefd0bc7/astropy/units/quantity.py#L495
triggering loading of the ASDF block.
Whenever Quantity
is updated to support the Python array API standard, then this will become trivial because Quantity
will no longer subclass ndarray
, instead it will satisfy the API's protocol.