Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace usages of copy_arrays with memmap #306

Merged
merged 3 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
2.0.1 (unreleased)
===================

-
- replace usages of ``copy_arrays`` with ``memmap`` [#306]

2.0.0 (2024-06-24)
===================
Expand Down
2 changes: 1 addition & 1 deletion src/stdatamodels/jwst/datamodels/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def open(init=None, guess=True, memmap=False, **kwargs):
return ModelContainer(init, **kwargs)

elif file_type == "asdf":
asdffile = asdf.open(init, copy_arrays=not memmap)
asdffile = asdf.open(init, memmap=memmap)

# Detect model type, then get defined model, and call it.
new_class = _class_from_model_type(asdffile)
Expand Down
4 changes: 1 addition & 3 deletions src/stdatamodels/model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@ def __init__(self, init=None, schema=None, memmap=False,
)

elif file_type == "asdf":
# use memmap argument of "copy_arrays" was not defined
kwargs["copy_arrays"] = kwargs.get("copy_arrays", not memmap)
asdffile = self.open_asdf(init=init, **kwargs)
asdffile = self.open_asdf(init=init, memmap=memmap, **kwargs)

else:
# TODO handle json files as well
Expand Down
Loading