2.6. empix.crop
- crop(input_signal, optional_params=None)[source]
Crop a given input 2D
hyperspysignal.This Python function applies a series of optional transformations to a given input 2D
hyperspysignal. Let us denote the input 2Dhyperspysignal by \(F_{\mathbf{m}; l_x, l_y}\), where \(l_x\) and \(l_y\) are integers indexing the sampled horizontal and vertical coordinates respectively in the signal space of the input signal, and \(\mathbf{m}\) is a vector of integers representing the navigation indices of the input signal. The Python function effectively does the following:1. Copies the input signal and optionally pads the copy along the horizontal and vertical axes in signal space according to the parameter
pad_mode;2. Constructs a cropping window in the signal space of the (optionally padded) copy of the input signal, with the cropping window dimensions being determined by the parameter
window_dims;3. Shifts the center of the cropping window to coordinates determined by the parameter
center;4. Shifts the center of the cropping window again to the coordinates of the pixel closest to the aforementioned coordinates in the previous step;
5. Crops the (optionally padded) copy of the input signal along the horizontal and vertical dimensions of the signal space according to the placement of the cropping window in the previous two steps;
6. Optionally applies a symmetric mask to the cropped signal resulting from the previous step according to the parameter
apply_symmetric_mask.See the description below of the optional parameters for more details.
- Parameters:
- input_signal
hyperspy._signals.signal2d.Signal2D|hyperspy._signals.complex_signal2d.ComplexSignal2D The input
hyperspysignal.- optional_params
empix.OptionalCroppingParams| None, optional The set of optional parameters. See the documentation for the class
empix.OptionalCroppingParamsfor details. Ifoptional_paramsis set toNone, rather than an instance ofempix.OptionalCroppingParams, then the default values of the optional parameters are chosen.
- input_signal
- Returns:
- output_signal
hyperspy._signals.signal2d.Signal2D|hyperspy._signals.complex_signal2d.ComplexSignal2D The output
hyperspysignal that results from the applied transformations, described above. Note that the metadata of the input signal is copied over to the output signal, with the title being overwritten.
- output_signal