Add sim-to-dataset capability

This commit is contained in:
Abe Levitan committed 2019-06-27 17:26:36 -04:00
1 parent f769f9e7ab
commit a2a07055c4
3 files changed
+61 -3

No files matched your search

+4 -1
View File
@@ -11,9 +11,11 @@ filename = 'example_data/AuBalls_700ms_30nmStep_3_6SS_filter.cxi'
with h5py.File(filename,'r') as f:
dataset = CDTools.datasets.Ptycho_2D_Dataset.from_cxi(f)
model = CDTools.models.FancyPtycho.from_dataset(dataset,n_modes=3,randomize_ang=0.1*np.pi)
# default is CPU with 32-bit floats
model.to(device='cuda')
dataset.get_as(device='cuda')
@@ -24,7 +26,8 @@ for i, loss in enumerate(model.Adam_optimize(3, dataset, batch_size=100)):
print(i,loss)
#with open('test_results.pickle', 'wb') as f:
#with open('example_reconstructions/Au_balls.pickle', 'wb') as f:
# pickle.dump(model.save_results(dataset),f)
model.inspect(dataset)