diff --git a/README.md b/README.md index 8381ff1..2796c5b 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,10 @@ for loss in model.Adam_optimize(10, dataset): print(model.report()) # Save the results -model.save_to_h5('ptycho_results.h5', dataset) +model.save_to_h5('ptycho_results.h5') # And look at them! -model.inspect(dataset) # See the reconstructed object, probe, etc. +model.inspect() # See the reconstructed object, probe, etc. model.compare(dataset) # See how the simulated and measured patterns compare plt.show() ``` diff --git a/docs/source/examples.rst b/docs/source/examples.rst index 4c101c9..29bd02e 100644 --- a/docs/source/examples.rst +++ b/docs/source/examples.rst @@ -31,7 +31,7 @@ When reading this script, note the basic workflow. After the data is loaded, a m Next, the model is moved to the GPU using the :code:`model.to` function. Any device understood by :code:`torch.Tensor.to` can be specified here. The next line is a bit more subtle - the dataset is told to move patterns to the GPU before passing them to the model using the :code:`dataset.get_as` function. This function does not move the stored patterns to the GPU. If there is sufficient GPU memory, the patterns can also be pre-moved to the GPU using :code:`dataset.to`, but the speedup is empirically quite small. -Once the device is selected, a reconstruction is run using :code:`model.Adam_optimize`. This is a generator function which will yield at the end of every epoch, to allow some monitoring code to be run. Inside the loop, :code:`model.inspect(dataset)` is called every epoch to live-update a set of plots showing the current state of the model parameters. +Once the device is selected, a reconstruction is run using :code:`model.Adam_optimize`. This is a generator function which will yield at the end of every epoch, to allow some monitoring code to be run. Inside the loop, :code:`model.inspect()` is called every epoch to live-update a set of plots showing the current state of the model parameters. Finally, :code:`model.compare(dataset)` is called to show how the simulated diffraction patterns compare to the measured diffraction patterns in the dataset. @@ -69,7 +69,7 @@ We use this pattern, instead of the simpler call to :code:`model.Adam_optimize() In this case, we used one reconstructor, but it is possible to create additional reconstructors to zero out all the persistant information in the optimizer, if desired, or even to instantiate multiple reconstructors on the same model with different optimization algorithms (e.g. :code:`model.LBFGS_optimize()`). -Note also the use of :code:`min_interval=10` in the calls to :code:`model.inspect(dataset)`. Because generating plots can be expensive, passing a minimum interval (in seconds) prevents excessive replots. Finally, the call to :code:`model.inspect(dataset, replot_all=True)` at the end of the script reopens any plot windows that the user may have closed during the reconstruction, so that all results are visible at the end. +Note also the use of :code:`min_interval=10` in the calls to :code:`model.inspect()`. Because generating plots can be expensive, passing a minimum interval (in seconds) prevents excessive replots. Finally, the call to :code:`model.inspect(replot_all=True)` at the end of the script reopens any plot windows that the user may have closed during the reconstruction, so that all results are visible at the end. Gold Ball Ptycho diff --git a/docs/source/intro.rst b/docs/source/intro.rst index 22bc2c1..78d9f41 100644 --- a/docs/source/intro.rst +++ b/docs/source/intro.rst @@ -29,10 +29,10 @@ CDTools is an open source python library for ptychography and CDI reconstruction print(model.report()) # Save the results - model.save_to_h5('ptycho_results.h5', dataset) + model.save_to_h5('ptycho_results.h5') # And look at them! - model.inspect(dataset) # See the reconstructed object, probe, etc. + model.inspect() # See the reconstructed object, probe, etc. model.compare(dataset) # See how the simulated and measured patterns compare plt.show() diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 0a7e6b4..b13d72c 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -501,10 +501,10 @@ We can test this model with a simple script, in examples/tutorial_finale.py. By dataset.get_as(device='mps')#cuda') for loss in model.Adam_optimize(10, dataset): - model.inspect(dataset) + model.inspect() print(model.report()) - model.inspect(dataset) + model.inspect() model.compare(dataset) plt.show()