mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-11-16 19:10:04 +01:00
Update README to account for presence of docs
This commit is contained in:
1 parent
5b521da557
commit
0377ea90be
1 file changed
+19
-30
@@ -1,40 +1,29 @@
|
||||
# CDTools
|
||||
|
||||
Outline:
|
||||
CDTools is a python library for ptychography and CDI reconstructions, using an Automatic Differentiation based approach.
|
||||
|
||||
Description of toolbox
|
||||
```python
|
||||
# imports
|
||||
from matplotlib import pyplot as plt
|
||||
from CDTools.datasets import Ptycho_2D_Dataset
|
||||
from CDTools.models import SimplePtycho
|
||||
|
||||
Note about authors and availability
|
||||
# Load the file
|
||||
dataset = Ptycho_2D_Dataset.from_cxi('ptycho_data.cxi')
|
||||
|
||||
Example usage
|
||||
# Generate a model from the data
|
||||
model = SimplePtycho.from_dataset(dataset)
|
||||
|
||||
Available methods
|
||||
# Run a reconstruction
|
||||
for i, loss in enumerate(model.Adam_optimize(10, dataset)):
|
||||
print(i, loss)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Installation can be done via pip. The only hiccup is that pytorch needs to be compiled with either MKL support (if you intend to do processing on the CPU), or with CUDA support (if you intend to do GPU processing).
|
||||
|
||||
For this reason, we recommend using Anaconda python as it handles both cases fairly seamlessly. When using Anaconda python, it is still important to manually install pytorch before installing CDTools, because the pip installer will find and install the wrong version of pytorch (which is listed on pypi).
|
||||
|
||||
Therefore, a simple install process can proceed as follows. First, clone the Git repository and navigate to the top-level folder. Then, run:
|
||||
|
||||
```console
|
||||
$ conda install Pytorch -c Pytorch
|
||||
$ pip install -e .
|
||||
# And look at the results!
|
||||
model.inspect(dataset)
|
||||
model.compare(dataset)
|
||||
plt.show()
|
||||
```
|
||||
|
||||
We recommend installing the package in developer mode as above, because the package is under active development. We also suggest installing it into it's own virtual environment as general good practice. Finally, if you would like to integrate it into a larger environment, it is a good idea to install the dependencies via conda before installing the package itself via pip.
|
||||
Full installation instructions and documentation can be found [here](https://github.mit.edu/pages/Scattering/CDTools/)
|
||||
|
||||
If you manage your python installation a different way, the various dependencies that need to be installed are listed in the setup.py file.
|
||||
|
||||
|
||||
## Running the tests
|
||||
|
||||
It is a good idea to run the tests after installation to ensure that everything is working, and from time to time as things change on your computer. You can run the tests by installing pytorch, and then running
|
||||
|
||||
```console
|
||||
$ pytest
|
||||
```
|
||||
|
||||
In the top-level directory
|
||||
Have a wonderful day!
|
||||
Reference in new issue
Block a user