=================
Operations manual
=================

This manual describes the details of the **iechelle** graphical user interface and its various tabs and options.

Home Tab: Loading Data
----------------------

The **Home** tab is the starting point for configuring your data source.

.. figure:: _static/home_tab.png
   :align: center
   :width: 600

   Home Tab: Configuration and File Selection

PSD Configuration
~~~~~~~~~~~~~~~~~
- **PSD File Type**: Choose between `fits-image`, `fits-table`, `csv`, or `txt`.
- **Frequency/Power Columns**: For CSV/TXT, specify the column header name or index. For FITS tables, use the header name.
- **FITS HDU**: Specify the HDU index or name for FITS files.
- **CSV/TXT Delimiter**: Select the delimiter (Comma, Tab, Space, etc.) or use `auto`.
- **Units**: Set the **Input Units** and **Target Units**. `iechelle` automatically handles conversion.

File Selection
~~~~~~~~~~~~~~
- **Select PSD File**: Browse for your data.
- **Load PSD**: Process and display the spectrum in the preview plot.
- **Select PKB File**: Optionally load previous results.
- **Select BKG File**: Optionally load background models.

Mode Selection Tab: Interactive Analysis
----------------------------------------

The **Mode Selection** tab is where you perform interactive peak identification.

.. figure:: _static/mode_selection_tab.png
   :align: center
   :width: 800

   Mode Selection Tab: Diagram, Plots, and Tables

Echelle Diagram Controls
~~~~~~~~~~~~~~~~~~~~~~~~
- **Delta Nu ($\Delta\nu$)**: Adjust the large frequency separation to scale the diagram.
- **Freq min / Freq max**: Trim the frequency range for analysis.
- **Circle Size**: Change the size of selected peak markers.
- **Color Palette**: Choose from various Bokeh palettes to visualize power density.

Peak Identification
~~~~~~~~~~~~~~~~~~~
- **Manual Selection**: Use **Lasso** or **Box Select** tools located in the Bokeh toolbar at the top-right of the Echelle plot.

.. figure:: _static/lasso_tool.png
   :align: center
   :width: 200

   Bokeh Toolbar: The Lasso Select tool (highlighted, dashed loop icon).

- **Find Peak (Threshold)**: Use a **Threshold** value to find local maxima in your selection.
- **Get Selection**: Retrieves highlighted points into **Table 1** as candidates.

Managing and Saving Results
---------------------------

Table Operations
~~~~~~~~~~~~~~~~
- **Assign Mode**: Select rows in **Table 1**, choose a mode (0, 1, 2, 3), and click **Assign Mode**.
- **Move Tab1 -> Tab2**: Move assigned peaks to the final results list (**Table 2**).
- **Delete Row**: Remove selected rows from Table 2.

Exporting Data
~~~~~~~~~~~~~~
Click **Save Tab 2 as** to export your results:
- **.pkb**: Compatible with the *apollinaire* library.
- **.csv / .txt**: Raw data export.
