mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-09-09 13:02:41 +02:00
add the test for simple_ptycho_model'
This commit is contained in:
@@ -13,7 +13,7 @@ It is recommended that you clone the repository, rather than just downloading th
|
||||
Step 2: Install Dependencies
|
||||
----------------------------
|
||||
|
||||
The dependencies for CDTools can be installed, if you are managing your environment with anaconda, by running
|
||||
The dependencies for CDTools can be installed, if you are managing your environment with anaconda, by running the following command in the top level directory of the package:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
|
||||
@@ -105,3 +105,23 @@ class SimplePtycho(CDIModel):
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
from basic_ptycho_dataset import BasicPtychoDataset
|
||||
from h5py import File
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
filename = 'example_data/lab_ptycho_data.cxi'
|
||||
with File(filename, 'r') as f:
|
||||
dataset = BasicPtychoDataset.from_cxi(f)
|
||||
|
||||
|
||||
model = SimplePtycho.from_dataset(dataset)
|
||||
|
||||
#model.to(device='cuda')
|
||||
#dataset.get_as(device='cuda')
|
||||
|
||||
for i, loss in enumerate(model.Adam_optimize(100, dataset)):
|
||||
model.inspect(dataset)
|
||||
print(i,loss)
|
||||
|
||||
model.compare(dataset)
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user