
Installation steps
==================

If you are on Linux:
--------------------

It is recommended to create a virtual environment to avoid conflicts between dependencies (https://docs.python.org/3/library/venv.html).

.. code-block:: bash

    python3 -m venv /path/to/new/virtual/environment

    source /path/to/new/virtual/environment/bin/activate

*Note: To deactivate the environment call:* :code:`deactivate`

Then, you can install darfix with all its dependencies:

.. code-block:: bash

    pip install darfix[full]

To install darfix with a minimal set of dependencies run instead:

.. code-block:: bash

    pip install darfix

Start the GUI and make sure darfix appears as an add-on:

.. code-block:: bash

	orange-canvas


If you are on Windows:
----------------------

The easiest way is to install Miniconda: https://docs.conda.io/en/latest/miniconda.html

From the command line, create a new conda environment

.. code-block:: bash

    conda config --add channels conda-forge

    conda create --name darfix python=3.9

Install darfix (no conda package exists yet):

.. code-block:: bash

    conda activate darfix

    conda install orange3 silx scikit-image opencv

    pip install darfix[full]

Start the GUI and make sure darfix appears as an add-on:

.. code-block:: bash

    conda activate darfix

    orange-canvas


To install from sources:
------------------------

.. code-block:: bash

    git clone https://gitlab.esrf.fr/XRD/darfix.git
    cd darfix
    pip install .

Or with all its dependencies:

.. code-block:: bash

    pip install .[full]

To test the orange workflow (only from sources) just run

.. code-block:: bash

    orange-canvas src/orangecontrib/darfix/tutorials/darfix_example2.ows

To test a workflow execution without the canvas (only from sources) just run

.. code-block:: bash

    darfix -wf src/orangecontrib/darfix/tutorials/darfix_example2.ows -fd orangecontrib/darfix/tutorials/ -td /tmp/darfix


Dependencies
------------

.. _dependencies:

The mandatory dependencies are:

- `numpy <http://www.numpy.org/>`_
- `silx <https://github.com/silx-kit/silx>`_

The GUI widgets depend on the following extra packages:

* `PyQt5 <https://riverbankcomputing.com/software/pyqt/intro>`_
* `matplotlib <http://matplotlib.org/>`_
* `orange3 <https://orangedatamining.com/>`_

Some of the image processing techniques depend on:

* `opencv <https://docs.opencv.org/4.x/>`_
* `scikit-image <https://scikit-image.org/>`_

Tools for reading and writing files depend on the following packages:

* `h5py <http://docs.h5py.org/en/latest/build.html>`_ for HDF5 files

Package for using batch processing:

- `ewoksorange <https://gitlab.esrf.fr/workflow/ewoks/ewoksorange>`_