Skip to content

return ndarray if lazy_load=False#1929

Merged
braingram merged 3 commits into
asdf-format:mainfrom
braingram:non_lazy_ndarray
Jun 9, 2025
Merged

return ndarray if lazy_load=False#1929
braingram merged 3 commits into
asdf-format:mainfrom
braingram:non_lazy_ndarray

Conversation

@braingram

@braingram braingram commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

Description

This PR switches the class deserialized from ndarray tags when lazy_load=False from NDArrayType to ndarray. I'm going to claim this is a "bugfix" and not a breaking change. With this PR (assuming "foo.asdf" has an array at "my_arr"):

import asdf
import numpy as np
af = asdf.open("foo.asdf", lazy_load=False)
assert type(af["my_arr"]) is np.ndarray

passes as does:

import asdf
import numpy as np
af = asdf.open("foo.asdf", lazy_tree=True, lazy_load=False)
assert type(af["my_arr"]) is np.ndarray

romancal regtests all pass: https://github.com/spacetelescope/RegressionTests/actions/runs/15494657881/job/43628410532
jwst regtests: https://github.com/spacetelescope/RegressionTests/actions/runs/15494660470
show 2 unrelated failures (that are currently being oked on main)

Closes: #1787

Tasks

  • run pre-commit on your machine
  • run pytest on your machine
  • Does this PR add new features and / or change user-facing code / API? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see below for change types)
    • update relevant docstrings and / or docs/ page
    • for any new features, add unit tests
news fragment change types...
  • changes/<PR#>.feature.rst: new feature
  • changes/<PR#>.bugfix.rst: bug fix
  • changes/<PR#>.doc.rst: documentation change
  • changes/<PR#>.removal.rst: deprecation or removal of public API
  • changes/<PR#>.general.rst: infrastructure or miscellaneous change

@braingram braingram marked this pull request as ready for review June 6, 2025 19:58
@braingram braingram requested a review from a team as a code owner June 6, 2025 19:58
@braingram braingram merged commit cf3ab34 into asdf-format:main Jun 9, 2025
50 of 51 checks passed
@braingram braingram deleted the non_lazy_ndarray branch June 9, 2025 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate returning ndarray when lazy_load=False

2 participants