lumispy
lumispy copied to clipboard
Automatic/interactive dark spot counter for CL maps
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:
- For automation of the counting of threading dislocations/dark spots in Cathodoluminescence maps
- Laplacian of Gaussian (LoG) algorithm enables quantitative identification of dark spots
- Saving of calculated density and markers to metadata for convenience and reproducibility of results
Progress of the PR
- [ ] add writing of LoG parameters to metadata functionality,
- [ ] add tests,
- [ ] add a changelog entry,
- [ ] ready for review.
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)
:warning: Please install the 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
@@ 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.
For me widget/ipympl is the backend that gives inline display and it I neither see the markers nor can I add/remove some.
@cssfrancis you have more experience with markers and matplotlib, can you give some guidance to implement the interactive display/adding/removing of markers to work with the different backends?
@jlaehne Hopefully I can get around to looking at this today :)