add the test for simple_ptycho_model'

This commit is contained in:
Abraham Levitan committed 2019-10-07 15:44:17 -04:00
1 parent e71c266fe4
commit f78a39daf5
2 files changed
+21 -1

No files matched your search

+20
View File
@@ -105,3 +105,23 @@ class SimplePtycho(CDIModel):
if __name__ == '__main__':
from basic_ptycho_dataset import BasicPtychoDataset
from h5py import File
from matplotlib import pyplot as plt
filename = 'example_data/lab_ptycho_data.cxi'
with File(filename, 'r') as f:
dataset = BasicPtychoDataset.from_cxi(f)
model = SimplePtycho.from_dataset(dataset)
#model.to(device='cuda')
#dataset.get_as(device='cuda')
for i, loss in enumerate(model.Adam_optimize(100, dataset)):
model.inspect(dataset)
print(i,loss)
model.compare(dataset)
plt.show()