Metadata-Version: 2.1
Name: ptychodus
Version: 0.2.2
Summary: Ptychography Analysis Front-End
Home-page: https://github.com/AdvancedPhotonSource/ptychodus
Download-URL: https://github.com/AdvancedPhotonSource/ptychodus.git
License: BSD 3-Clause License
Requires-Python: >=3.9
License-File: LICENSE
Requires-Dist: h5py (==3.*)
Requires-Dist: matplotlib (==3.*)
Requires-Dist: numpy (==1.*)
Requires-Dist: scipy (==1.*)
Requires-Dist: tifffile (==2022.*)
Requires-Dist: watchdog (==2.*)
Provides-Extra: gui
Requires-Dist: pyqt5 (==5.*) ; extra == 'gui'
Provides-Extra: tike
Requires-Dist: tike (==0.22.*) ; extra == 'tike'

Ptychodus
=========

`ptychodus`_ is a ptychography analysis front-end that supports multiple reconstruction back-ends. Current reconstructor status:

* `tike`_ is working
* `ptychopy`_ is under development
* `PtychoNN`_ is under development

Standard Installation
---------------------

1. Install `miniconda <https://docs.conda.io/en/latest/miniconda.html>`_.

2. Install ptychodus.

   * To install `ptychodus` with the GUI and no optional packages:

     .. code-block:: shell

           $ conda create -c conda-forge -n ptychodus ptychodus

   * To install `ptychodus` with the GUI and all optional packages:

     .. code-block:: shell

           $ conda create -c conda-forge -n ptychodus ptychodus-all

   * To install `ptychodus` without the GUI or optional packages:

     .. code-block:: shell

           $ conda create -c conda-forge -n ptychodus ptychodus-core

3. Activate the `ptychodus` conda environment to run ptychodus.

   .. code-block:: shell

       $ conda activate ptychodus
       $ ptychodus -h
       usage: ptychodus [-h] [-b] [-d] [-f PREFIX] [-p PORT] [-s SETTINGS] [-v]

       ptychodus is a ptychography analysis front-end

       optional arguments:
         -h, --help            show this help message and exit
         -b, --batch           run reconstruction non-interactively
         -d, --dev             run in developer mode
         -f PREFIX, --file-prefix PREFIX
                               replace file path prefix
         -p PORT, --port PORT  remote process communication port number
         -s SETTINGS, --settings SETTINGS
                               use settings from file
         -v, --version         show program's version number and exit
       $ ptychodus


Developer Installation
----------------------

* For a developer installation:

.. code-block:: shell

   $ git clone https://github.com/AdvancedPhotonSource/ptychodus.git
   $ conda create -c conda-forge -n ptychodus --file ptychodus/requirements-dev.txt
   $ conda activate ptychodus
   $ pip install -e ./ptychodus

* To install the `tike` backend:

.. code-block:: shell

   $ conda install -n ptychodus -c conda-forge tike

* To install the `PtychoNN` backend:

.. code-block:: shell

   $ conda install -n ptychodus -c conda-forge pytorch

* To launch the `ptychodus` GUI (with the "ptychodus" conda environment activated):

.. code-block:: shell

   $ ptychodus

Tips
----

* This project is experimenting with `type hints <https://docs.python.org/3/library/typing.html>`_ which can be checked using `mypy <http://mypy-lang.org>`_.

.. code-block:: shell

  $ mypy ptychodus

* Stubs to support PyQt5 type hinting can be installed within the conda environment.

.. code-block:: shell

   $ pip install PyQt5-stubs

Basic RPC Demonstration
-----------------------

* Generate a batch mode reconstruction result file (named `results.npz` in this example)

.. code-block:: shell

   $ ptychodus -b -s /path/to/settings.ini

* Launch the GUI in one terminal and navigate to the "Monitor" view

.. code-block:: shell

   $ ptychodus -p 9999

* Send a RPC message (JSON format) to instruct the GUI to display the reconstruction result

.. code-block:: shell

   $ ptychodus-rpc -p 9999 -m '{"procedure": "LoadResults", "filePath": "/path/to/results.npz"}'

Reporting bugs
--------------

Open a bug at https://github.com/AdvancedPhotonSource/ptychodus/issues.

.. _`ptychodus`: https://github.com/AdvancedPhotonSource/ptychodus
.. _`tike`: https://github.com/tomography/tike
.. _`ptychopy`: https://github.com/AdvancedPhotonSource/ptychopy
.. _`PtychoNN`: https://github.com/mcherukara/PtychoNN

Copyright (c) UChicago Argonne, LLC. All rights reserved.

Copyright UChicago Argonne, LLC. This software was produced
under U.S. Government contract DE-AC02-06CH11357 for Argonne National
Laboratory (ANL), which is operated by UChicago Argonne, LLC for the
U.S. Department of Energy. The U.S. Government has rights to use,
reproduce, and distribute this software.  NEITHER THE GOVERNMENT NOR
UChicago Argonne, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR
ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.  If software is
modified to produce derivative works, such modified software should
be clearly marked, so as not to confuse it with the version available
from ANL.

Additionally, redistribution and use in source and binary forms, with
or without modification, are permitted provided that the following
conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in
      the documentation and/or other materials provided with the
      distribution.

    * Neither the name of UChicago Argonne, LLC, Argonne National
      Laboratory, ANL, the U.S. Government, nor the names of its
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY UChicago Argonne, LLC AND CONTRIBUTORS
AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UChicago
Argonne, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
