Skip to content

Bugfix for memmap not working with Quantity - #125

Merged
WilliamJamieson merged 3 commits into
astropy:mainfrom
WilliamJamieson:bugfix/quantity_memmap
Oct 24, 2022
Merged

WilliamJamieson merged 3 commits into
astropy:mainfrom
WilliamJamieson:bugfix/quantity_memmap

Conversation

@WilliamJamieson

Copy link
Copy Markdown
Contributor

Based on the discussion in astropy/astropy#13864, I found that we need to add the copy=False flag to the array constructor and arrange for a more complicated test for memmap than we normally require.

resolves astropy/astropy#13864

@WilliamJamieson

Copy link
Copy Markdown
Contributor Author

@mhvk Thank you for your note in astropy/astropy#13864 (comment).

Would you mind reviewing these changes?

@codecov

codecov Bot commented Oct 20, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #125 (71d4b78) into main (7ffd099) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 71d4b78 differs from pull request most recent head 3888a86. Consider uploading reports for the commit 3888a86 to get more accurate results

@@            Coverage Diff            @@
##              main      #125   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        30           
  Lines         1017      1017           
=========================================
  Hits          1017      1017           
Impacted Files Coverage Δ
asdf_astropy/converters/unit/quantity.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Comment thread CHANGES.rst Resolved
"""
Test that memmap (copy_arrays=False) works with quantities.

Unfortunately, this is not a simple `isinstance(obj, np.memmap)`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a way I guess it is OK to test just on the actual effect -- certainly, for np.memmap, something can be an instance without an actual file backing it.

@mhvk

mhvk commented Oct 20, 2022

Copy link
Copy Markdown

@WilliamJamieson - the change looks logical and the tests good!

@nden nden left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@perrygreenfield perrygreenfield left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WilliamJamieson
WilliamJamieson merged commit 2f975c4 into astropy:main Oct 24, 2022
@WilliamJamieson
WilliamJamieson deleted the bugfix/quantity_memmap branch October 24, 2022 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for memmap in Quantity

5 participants