Virtual annulus and aperture for diffraction pattern analysis in Jupyter notebook

48 views
Skip to first unread message

Manuel Schweikle

unread,
May 2, 2018, 11:06:52 AM5/2/18
to hyperspy-users
Hi all,

I am working with data sets of TEM diffraction patterns where every pixel of the two-dimensional navigation dimension contains a two-dimensional electron diffraction pattern. The HyperspyUI allows to reconstruct virtual images using a virtual apertures or annulus (see attached screenshot). Is there also a way to use this feature in a Jupyter notebook?

Thanks for your help. Cheers,
Manuel
Capture.PNG

Manuel Schweikle

unread,
May 9, 2018, 7:37:19 AM5/9/18
to hyperspy-users
Hi,

Pushing this up again. Is there any way to generate reconstructions from diffraction patterns using virtual apertures or annuli with Jupyter-notebook? I could not find anything about this in the Hyperspy documentation and using the feature in the ui is slow, unprecise and not well reproducible. 

Thanks beforehand for your help. Best,
Manuel

Francisco

unread,
May 9, 2018, 7:47:35 AM5/9/18
to hyperspy-users
In order to perform the same operation with HyperSpy scripting you can use a CircleROI. See the User Guide for details on ROIs.

Francisco

PS: these days this kind of questions tend get quicker replies in the gitter chat.

Manuel Schweikle

unread,
May 9, 2018, 8:08:44 AM5/9/18
to hyperspy-users
Hi Francisco,

Thanks for the quick help and the info about the gitter chat!

Have a nice day,
Manuel

Manuel Schweikle

unread,
May 15, 2018, 9:35:25 AM5/15/18
to hyperspy-users
Hi again,

I did somewhat succeed to create reconstructions for a virtual aperture using the CircleROI tool. However, the way I did it, I have to swap navigation and signal space using transpose to apply the ROI to the signal (the diffraction pattern). My dataset is loaded into the variable s and has the dimensions (200, 200|144, 144). What I did is the following:

roi = hs.roi.CircleROI(1.165, 1.165, 0.5, 0.35) #DP scaled in cm, center approx. at 1.16 cm.
signal = s.T #Transposing DP to swap navigation and signal spaces. This allows applying a roi to the DP.
signal.plot() #Generate plot for ROI to be displayed.
s_virtual = roi.interactive(signal).T
s_nav = hs.interactive(s_virtual.mean, s_virtual.events.data_changed, axis=s_virtual.axes_manager.signal_axes).
s_nav.plot()

This way, however, I cannot apply the aperture to a selected diffraction pattern (i.e. one of the coordinates of the original navigation space). Is there a way to directly apply a ROI to the signal as it is done in the HyperspyUI?

Thanks again for your help in advance. Best,
Manuel

Francisco

unread,
May 16, 2018, 7:34:49 AM5/16/18
to hyperspy-users
This was answered in the gitter chat, see https://gitter.im/hyperspy/hyperspy?at=5afbfd33b84be71db90edd1a
Reply all
Reply to author
Forward
0 new messages