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

Auto masking tool #46

Merged
merged 4 commits into from
Jun 28, 2024
Merged

Auto masking tool #46

merged 4 commits into from
Jun 28, 2024

Conversation

OliDG
Copy link
Contributor

@OliDG OliDG commented Jun 27, 2024

Tool to automatically generate a mask based on the darkest portion of the image. Quite straightforward, to skip the manual definition of a mask, much faster to apply to different DP as it compensates for possible beam stopper movement (image rotation during acquisition or beam stopper mechanical play). In addition. it cuts out much closer to the beam stopper, keeping in valuable information for the autocenter() operation.

  • Fixes Issue: no need for manual mask definition to remove the beam stopper.
  • [function to automatically generate a mask from an image] CHANGELOG.rst updated.
  • Changes Proposed by this Pull Request: auto_center function can require a mask. This function add an automated generation of a mask from any image, will precisely cut out the beam stopper and spare valuable information from its immediate surrounding. The mask is based on the 10% darkest values as default but can be adjusted (optionally). The tutorial section was updated and tested.

Olivier Donzel-Gargand added 3 commits June 27, 2024 15:16
Tool to automatically generate a mask based on the darkest portion of the image. This to skip the manual definition of one and to compensate for possible beam stopper movement (image rotation during acquisition or beam stopper mechanical play).
black formatting check, added to the loading by default and updated tutorials section
@LaurentRDC
Copy link
Owner

Hi Olivier,

Very cool, thanks for your contribution.

Before I merge, could you:

  • Add at least one unit test? It can be very simple, trivial even;
  • Make sure to run the black code formatter, which is causing the lint job to fail.

If you are not used to black, you can install it as follows:

pip install -r dev-requirements.txt
black .

@OliDG
Copy link
Contributor Author

OliDG commented Jun 28, 2024

Thanks. :) I ran "black" earlier but modified further, now it should be Ok. How do I properly update the current merge request? shall I simply push the changes to my fork?

What is a unit test? I ran the pytest as requested:

pytest scikit-ued
=================================================================== test session starts ====================================================================
platform win32 -- Python 3.11.7, pytest-8.2.2, pluggy-1.5.0
rootdir: C:\Users\oldo\scikit-ued
plugins: anyio-4.2.0
collected 569 items

scikit-ued\skued\baseline\tests\test_algorithms.py ...........                                                                                        [  1%]
scikit-ued\skued\baseline\tests\test_dtcwt.py ....................................................................................................... [ 20%]
.............................................................................................................................                         [ 42%]
scikit-ued\skued\image\tests\test_alignment.py .......                                                                                                [ 43%]
scikit-ued\skued\image\tests\test_brillouin.py .                                                                                                      [ 43%]
scikit-ued\skued\image\tests\test_calibration.py .....                                                                                                [ 44%]
scikit-ued\skued\image\tests\test_center.py ......................................................................................................... [ 62%]
.............................................                                                                                                         [ 70%]
scikit-ued\skued\image\tests\test_indexing.py ..                                                                                                      [ 71%]
scikit-ued\skued\image\tests\test_indexing_persistence.py ..                                                                                          [ 71%]
scikit-ued\skued\image\tests\test_metrics.py ...................                                                                                      [ 74%]
scikit-ued\skued\image\tests\test_powder.py ......                                                                                                    [ 75%]
scikit-ued\skued\image\tests\test_symmetry.py ...............                                                                                         [ 78%]
scikit-ued\skued\io\tests\test_io.py .........                                                                                                        [ 79%]
scikit-ued\skued\simulation\tests\test_kinematic.py ....                                                                                              [ 80%]
scikit-ued\skued\simulation\tests\test_potential.py ...                                                                                               [ 81%]
scikit-ued\skued\simulation\tests\test_powdersim.py ..                                                                                                [ 81%]
scikit-ued\skued\simulation\tests\test_structure_factors.py .....                                                                                     [ 82%]
scikit-ued\skued\tests\test_affine.py .................                                                                                               [ 85%]
scikit-ued\skued\tests\test_array_utils.py .............                                                                                              [ 87%]
scikit-ued\skued\tests\test_eproperties.py ........                                                                                                   [ 89%]
scikit-ued\skued\tests\test_patterson.py .                                                                                                            [ 89%]
scikit-ued\skued\tests\test_plot_utils.py ........                                                                                                    [ 90%]
scikit-ued\skued\tests\test_potential_map.py ......                                                                                                   [ 91%]
scikit-ued\skued\tests\test_thin_films.py ..                                                                                                          [ 92%]
scikit-ued\skued\tests\test_voigt.py ..........                                                                                                       [ 93%]
scikit-ued\skued\time_series\tests\test_fitting.py ...........                                                                                        [ 95%]
scikit-ued\skued\time_series\tests\test_nfft.py ...                                                                                                   [ 96%]
scikit-ued\skued\time_series\tests\test_robust.py ....                                                                                                [ 97%]
scikit-ued\skued\time_series\tests\test_selections.py ..........                                                                                      [ 98%]
scikit-ued\skued\time_series\tests\test_time_zero.py .......                                                                                          [100%]

=================================================================== 569 passed in 36.15s ===================================================================

Black formatting
@LaurentRDC
Copy link
Owner

I will add a unit test once I merge the branch then, don't worry about it.

For your information, unit tests are small, self-contained tests like this one.

@LaurentRDC LaurentRDC merged commit 4c07a35 into LaurentRDC:master Jun 28, 2024
10 checks passed
@LaurentRDC
Copy link
Owner

Thank you for your contribution! I will create a new release today

LaurentRDC added a commit that referenced this pull request Jun 28, 2024
@LaurentRDC
Copy link
Owner

Your contribution has been released in version 2.1.17

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.

None yet

2 participants