LumiSpy / lumispy

Luminescence data analysis with HyperSpy.
https://lumispy.org
GNU General Public License v3.0
26 stars 18 forks source link

Automatic/interactive dark spot counter for CL maps #214

Open aidanc151 opened 1 month ago

aidanc151 commented 1 month ago

Performs HyperSpy's find_peaks_log on Signal2D, creates markers using obtained peak positions and then applies markers to signal. Secondly, interactive marker placement and removal is enabled by mouse clicking inside the figure. Either of the functionalities can be used independently. Using the signal area and the number of markers placed, the density of dark spots is calculated, applied to the signal metadata, and also displayed as the figure title.

Description of the change

A few sentences and/or a bulleted list to describe and motivate the change:

Progress of the PR

Minimal example of the bug fix or the new feature

import hyperspy.api as hs
from lumispy.utils.signals import dark_spot_counter

# Interactive functionality does not work well with qt6
%matplotlib widget

panchromatic_map_arr = np.loadtxt('CL_panchromatic_map.txt')
panchromatic_map = hs.signals.Signal2D(panchromatic_map_arr,
                                       axes = [dict(units='µm', scale=5.66563),
                                               dict(units='µm', scale=5.66563)])

dark_spot_counter(panchromatic_map, log_algorithm=True, threshold = 0.005, min_sigma=8, color='blue', r=0.14, click_tolerance=0.1)

CL_panchromatic_map.txt

codecov-commenter commented 4 weeks ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 9.43396% with 48 lines in your changes missing coverage. Please review.

Project coverage is 91.95%. Comparing base (9c402c0) to head (f820e99). Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
lumispy/utils/signals.py 9.43% 48 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #214 +/- ## =========================================== - Coverage 100.00% 91.95% -8.05% =========================================== Files 12 12 Lines 556 597 +41 =========================================== - Hits 556 549 -7 - Misses 0 48 +48 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.