2.8. empix.downsample

downsample(input_signal, optional_params=None)[source]

Downsample a given input 2D hyperspy signal.

This Python function copies a given input 2D hyperspy signal and downsamples the copy along the axes in signal space. The Python function effectively does the following:

1. Groups the pixels of the copy of the input signal into so-called downsampling blocks along the axes in signal space, with dimensions determined by the parameter block_dims, padding the copy with a constant value of padding_const in the case that either the horizontal or vertical dimensions of the signal space of the original input signal are not divisible by the corresponding dimensions of the downsampling blocks.

2. For each downsampling block, the Python function calls a numpy function determined by the parameter downsample_mode, wherein the input is the array data of the downsampling block, and the output is the value of the corresponding pixel of the downsampled signal.

Parameters:
input_signalhyperspy._signals.signal2d.Signal2D | hyperspy._signals.complex_signal2d.ComplexSignal2D

The input hyperspy signal.

optional_paramsempix.OptionalDownsamplingParams | None, optional

The set of optional parameters. See the documentation for the class empix.OptionalDownsamplingParams for details. If optional_params is set to None, rather than an instance of empix.OptionalDownsamplingParams, then the default values of the optional parameters are chosen.

Returns:
output_signalhyperspy._signals.signal2d.Signal2D | hyperspy._signals.complex_signal2d.ComplexSignal2D

The output hyperspy signal that results from the downsampling. Note that the metadata of the input signal is copied over to the output signal, with the title being overwritten.