Skip to content

Commit db79a01

Browse files
author
Peter Ercius ncem-gauss jupyter
committed
Use tifffile imwrite instead of imsave. Check for file extension in real space file write.
1 parent 2bbf929 commit db79a01

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

DuSC_explorer/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pyqtgraph as pg
1111
from pyqtgraph.graphicsItems.ROI import Handle
1212
import numpy as np
13-
from tifffile import imsave
13+
from tifffile import imwrite
1414
from numba import jit, prange
1515
import stempy.io as stio
1616

@@ -400,18 +400,20 @@ def _on_export(self):
400400
out_path = Path(file_name)
401401
else:
402402
return
403-
403+
404404
# Get the data and change to float
405405
if action.text() == 'Export diffraction (TIF)':
406406
if out_path.suffix != '.tif':
407407
out_path = out_path.with_suffix('.tif')
408-
imsave(out_path, self.dp.reshape(self.frame_dimensions).astype(np.float32))
408+
imwrite(out_path, self.dp.reshape(self.frame_dimensions).astype(np.float32))
409409
elif action.text() == 'Export diffraction (SMV)':
410410
if out_path.suffix != '.img':
411411
out_path = out_path.with_suffix('.img')
412412
self._write_smv(out_path)
413413
elif action.text() == 'Export real (TIF)':
414-
imsave(out_path, self.rs.reshape(self.scan_dimensions).astype(np.float32))
414+
if out_path.suffix != '.tif':
415+
out_path = out_path.with_suffix('.tif')
416+
imwrite(out_path, self.rs.reshape(self.scan_dimensions).astype(np.float32))
415417
else:
416418
print('Export: unknown action {}'.format(action.text()))
417419

0 commit comments

Comments
 (0)