diff --git a/py4DSTEM/preprocess/preprocess.py b/py4DSTEM/preprocess/preprocess.py index c72240b4c..162b9a32d 100644 --- a/py4DSTEM/preprocess/preprocess.py +++ b/py4DSTEM/preprocess/preprocess.py @@ -649,7 +649,12 @@ def resample_data_diffraction( if not resampling_factor: resampling_factor = old_size[2] / output_size[0] if datacube.calibration.get_Q_pixel_size() is not None: - datacube.calibration.set_Q_pixel_size(datacube.calibration.get_Q_pixel_size() * resampling_factor) + datacube.calibration.set_Q_pixel_size(datacube.calibration.get_Q_pixel_size() / resampling_factor) + + if not resampling_factor: + resampling_factor = old_size[2] / output_size[0] + if datacube.calibration.get_Q_pixel_size() is not None: + datacube.calibration.set_Q_pixel_size(datacube.calibration.get_Q_pixel_size() / resampling_factor) elif method == "bilinear": from scipy.ndimage import zoom