This commit is contained in:
Anastasiia Kutakh
2021-08-20 21:45:27 -04:00
parent 8493a3fb41
commit 53742d0245
2 changed files with 19 additions and 1 deletions
+11 -1
View File
@@ -451,6 +451,16 @@ class CDIModel(t.nn.Module):
"""
print('base models inspect: checking the object')
a = self.obj.detach()
def saveobj(a, filename):
a = np.abs(a)
plt.imshow(a)
plt.savefig('filename')
f = ['base_a.png', 'base_b.png', 'base_c.png', 'base_d.png']
comp = [a[i, j, :, :] for i, j in zip([0, 0, 1, 1], [0, 1, 0, 1])]
for i in range(4):
saveobj(comp[i], f[i])
first_update = False
if update and hasattr(self, 'figs') and self.figs:
figs = self.figs
@@ -585,7 +595,7 @@ class CDIModel(t.nn.Module):
if logarithmic:
sim_data =np.log(sim_data)/np.log(10)
meas_data = np.log(meas_data)/np.log(10)
if not updating:
axes[0].set_title('Simulated')
axes[1].set_title('Measured')
+8
View File
@@ -92,6 +92,13 @@ class PolarizedFancyPtycho(FancyPtycho):
obj = t.stack((obj, obj), dim=-4)
print('object', type(obj), obj.shape)
model.obj.data = obj
print('polarized fancy ptycho from datset obj')
a = obj.detach()
plt.imshow(np.real(a[0, 0, :, :]))
plt.show()
plt.imshow(np.real(a[0, 1, :, :]))
plt.show()
# tensor vs tensor.data
return model
@@ -130,6 +137,7 @@ class PolarizedFancyPtycho(FancyPtycho):
shift_probe=True, multiple_modes=True, polarized=True)
analyzed_exit_waves = polarization.apply_linear_polarizer(exit_waves, analyzer)
# print('POLARIZED FANCY PTYCHO INTERACTION OBJ')
return analyzed_exit_waves