mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-09-19 00:52:09 +02:00
39 lines
1020 B
Python
39 lines
1020 B
Python
import cdtools
|
|
from matplotlib import pyplot as plt
|
|
from scipy import io
|
|
|
|
#
|
|
# This is the testing dataset for the Bragg ptychography code, that was
|
|
# collected with our optical setup using a low NA zone plate illuminating
|
|
# a reflective diffraction grating with writing on it.
|
|
#
|
|
|
|
# This file is too large to be distributed via Github.
|
|
# Please contact Abe Levitan (alevitan@mit) if you would like access
|
|
filename = 'example_data/Zone Plate Bragg 633.cxi'
|
|
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename)
|
|
|
|
#dataset.inspect()
|
|
|
|
model = cdtools.models.Bragg2DPtycho.from_dataset(
|
|
dataset,
|
|
probe_support_radius=60,
|
|
correct_tilt=False,
|
|
units='mm',
|
|
)
|
|
|
|
#model.to(device='cuda')
|
|
#dataset.get_as(device='cuda')
|
|
|
|
|
|
model.translation_offsets.requires_grad = False
|
|
for loss in model.Adam_optimize(100, dataset):
|
|
model.inspect(dataset)
|
|
print(model.report())
|
|
|
|
#io.savemat('example_reconstructions/lab_bragg_2d_ptycho.mat',
|
|
# model.save_results(dataset))
|
|
|
|
model.compare(dataset)
|
|
plt.show()
|