Tools for coherent diffractive imaging and ptychography
Project description
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()
Further documentation is found here.
Instructions for building custom documentation based on a specific version or commit can be found here.
Installation
CDTools can be installed in several ways depending on your needs. For most users, installation from pypi is recommended. For developers or those who want the latest features, installation from source is available.
Installation from pypi
CDTools can be installed via pip as the cdtools-py package on PyPI:
$ pip install cdtools-py
or using uv:
$ uv pip install cdtools-py
Installation from Source
For development or to access the latest features, CDTools can be installed directly from source:
$ git clone https://github.com/cdtools-developers/cdtools.git
$ cd cdtools
$ pip install -e .
or using uv:
$ git clone https://github.com/cdtools-developers/cdtools.git
$ cd cdtools
$ uv pip install -e .
Installing for Contributors (with tests and docs dependencies)
If you want to run the test suite or build the documentation, install with the extra dependencies:
$ pip install -e ."[tests,docs]"
or with uv:
$ uv pip install -e ."[tests,docs]"
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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cdtools_py-0.3.1.tar.gz.
File metadata
- Download URL: cdtools_py-0.3.1.tar.gz
- Upload date:
- Size: 130.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
672de1d367167fe3a84a200a7a39173d3d155bd610a72676d0add5c8490662b7
|
|
| MD5 |
ca4d3f0eeb2368d10c27ca77955d98e1
|
|
| BLAKE2b-256 |
8e6cd064f14a8d0cfa9f918b0d6553e4403333b8971a82aca12f6ad14e7ad32e
|
Provenance
The following attestation bundles were made for cdtools_py-0.3.1.tar.gz:
Publisher:
publish.yml on cdtools-developers/cdtools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cdtools_py-0.3.1.tar.gz -
Subject digest:
672de1d367167fe3a84a200a7a39173d3d155bd610a72676d0add5c8490662b7 - Sigstore transparency entry: 1226665993
- Sigstore integration time:
-
Permalink:
cdtools-developers/cdtools@d7d5ed8401267964e49b596576c7b1e88c78cb51 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/cdtools-developers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d7d5ed8401267964e49b596576c7b1e88c78cb51 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cdtools_py-0.3.1-py3-none-any.whl.
File metadata
- Download URL: cdtools_py-0.3.1-py3-none-any.whl
- Upload date:
- Size: 143.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05e8b5eead5e190d4078ec525e28f9e2d6ba6a7c27fc988af4857840e27532a9
|
|
| MD5 |
e0f16a46cdf74424f06f2052c5293dcd
|
|
| BLAKE2b-256 |
d41748f6a3f62d9cb8e478ac4e3ddbb31c2fcc5c2eb575fe32ea833575d2ba7f
|
Provenance
The following attestation bundles were made for cdtools_py-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on cdtools-developers/cdtools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cdtools_py-0.3.1-py3-none-any.whl -
Subject digest:
05e8b5eead5e190d4078ec525e28f9e2d6ba6a7c27fc988af4857840e27532a9 - Sigstore transparency entry: 1226666022
- Sigstore integration time:
-
Permalink:
cdtools-developers/cdtools@d7d5ed8401267964e49b596576c7b1e88c78cb51 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/cdtools-developers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d7d5ed8401267964e49b596576c7b1e88c78cb51 -
Trigger Event:
release
-
Statement type: