rosettasciio
rosettasciio copied to clipboard
Add support for pixelwise EDS live time / real time into digital micrograph file reader
Draft
Not ready to merge
Description of the change
- Add suport for pixel-wise live time / real time for EDS image
- Should these maps be converted to images or not?
ToDo:
- sum / average of pixel-wise live-time and real-time.
- What is EDS.Acquisition.Live-time multiplier ?
Progress of the PR
- [x] Change implemented (can be split into several points),
- [ ] update docstring (if appropriate),
- [ ] update user guide (if appropriate),
- [ ] add an changelog entry in the
upcoming_changesfolder (seeupcoming_changes/README.rst), - [ ] Check formatting changelog entry in the
readthedocsdoc build of this PR (link in github checks) - [ ] add tests,
- [ ] ready for review.
Minimal example of the bug fix or the new feature
import hyperspy.api as hs
s = hs.load("eds-si.dm4")
print(s.metadata.EDS.Real_time_map)
print(s.metadata.EDS.Live_time_map)
print(s.metadata.EDS.Count_rate_map)
Codecov Report
Patch coverage: 35.71% and project coverage change: -0.39 :warning:
Comparison is base (
1c1baae) 85.00% compared to head (5285b01) 84.61%.
Additional details and impacted files
@@ Coverage Diff @@
## main #124 +/- ##
==========================================
- Coverage 85.00% 84.61% -0.39%
==========================================
Files 73 73
Lines 9054 9119 +65
Branches 2049 2060 +11
==========================================
+ Hits 7696 7716 +20
- Misses 892 936 +44
- Partials 466 467 +1
| Impacted Files | Coverage Δ | |
|---|---|---|
| rsciio/digitalmicrograph/_api.py | 70.52% <35.71%> (-4.80%) |
:arrow_down: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
I am really interested into outcomes of this PR. During EMAS workshop I had an opportunity to talk with few different engineers from different vendors of EDS. Different vendors have different approaches to the same problem. In case of Bruker, live time is encoded inside EDS spectra (known as 0eV peak). Just as a funny thing, from one of other vendor representative when discussing how dead times are handled in other vendor EDS, 0eV peak was commented by one as the most brilliant way, and other as most ******-way (Both engineers was not from Bruker, just to clarify).
So for some time I was wondering if live_time should be returned as static array, or as a function, or property (which would trigger catched getter)... @nem1234 what you would suggest? Also how to deal with fact that Hyperspy expects a single value instead of array as live time?
Umm.....
We want to compare the quantity of elements between EDS and EELS. In such case, pixel time is very important and want to correct the signal intensity using pixel live time. But, most users just want a mapping of element, and they don't care pixel-wise live-time.
And in our case, (may be depend on the combination of TEM and EDS), overall live-time is not recorded into digital micrograph tags. To calculate overall live/dead time, we need pixel-wise live time table.
In my opinion,
"static array, or as a function, or property" these are good enough, but should be accessible via common method not depend on equipments / io plugins.
My current problems....
- real_time is not same as pixel time setting. Pixel time in metadata should be overwritten with real/live time?
- Only one live time map is recorded when multi cycle scanning is selected.
- Overall live/dead-time is not recorded. They need to be calculated from pixel-wise data.
- real/live_time is fluctuated in 20-30% of setting value when software sync is selected.
Hyperspy related problems:
- In hyperspy/io.py, post_process functions run before mapping functions. Calculation of overall live-time can not be placed into post_process.
- Mapping and post_process functions should be placed in rosettasciio, they should not depends on hyperspy.
In definition of EDS metadata,
- Parameter about number of frames is not defined
- Total exposure time is not defined