empyer.signals¶
Submodules¶
empyer.signals.em_signal module¶
-
class
empyer.signals.em_signal.
EMSignal
(*args, **kwargs)¶ Bases:
hyperspy._signals.signal2d.Signal2D
The Diffraction Signal class extends the Hyperspy 2d signal class
-
add_haadf_intensities
(intensity_array, slope, intercept)¶ Add High Angle Annular Dark Field intensities for each point.
Parameters: intensity_array (nd array) – An intensity array which is the same size of the navigation axis. Acts as a measure of the thickness if there is a calculated normalized intensity. For masking in real space. Matches data input NOT the real space coordinates from Hyperspy. (To match Hyperspy use np.transpose on intensity array)
-
add_mask
()¶
-
as_lazy
(*args, **kwargs)¶
-
get_signal_axes_values
()¶ Returns the values for each pixel of the signal. Useful for plotting without using hyperspy
Returns: - axis0 (array-like) – The values for axis 0
- axis1 (array-like) – The values for axis 1
-
get_thicknesses
()¶
-
mask_above
(value, unmask=False)¶ Applies a mask to every pixel with a value below some value
Parameters: - value (float) – The minimum pixel value to apply a mask to.
- unmask (bool) – Unmask any pixel with a value above value
-
mask_below
(value, unmask=False)¶ Applies a mask to every pixel with an average value below value
Parameters: - value (float) – The maximum pixel value to apply a mask to.
- unmask (bool) – Unmask any pixel with a value below value
-
mask_border
(pixels=1)¶
-
mask_circle
(center, radius, unmask=False)¶ Applies a mask to every pixel using a shape and the appropriate definition
Parameters: - shape (str) – Acceptable shapes [‘rectangle, ‘circle’]
- data (list) – Define shapes. eg ‘rectangle’ -> [x1,x2,y1,y2] ‘circle’ -> [radius, x,y] data allows indexing with floats and the axes described for the signal
- unmask (bool) – Unmask any pixels in the defined shape
-
mask_where
(condition)¶ Mask at some condition
- condition: array_like
- Masking condition
-
reset_mask
()¶
-
set_axes
(index, name=None, scale=None, units=None, offset=None)¶ Set axes of the signal
Parameters: - index (int) – The index of the axes
- name (str) – The name of the axis
- scale (float) – The scale fo the axis
- units (str) – The units of the axis
- offset (float) – The offset of the axes
-
thickness_filter
()¶ Filter based on HAADF intensities
Returns: - th_filter (array-like) – Integers which are used to filter into different thicknesses. Basically used to bin the signal
- thicknesses (1-d array) – The thicknesses for the signal at every integer.
-
-
class
empyer.signals.em_signal.
LazyEMSignal
(*args, **kwargs)¶ Bases:
hyperspy._signals.lazy.LazySignal
,empyer.signals.em_signal.EMSignal
-
class
empyer.signals.em_signal.
MaskPasser
(s, sl, nav)¶ Bases:
object
-
mask_above
(minimum)¶ Mask above the minimum value
- minimum: float
- Mask any values in the slice above the minimum value
-
mask_below
(maximum)¶ Mask below the max value
- maximum: float
- Mask any values in the slice below the maximum value
-
mask_circle
(center, radius, unmask=False)¶ Applies a mask to every pixel using a shape and the appropriate definition
Parameters: - center (tuple) – The (x,y) center of the circle
- radius (float or int) – The radius of the circle
- unmask (bool) – Unmask any pixels in the defined shape
-
mask_where
(condition)¶ Mask at some condition
- condition: array_like
- Masking condition
-
-
class
empyer.signals.em_signal.
MaskSlicer
(obj, isNavigation)¶ Bases:
hyperspy.misc.slicing.SpecialSlicers
Expansion of the Special Slicer class. Used for applying a mask
empyer.signals.diffraction_signal module¶
-
class
empyer.signals.diffraction_signal.
DiffractionSignal
(*args, **kwargs)¶ Bases:
empyer.signals.em_signal.EMSignal
The Diffraction Signal class extends the Hyperspy 2d signal class This class name should be changed….
-
as_lazy
(*args, **kwargs)¶ Returns the signal as a lazy signal.
-
calculate_polar_spectrum
(phase_width=720, radius=[0, -1], parallel=False, inplace=False, segments=None, num_points=500)¶ Take the Diffraction Pattern and unwrap the diffraction pattern.
Parameters: - phase_width (int) – The number of pixels in the x direction
- radius (int) – The number of pixels in the y direction
- parallel (boolean) – use multiple processors for calculations (useful for large numbers of diffraction patterns, more for large pixel size)
- inplace (boolean) – replaces diffraction pattern data with polar equivalent
Returns: polar – Polar signal returned
Return type:
-
determine_ellipse
(num_points=500, suspected_radius=None, interactive=False, plot=False)¶ Determine the elliptical nature of the diffraction pattern.
Parameters: - interactive (Boolean) – ‘interactive’ nature means that points are chosen to create a ring
- axis (int) – ‘axis’ to determine ellipse along
- num_points (int) – number of points to define ellipse by (only used if interactive = False)
- plot (Boolean) – Weather or not to plot the ellipse
Returns: - center (list of int) – the center of the ellipse
- lengths (list of int) – the length in pixels of the major and minor axes
- angle (float) – the angle of the major axes
-
get_darkfield_image
(position, radius=0.5)¶ Creates a dark-field image from an artifical appature at some position with some radius. Allows for decimial spacing.
Parameters: - position (tuple) – The position of the circle to create the darkfield image
- radius (float) – The radius of the circle for the dark-field image
Returns: darkfield_image
Return type: Signal2D
-
-
class
empyer.signals.diffraction_signal.
LazyDiffractionSignal
(*args, **kwargs)¶ Bases:
hyperspy._signals.lazy.LazySignal
,empyer.signals.diffraction_signal.DiffractionSignal
empyer.signals.polar_signal module¶
-
class
empyer.signals.polar_signal.
LazyPolarSignal
(*args, **kwargs)¶ Bases:
hyperspy._signals.lazy.LazySignal
,empyer.signals.polar_signal.PolarSignal
-
class
empyer.signals.polar_signal.
PolarSignal
(*args, **kwargs)¶ Bases:
empyer.signals.em_signal.EMSignal
-
as_lazy
(*args, **kwargs)¶
-
autocorrelation
(binning_factor=1, cut=0, normalize=True)¶ Create a Correlation Signal from a numpy array.
Parameters: - binning_factor (int) – Binning factor to speed up calculations
- cut (int or float) – The number of pixels or distance to cut off image
- normalize (boolean) – normalize with autocorrelation
Returns: angle
Return type:
-
correlation_lengths
()¶ Calculates the average correlation length across the sample
-
fem
(version='omega', indicies=None)¶ Calculated the variance among some image
Parameters: - version (str) – The name of the FEM equation to use. ‘rings’ calculates the mean of the variances of all the patterns at some k. ‘omega’ calculates the variance of the annular means for every value of k.
- patterns (indicies) – Calculates the FEM pattern using only some of the patterns based on their indexes
-
empyer.signals.correlation_signal module¶
-
class
empyer.signals.correlation_signal.
CorrelationSignal
(*args, **kwargs)¶ Bases:
empyer.signals.em_signal.EMSignal
Create a Correlation Signal from a numpy array.
Parameters: - data (numpy array) – The signal data. It can be an array of any dimensions.
- axes (dictionary (optional)) – Dictionary to define the axes (see the documentation of the AxesManager class for more details).
- attributes (dictionary (optional)) – A dictionary whose items are stored as attributes.
- metadata (dictionary (optional)) – A dictionary containing a set of parameters that will to stores in the metadata attribute. Some parameters might be mandatory in some cases.
- original_metadata (dictionary (optional)) – A dictionary containing a set of parameters that will to stores in the original_metadata attribute. It typically contains all the parameters that has been imported from the original data file.
-
as_lazy
(*args, **kwargs)¶ Returns the signal as a lazy signal.
-
get_power_spectrum
(method='FFT')¶ Calculate a power spectrum from the correlation signal
Parameters: method (str) – ‘FFT’ gives fourier transformation of the angular power spectrum. Currently the only method available
-
get_summed_power_spectrum
()¶ Returns the power spectrum from the summed correlation signal.
-
class
empyer.signals.correlation_signal.
LazyCorrelationSignal
(*args, **kwargs)¶ Bases:
hyperspy._signals.lazy.LazySignal
,empyer.signals.correlation_signal.CorrelationSignal
empyer.signals.power_signal module¶
-
class
empyer.signals.power_signal.
LazyPowerSignal
(*args, **kwargs)¶ Bases:
hyperspy._signals.lazy.LazySignal
,empyer.signals.power_signal.PowerSignal
-
class
empyer.signals.power_signal.
PowerSignal
(*args, **kwargs)¶ Bases:
empyer.signals.em_signal.EMSignal
-
as_lazy
(*args, **kwargs)¶ Returns the signal as a lazy signal.
-
get_i_vs_k
(symmetry=None)¶ Get the intensity versus k for the summed diffraction patterns
Parameters: symmetry (int or array-like) – specific integers or list of symmetries to average over when creating the map of the correlations. Returns: i – The intensity as a function of k for some signal Return type: Signal-2D
-
get_map
(k_region=[3.0, 6.0], symmetry=None)¶ Creates a 2 dimensional map of from the power spectrum.
Parameters: - k_region (array-like) – upper and lower k values to integrate over, allows both ints and floats for indexing
- symmetry (int or array-like) – specific integers or list of symmetries to average over when creating the map of the correlations.
Returns: symmetry_map – 2 dimensional map of from the power spectrum
Return type: 2-d array
-
plot_symmetries
(k_region=[3.0, 6.0], symmetry=[2, 4, 6, 8, 10], *args, **kwargs)¶ Plots the symmetries in the list of symmetries. Plot symmetries takes all of the arguements that imshow does.
Parameters: k_region (array-like) – upper and lower k values to integrate over, allows both ints and floats for indexing - symmetry: list
- specific integers or list of symmetries to average over when creating the map of the correlations.
-