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

Fixes and improvement of mask handling in lazy decomposition #2657

Conversation

ericpre
Copy link
Member

@ericpre ericpre commented Mar 8, 2021

Fix #2605: mask is not supported with SVD decomposition and the error message is misleading.

Progress of the PR

  • Fix error message when performing svd decomposition of lazy signals and using mask,
  • improve docstring,
  • check signal and navigation mask,
  • add entry to CHANGES.rst (if appropriate),
  • add tests,
  • ready for review.
import hyperspy.api as hs
import numpy as np
import pytest

rng = np.random.RandomState(123)
s = hs.signals.Signal1D(rng.random_sample(size=(20, 100))).as_lazy()
sig_mask = (s.inav[0].data < 0.5).compute()
with pytest.raises(NotImplementedError):
    s.decomposition(algorithm="SVD", signal_mask=sig_mask)

@ericpre ericpre added this to the v1.6.2 milestone Mar 8, 2021
@ericpre ericpre changed the base branch from RELEASE_next_minor to RELEASE_next_patch March 8, 2021 18:36
@codecov
Copy link

codecov bot commented Mar 8, 2021

Codecov Report

Merging #2657 (dad6a71) into RELEASE_next_patch (477d488) will increase coverage by 0.61%.
The diff coverage is 88.86%.

Impacted file tree graph

@@                  Coverage Diff                   @@
##           RELEASE_next_patch    #2657      +/-   ##
======================================================
+ Coverage               75.97%   76.59%   +0.61%     
======================================================
  Files                     202      201       -1     
  Lines                   29588    29675      +87     
  Branches                 6448     6496      +48     
======================================================
+ Hits                    22480    22730     +250     
+ Misses                   5311     5182     -129     
+ Partials                 1797     1763      -34     
Impacted Files Coverage Δ
hyperspy/__init__.py 100.00% <ø> (ø)
hyperspy/_components/arctan.py 66.66% <ø> (ø)
hyperspy/_components/bleasdale.py 100.00% <ø> (ø)
hyperspy/_components/doniach.py 94.44% <ø> (ø)
hyperspy/_components/eels_arctan.py 89.47% <ø> (ø)
hyperspy/_components/eels_cl_edge.py 75.14% <ø> (ø)
hyperspy/_components/eels_double_power_law.py 96.42% <ø> (ø)
hyperspy/_components/eels_vignetting.py 63.79% <ø> (ø)
hyperspy/_components/error_function.py 81.81% <ø> (ø)
hyperspy/_components/exponential.py 81.81% <ø> (ø)
... and 192 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2e37c8...19de794. Read the comment docs.

@francisco-dlp francisco-dlp merged commit 1f4f650 into hyperspy:RELEASE_next_patch Mar 9, 2021
@ericpre ericpre deleted the fix_mask_error_message_lazy_svd branch March 9, 2021 09:25
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.

Lazy decomposition raises error on mask check
2 participants