Buncha stuff, sorry I wasn't pushing

This commit is contained in:
Abe Levitan committed 2021-10-26 13:11:11 -04:00
1 parent f84e441843
commit 1b5ef2271c
8 files changed
+105 -46

No files matched your search

+3 -3
View File
@@ -66,9 +66,9 @@ def get_entry_info(cxi_file):
'program_name']
metadata = {attr: str(e1[attr][()].decode()) for attr in metadata_attrs
if attr in e1}
datetime_attrs = ['start_time',
'end_time']
for attr in datetime_attrs:
for attr in metadata_attrs:
if attr in e1:
try:
metadata[attr] = dateutil.parser.parse(str(e1[attr][()].decode()))
+1 -7
View File
@@ -627,13 +627,7 @@ def RPI_interaction(probe, obj):
pad1l = (probe.shape[-1] - obj.shape[-1])//2
pad1r = probe.shape[-1] - obj.shape[-1] - pad1l
if obj.dim() == 2:
fftobj = t.nn.functional.pad(fftobj, (pad1l, pad1r, pad0l, pad0r))
elif obj.dim() == 3:
fftobj = t.nn.functional.pad(
fftobj, (pad1l, pad1r, pad0l, pad0r, 0,0))
else:
raise NotImplementedError('RPI interaction with obj of dimension higher than 4 (including complex dimension) is not supported.')
fftobj = t.nn.functional.pad(fftobj, (pad1l, pad1r, pad0l, pad0r))
# Again, just an inverse FFT but with an fftshift
upsampled_obj = propagators.inverse_far_field(fftobj)
+4 -2
View File
@@ -82,7 +82,7 @@ def get_units_factor(units):
return factor
def plot_image(im, plot_func=lambda x: x, fig=None, basis=None, units='$\\mu$m', cmap='viridis', cmap_label=None, **kwargs):
def plot_image(im, plot_func=lambda x: x, fig=None, basis=None, units='$\\mu$m', cmap='viridis', cmap_label=None, interpolation=None, **kwargs):
"""Plots an image with a colorbar and on an appropriate spatial grid
If a figure is given explicitly, it will clear that existing figure and
@@ -112,6 +112,8 @@ def plot_image(im, plot_func=lambda x: x, fig=None, basis=None, units='$\\mu$m',
Default is 'viridis', the colormap to plot with
cmap_label : str
What to label the colorbar when plotting
interpolation : str
What interpolation to use for imshow
\\**kwargs
All other args are passed to fig.add_subplot(111, \\**kwargs)
@@ -169,7 +171,7 @@ def plot_image(im, plot_func=lambda x: x, fig=None, basis=None, units='$\\mu$m',
else:
extent=None
plt.imshow(to_plot, cmap = cmap, extent = extent)
plt.imshow(to_plot, cmap = cmap, extent = extent, interpolation=interpolation)
cbar = plt.colorbar()
if cmap_label is not None:
cbar.set_label(cmap_label)