## English

### **User Manual - Radar Data Reader & Processor**

#### **1. Introduction**

This manual provides a comprehensive guide to using the Radar Data Reader & Processor application. The application is designed to orchestrate an entire radar data analysis workflow, from raw recordings to final data extraction, by solving three main problems:
1.  **Flight Analysis**: Analyze an entire recorded flight session (`.rec` files) to automatically identify and summarize significant operational segments.
2.  **Data Export and Processing**: Extract specific data from the generated flight segments (`.out` files) into standard formats (CSV, JSON) using fully customizable export profiles.
3.  **Manual Conversion**: Provide a controlled interface for the `g_reconvert.exe` command-line utility for manual or specific conversions.

#### **2. System Requirements**

*   A Python 3 environment.
*   Required Python libraries (e.g., `pandas`, `numpy`).
*   The **`g_reconvert.exe`** executable must be accessible on the system. The application is a wrapper and depends on this file for its core functionalities.

#### **3. Initial Setup**

On first launch, the application creates a `config/config.json` file in its directory. It is **critical** to configure the application correctly before use.

1.  Start the application.
2.  Navigate to the **"4. REC to OUT Converter"** tab.
3.  Click the **"g_reconverter Advanced Config..."** button.
4.  In the new window, the first field is **"Executable Path"**. Click **"Browse..."** and select the exact location of your `g_reconvert.exe` file.
5.  Click **"Save & Close"**.

Without this step, none of the features that rely on `g_reconvert.exe` (Flight Analysis, Conversion) will work.

#### **4. Interface Guide**

The main interface has been reorganized to follow a logical workflow through its tabs:

1.  **`1. Flight Analyzer`**: The starting point. Analyzes an entire flight folder, summarizes segments, and allows you to export the raw data of the segments of interest.
2.  **`2. Segment Processor`**: The second step. Batch-processes the `.out` files of segments exported from the first tab to extract data into CSV/JSON.
3.  **`3. Single OUT Processor`**: For detailed analysis of a single, arbitrary `.out` file.
4.  **`4. REC to OUT Converter`**: For manual conversions from `.rec` to `.out`.

The window also includes a **Log Console** for real-time messages and a **Status Bar** to indicate the current state.

---

### **Main Workflow**

#### **5. Step 1: Flight Analysis and Segment Export (Tab "Flight Analyzer")**

This is the primary feature to begin an analysis.

1.  **Select Flight Folder**: Click **"Browse..."** next to "Recordings Folder" and select the folder containing the complete sequence of `.rec` files for the flight.
2.  **Name the Flight**: Enter an identifying name for the flight in the "Flight Name" field. This name will be used to create a dedicated workspace folder.
3.  **Start Analysis**: Click **"Start Flight Analysis"**. The application will run `g_reconvert.exe` in the background to analyze all files. This process may take some time.
4.  **View Results**: Upon completion, the "Flight Summary & Segments" table will be populated with a summary of all operational segments found, showing modes, durations, and file references.
5.  **Export Segments**: Select one or more segments from the table and click **"Export Selected Segment(s)"**. The application will create a subfolder for each selected segment within the flight's workspace folder, containing an `.out` file and other ancillary files (video, GPS, etc.).

#### **6. Step 2: Batch Processing of Segments (Tab "Segment Processor")**

After exporting segments, this tab allows you to extract data from all of them in a single operation.

1.  **Load Segments**: Click **"Load Exported Segments from Current Flight"**. The table will be populated with the previously exported segments. A "Ready" status indicates the segment is ready for processing.
2.  **Select Segments**: Select the segments you wish to process. You can use the "Select All Ready" and "Select None" buttons to speed up selection.
3.  **Configure Output**:
    *   **Output Directory**: Choose the final destination folder for your CSV and JSON files.
    *   **Formats and Profiles**: Enable CSV and/or JSON export by checking the respective boxes and select an **Export Profile** for each.
    *   **Additional Options**: Configure options such as creating separate folders for each analysis or the CSV format.
4.  **Start Processing**: Click **"Process Selected Segments"**. The application will analyze each selected `.out` file and create the corresponding data files in the output directory. The progress bar will show the current status.

---

### **Additional Features**

#### **7. Single `.out` File Analysis (Tab "Single OUT Processor")**

This tab is useful for analyzing an isolated `.out` file, not necessarily tied to a full flight analysis.

1.  **Select Input File**: Click **"Browse..."** and select the `.out` file to analyze.
2.  **Configure Output**: Set the output directory, base filename, and export profiles.
3.  **Start Processing**: Click **"Process .out File"**. Data will be extracted according to the chosen profile.

#### **8. Advanced Management: The Export Profile Editor**

To access the editor, go to `File -> Manage Export Profiles...`.

*   **Left Pane (Profiles)**: Manage profiles (create, delete, select).
*   **Middle Pane (Available Fields)**: Displays a tree of all extractable data fields. Fields marked with `(Enum)` can be translated into human-readable formats. Select a field and use **`>>`** to add it.
*   **Right Pane (Selected Fields for Profile)**: Shows the fields for the current profile. Use **`<<`** to remove them and **Up/Down** to reorder.
*   **"Translate" Column**: Click the cell in this column to toggle the translation of a value from numeric to text (e.g., from `15` to `STT_MASTER_MODE`).

#### **9. Manual `.rec` -> `.out` Conversion (Tab "REC to OUT Converter")**

This tab offers direct control over `g_reconvert.exe` for simple conversions.

1.  **Select Input**: Choose the first `.rec` file and the number of files to concatenate.
2.  **Choose Output**: Define the destination folder.
3.  **Start Conversion**: Click **"Convert REC to OUT"**.

#### **10. Frequently Asked Questions (FAQ)**

*   **Q: Why do none of the features work?**
    *   **A**: Ensure you have correctly set the path to `g_reconvert.exe` as described in the "Initial Setup" section.

*   **Q: Why does a segment in the "Segment Processor" tab appear gray and unselectable?**
    *   **A**: This means the segment has not yet been exported (or the export failed). Go back to the "Flight Analyzer" tab, select that segment, and click "Export Selected Segment(s)".

*   **Q: How can I add a field that I don't see in the "Available Fields" tree?**
    *   **A**: This requires a source code modification. You will need to define the new data structure in the `radar_data_reader/core/structures` package and update the parsing logic in `radar_data_reader/core/struct_parser.py`.
