Dayne Yoshiki Sasaki da695c7c06 Merge pull request #29 from cdtools-developers/center_probe_real_space
Change the behavior of FancyPtycho.center_probes to always center the probe in real space
2025-06-09 19:17:10 -07:00
2025-04-01 10:45:07 -07:00
2025-04-01 10:43:54 -07:00

CDTools

CDTools is a python library for ptychography and CDI reconstructions, using an Automatic Differentiation based approach.

from matplotlib import pyplot as plt
from cdtools.datasets import Ptycho2DDataset
from cdtools.models import FancyPtycho

# Load a data file
dataset = Ptycho2DDataset.from_cxi('ptycho_data.cxi')

# Initialize a model from the data
model = FancyPtycho.from_dataset(dataset)

# Run a reconstruction
for loss in model.Adam_optimize(10, dataset):
    print(model.report())

# Save the results
model.save_to_h5('ptycho_results.h5', dataset)

# And look at them!
model.inspect(dataset) # See the reconstructed object, probe, etc.
model.compare(dataset) # See how the simulated and measured patterns compare
plt.show()

Full installation instructions and documentation can be found here.

CDTools was developed in the photon scattering lab at MIT, and further development took place within the computational x-ray imaging group at PSI. The code is distributed under an MIT (a.k.a. Expat) license. If you would like to publish any work that uses CDTools, please contact Abe Levitan.

Have a wonderful day!

S
Description
No description provided
Readme Cite this repository
258 MiB
Languages
Python 100%