==========
User Guide
==========


Anaconda Fusion is a side pane interface that works inside Excel. Fusion lets users select the models and functions available through namespaces that we call `codesheets` (or `notebooks`, since they match notebooks generated in Jupyter notebooks). 

Fusion also lets users define datasets and variables from the Excel spreadsheet to be used as inputs for the functions and models to run.

.. figure:: /img/fusion-starting-screen.png


Load a notebook
---------------

To load a notebook to run, from the top navigation bar, click Codesheets. From the list that appears, select the codesheet that you would like to load, for example, `clustering.ipynb`:

.. figure:: /img/fusion_select_notebook.png

NOTE: Anaconda Fusion includes default examples of `codesheets` that come with the installation, but you can also add custom codesheets. For more information, see :ref:`fusion_upload_notebooks` below.

After you have selected a `codesheet` Fusion loads a view of that codesheet that will show all the functions available in that codesheet, as well as the variables to input for each of those functions:

.. figure:: /img/fusion_clustering_params.png


.. _fusion_access_excel_data:

Access data from Excel
----------------------

Fusion makes it easy to access data though either the top menu or by entering the Excel data `address` directly. 

* Access data from the top menu `data` where you can define datasets to be used and referenced anytime during function executions (like Excel `named ranges`):

    .. figure:: /img/fusion_data_inputs.png

    There are four ways to define data to input to Anaconda Fusion:
        - 1. Selection: Use the current selected cell or cells as the input
        - 2. Range or Cell: Define an Excel range or cell as the input
        - 3. Named Range: Use an already defined Excel variable as the input
        - 4. Python: Use a Python expression to use as the input.

    Click your desired input mechanism, for example "Range or Cell". Then fill the fields with the desired name for the input and the Excel range address:

    .. figure:: /img/fusion_range_input.png

    You can also view all the data that you have defined by clicking 'See All':

    .. figure:: /img/fusion_data_list.png

    By clicking a data input, you can also view the current values:

    .. figure:: /img/fusion_view_data.png

* Access data by entering the Excel data `address` directly in the function's input selection boxes as shown in this example:
    
.. figure:: /img/fusion_direct_input.png


Access the model documentation
------------------------------

Authors of models can write documentation to help users understand what these models do and how to specify the input parameters to better configure them.

If the author has provided it, users can access this help documentation through the process execution UI by clicking in the `i` information icon in the right side of the model select box:

.. figure:: /img/fusion_view_documentation.png

NOTE: The automatic UI generation is a very powerful feature of Anaconda Fusion to let Excel users consume high level functions created inside `codesheets` or `notebooks`. This feature represents a huge step forward lowering the barrier for Excel users to use advanced functions written in languages, like Python, that otherwise would have been accessible only by writing code.

See the :doc:`developer-guide` for more information about authoring.

Run a model with Anaconda Fusion
--------------------------------

After selecting a model or function, Anaconda Fusion shows all the parameters that users will need to input to be able to execute such functions, as shown in the figure immediately above.

The function parameter select boxes display the available data to be used for a specific parameter. That's why, for instance, some parameters may list all the data defined from Excel spreadsheets, while others may list numbers or a specific set of strings specified by the author of the function. 

You can see how this works by opening the sample ``clustering`` codesheet that is installed by default with Fusion, and looking at the ``clustering`` function. The **`data`** argument of this function lists all the data declared from the Excel `spreadsheet`, the **`algorithm`** displays a list of possible algorithm names that can be used and the **`n_clusters`** argument lists numbers that can be used to define the number of clusters to find.

After all the input parameters have been filled, you can execute the model by clicking on the "RUN" button. After it finishes running, the output is loaded into the Excel spreadsheet or in the Fusion output area, if it's a plot or image or has been configured otherwise. 

SEE More information about how to specify custom output actions below in :ref:`fusion_customize_execution_outputs`.

In the following paragraphs we'll go more into the details of the using the Anaconda Fusion process execution UI.


Configure your run
------------------

There are two run configuration options in the main Anaconda Fusion screen:

    - **Sync-On:** Sync-On automatically uses new values in the defined input data from Microsoft Excel to update the output.
    - **Auto run:** When changing input parameters, Anaconda Fusion will auto run with the new changes without the need to click Run every time.

.. figure:: /img/fusion_run_options.png


.. _fusion_customize_execution_outputs:

Customize execution outputs
---------------------------

You can configure the default output mechanism back to Excel, as well as export the output once to a defined Excel location.

- **Options:** Define the default output option when user clicks Run.
- **Export:** Define setting for a one time export mechanism. Click Export to export the data.

.. figure:: /img/fusion_export.png

The output options are the same as the input ones described above in :ref:`fusion_access_excel_data`.


.. _fusion_upload_notebooks:

Upload a notebook to Anaconda Fusion
------------------------------------

If someone has shared a notebook with you that you want to upload to Anaconda Fusion, simply select the '+' button in the lower left corner, or select 'Codesheets' and click 'Add new notebook':

The Jupyter notebook interface starts.

.. figure:: /img/fusion_jupyter.png

Click 'Upload', browse your folders to find the notebook you'd like to upload to Anaconda Fusion, and click 'Upload':

.. figure:: /img/fusion_jupyter_upload.png

You can now see the uploaded notebook in the list of Codesheets in Anaconda Fusion.
