Skip to content

Commit

Permalink
Changed shift method in ZLP subpixel align to scipy.ndimage.shift wit…
Browse files Browse the repository at this point in the history
…h linear interpolation to get rid of artifacts.
  • Loading branch information
Andreas authored and cmeyer committed Oct 3, 2019
1 parent 5d2bda6 commit 710a798
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nionswift_plugin/nion_eels_analysis/AlignZLP.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ def align_zlp_xdata_subpixel(src_xdata: DataAndMetadata.DataAndMetadata, progres
mx_pos = numpy.argmax(flat_src_data[i])
# determine the offset and apply it
offset = ref_pos - mx_pos
src_data_fft = numpy.fft.fftn(flat_src_data[i])
flat_dst_data[i] = numpy.fft.ifftn(scipy.ndimage.fourier_shift(src_data_fft, offset)).real
flat_dst_data[i] = scipy.ndimage.shift(flat_src_data[i], offset, order=1)
# every row, report progress (will also work for a sequence or 1d collection
# because there we have only 1 row anyways)
if i % src_shape[1] == 0 and callable(progress_fn):
Expand Down Expand Up @@ -178,3 +177,4 @@ def progress(i):
print("Failed: Data is not a sequence or collection of 1D spectra.")
else:
print("Failed: No data item selected.")

0 comments on commit 710a798

Please sign in to comment.