mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-09-10 05:22:41 +02:00
Merge pull request #62 from cdtools-developers/fix-divzero-error
Stop Ptycho2DDataset.inspec() from raising a divzero error in many situations
This commit is contained in:
@@ -220,7 +220,8 @@ class Ptycho2DDataset(CDataset):
|
||||
logarithmic=True,
|
||||
units='um',
|
||||
log_offset=1,
|
||||
plot_mean_pattern=True
|
||||
plot_mean_pattern=True,
|
||||
plot_mask=False,
|
||||
):
|
||||
"""Launches an interactive plot for perusing the data
|
||||
|
||||
@@ -241,7 +242,7 @@ class Ptycho2DDataset(CDataset):
|
||||
mask = 1
|
||||
|
||||
if logarithmic:
|
||||
return np.log(meas_data + log_offset) / np.log(10) * mask
|
||||
return np.log10((meas_data * mask) + log_offset)
|
||||
else:
|
||||
return meas_data * mask
|
||||
|
||||
@@ -268,6 +269,9 @@ class Ptycho2DDataset(CDataset):
|
||||
|
||||
if plot_mean_pattern:
|
||||
self.plot_mean_pattern(log_offset=log_offset)
|
||||
|
||||
if plot_mask:
|
||||
plotting.plot_real(self.mask, title='Dataset Mask')
|
||||
|
||||
return plotting.plot_nanomap_with_images(self.translations.detach().cpu(), get_images, values=nanomap_values, nanomap_units=units, image_title='Diffraction Pattern', image_colorbar_title=cbar_title)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user