mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-09-27 20:52:08 +02:00
Maybe last time it didn't actually commit?
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@ from __future__ import division, print_function, absolute_import
|
||||
import CDTools
|
||||
from matplotlib import pyplot as plt
|
||||
import pickle
|
||||
import time
|
||||
|
||||
# First, we load an example dataset from a .cxi file
|
||||
filename = 'example_data/AuBalls_700ms_30nmStep_3_6SS_filter.cxi'
|
||||
@@ -18,8 +19,8 @@ dataset.get_as(device='cuda')
|
||||
|
||||
for i, loss in enumerate(model.Adam_optimize(30, dataset, batch_size=100)):
|
||||
# And we liveplot the updates to the model as they happen
|
||||
model.inspect(dataset)
|
||||
print(i,loss)
|
||||
model.inspect(dataset)
|
||||
|
||||
# And we save the reconstruction out to a file
|
||||
with open('example_reconstructions/gold_balls.pickle', 'wb') as f:
|
||||
|
||||
@@ -6,7 +6,7 @@ from matplotlib import pyplot as plt
|
||||
# First, we load an example dataset from a .cxi file
|
||||
filename = 'example_data/lab_ptycho_data.cxi'
|
||||
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
|
||||
plt.ion()
|
||||
# Next, we create a ptychography model from the dataset
|
||||
model = CDTools.models.SimplePtycho.from_dataset(dataset)
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
from __future__ import division, print_function, absolute_import
|
||||
|
||||
import CDTools
|
||||
from matplotlib import pyplot as plt
|
||||
import pickle
|
||||
|
||||
filename = 'example_data/lab_ptycho_data.cxi'
|
||||
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
|
||||
# dataset.inspect()
|
||||
# plt.show()
|
||||
|
||||
#model = CDTools.models.UnifiedModePtycho.from_dataset(dataset, oversampling=2,n_modes=3)#, probe_support_radius=90)
|
||||
model = CDTools.models.UnifiedModePtycho2.from_dataset(dataset, oversampling=1,n_modes=3)#, probe_support_radius=90)
|
||||
#model = CDTools.models.FancyPtycho.from_dataset(dataset, oversampling=1)
|
||||
|
||||
model.to(device='cuda')
|
||||
dataset.get_as(device='cuda')
|
||||
|
||||
|
||||
model.translation_offsets.requires_grad = False
|
||||
for i, loss in enumerate(model.Adam_optimize(100, dataset)):
|
||||
model.inspect(dataset)
|
||||
print(i,loss)
|
||||
|
||||
model.tidy_probes()
|
||||
|
||||
for i, loss in enumerate(model.Adam_optimize(20, dataset, lr=0.0001)):
|
||||
model.inspect(dataset)
|
||||
print(i,loss)
|
||||
|
||||
model.tidy_probes()
|
||||
model.inspect(dataset)
|
||||
|
||||
with open('example_reconstructions/unified_modes.pickle', 'wb') as f:
|
||||
pickle.dump(model.save_results(dataset),f)
|
||||
|
||||
model.compare(dataset)
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user