mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-11-23 06:04:05 +01:00
Fix the input polarizer issue
This commit is contained in:
1 parent
cd6a811a63
commit
37a97a9618
4 files changed
+22
-17
No files matched your search
@@ -423,9 +423,10 @@ def ptycho_2D_sinc(probe, obj, translations, shift_probe=True, padding=10, multi
|
||||
exit_waves : torch.Tensor
|
||||
An (N)x(P)xMxL tensor of the calculated exit waves
|
||||
"""
|
||||
|
||||
single_translation = False
|
||||
if translations.dim() == 1:
|
||||
translations = translations[None,:]
|
||||
translations = translations[None, :]
|
||||
single_translation = True
|
||||
|
||||
# Separate the translations into a part that chooses the window
|
||||
@@ -438,8 +439,8 @@ def ptycho_2D_sinc(probe, obj, translations, shift_probe=True, padding=10, multi
|
||||
tr[1]:tr[1]+probe.shape[-1]]
|
||||
for tr in integer_translations])
|
||||
else:
|
||||
selections = t.stack([obj[:, :,tr[0]:tr[0]+probe.shape[-2],
|
||||
tr[1]:tr[1]+probe.shape[-1]]
|
||||
selections = t.stack([obj[:, :, tr[0]:tr[0]+probe.shape[-2],
|
||||
tr[1]:tr[1]+probe.shape[-1]]
|
||||
for tr in integer_translations])
|
||||
# Nx2x2xMxL tensor
|
||||
|
||||
@@ -480,7 +481,6 @@ def ptycho_2D_sinc(probe, obj, translations, shift_probe=True, padding=10, multi
|
||||
|
||||
else:
|
||||
raise NotImplementedError('Object shift not yet implemented')
|
||||
print('ptyvho 2d sinc', output.shape)
|
||||
if single_translation:
|
||||
return output[0]
|
||||
else:
|
||||
|
||||
@@ -17,11 +17,11 @@ from matplotlib import ticker, patheffects
|
||||
__all__ = ['colorize', 'plot_amplitude', 'plot_phase',
|
||||
'plot_colorized', 'plot_translations', 'get_units_factor',
|
||||
'plot_nanomap', 'plot_real', 'plot_imag',
|
||||
'plot_nanomap_with_images',
|
||||
'polarized_plot_component_amplitudes',
|
||||
'polarized_plot_phase_ret',
|
||||
'polarized_plot_global_phases',
|
||||
'polarized_plot_ellipses']
|
||||
'plot_nanomap_with_images']#,
|
||||
#'polarized_plot_component_amplitudes',
|
||||
#'polarized_plot_phase_ret',
|
||||
#'polarized_plot_global_phases',
|
||||
#'polarized_plot_ellipses']
|
||||
|
||||
|
||||
def colorize(z):
|
||||
|
||||
@@ -27,6 +27,7 @@ def generate_linear_polarizer(pol_angle):
|
||||
if pol_angle.dim() == 0:
|
||||
pol_angle = t.unsqueeze(pol_angle,0)
|
||||
single_angle = True
|
||||
|
||||
pol_angle_rad = t.deg2rad(pol_angle)
|
||||
a = t.cos(pol_angle_rad) ** 2
|
||||
b = t.sin(pol_angle_rad) * t.cos(pol_angle_rad)
|
||||
|
||||
Reference in new issue
Block a user