-
Notifications
You must be signed in to change notification settings - Fork 84
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
Improving the Differential Phase Contrast processing structure #1039
Comments
Actually, maybe HyperSpy's |
@magnunor This sounds really good! I do think that we need to be better about documenting what "DPC" means to us. We could probably copy and paste the first part into the documentation.
I don't __ love__ the idea of having more signals if there isn't anything particular to a DPC signal other than changing the output for certain methods. I feel like we already have a lot of signals and it's a bit hard to keep track/ manage workflows. We end up with lots of subclassing as a result it makes it difficult to follow where things come from in the documentation. That being said I could be convinced pretty easily. I do like the idea of renaming |
@magnunor I was thinking something like: s = hs.load("stem_dpc_data.zspy", lazy=True)
s_nav = s.mean(axis=(-1, -2)).T
s_nav.compute()
s.plot(navigator=s_nav)
shifts = s.get_direct_beam_position() # beam shift object
# Need to compute the shifts before making the linear plane...
linear_plane = shifts.make_linear_plane() # Add extra options to this function for things like using the corners etc...
dpc_shifts = shifts-linear_plane
dpc_signal = dpc_shifts.T # Automatically converts a shifts (Vectors) to a signal by wrapping the .T hyperspy method. |
Actually, having thought about this a bit more: the reason I don't (currently) like to use beamshift_current.webmHowever, if we simply changed the default plotting for beamshift_transposed.webmWe could then move the functions from DPCSignal into the I think this would be a nicer implementation, as we keep the "navigation-dimension-is-probe-position". While still having the nice and easy visualization accessible via Things to change would then be:
|
That sounds perfect.
I think this sounds great. We would need to compute the signal before we plot but I think that is understandable. Otherwise the way to visualize the shifts would be to overlay the shifts over the signal and plot as a set of markers. |
I'll make a pull request with the changes outlined here. |
In the #1057 pull request, I did quite a few API-breaking changes. I'm guessing those changes should not be in the next release ( Should there be a separate pull request with tagging the functions which will be removed or changed? |
As discussed in the pyxem 1.0.0 Issue (#624 (comment)), it would be nice to improve the DPC processing structure for that release.
Background
When I write "STEM-DPC", I refer to the technique which is used to measure the in-plane magnetic and electric field through the shift or deflection of the direct electron beam. This is caused by the Lorentz force F = -eE - (ev x B): https://doi.org/10.1016/j.ultramic.2016.03.006 . Some people have slightly different definitions of STEM-DPC, but I think the one where the main contrast contribution is from beam deflection/shift is a good one. Ergo: the main data processing routines involves finding how much the direct electron beam has been deflected for each probe position in a STEM scan.
Conceptual data processing steps
So, with regards to data processing "pipeline" it typically looks something like this:
Simple example
Currently in pyXem, a simple processing pipeline for this: (see this link for a dataset, https://filesender.sikt.no/?s=download&token=3e32a0fe-7800-4ccd-b3ef-9d75c0b8805d . Note that the dataset link expires 19/04/2024.)
More advanced example
A bit more advanced processing, where the descan is corrected on the 4-D dataset. This so the shifts of the direct beam can be manually inspected. As seen in the code, this should be improved.
Future structure?
So the question is: is this an optimal class "structure"? (I discussed this a bit in this pull request comment: #1005 (review))
One idea could be to repurpose the
DPCSignal
class name, to be the "4-D container". Which inheritsDiffraction2D
. The currentDPCSignal
class could be renamedDPCVector
? Which meansDPCSignal.center_of_mass
would returnDPCVector
classes.There could also be further sub-class, like
MagneticDPCSignal
andElectricDPCSignal
, which has functionality specific for those. Like for example a 90 degrees vector "shift" in the magnetic signal, and automatic calculation to magnetic units if the data is calibrated.The text was updated successfully, but these errors were encountered: