Check out the Hyperspy Workshop May 13-17, 2024 Online

correct_ramp#

DPCSignal2D.correct_ramp(corner_size=0.05, only_offset=False, out=None)[source]#

Subtract a plane from the signal by fitting a plane to the corners.

Useful for removing the effects of the center of the diffraction pattern shifting as a function of scan position.

The plane is calculated by fitting a plane to the corner values of the signal. This will only work well when the property one wants to measure is zero in these corners.

Parameters:
  • corner_size (number, optional) – The size of the corners, as a percentage of the image’s axis. If corner_size is 0.05 (5%), and the image is 500 x 1000, the size of the corners will be (500*0.05) x (1000*0.05) = 25 x 50. Default 0.05

  • only_offset (bool, optional) – If True, will subtract a “flat” plane, i.e. it will subtract the mean value of the corners. Default False

  • out (optional, DPCSignal2D signal)

Returns:

corrected_signal

Return type:

Signal2D

Examples

>>> s = pxm.data.dummy_data.get_square_dpc_signal(add_ramp=True)
>>> s_corr = s.correct_ramp()
>>> s_corr.plot()

Only correct offset

>>> s_corr = s.correct_ramp(only_offset=True)
>>> s_corr.plot()