# VIPR AI Framework - User Guide

## Overview
VIPR is a flexible AI framework for inference that combines a Nuxt.js frontend with a FastAPI backend and Cement CLI Python project. The framework currently has reflectorch implemented as an example for reflectometry data analysis using neural networks.

**Access URL**: https://531-review-vipr-3-0-vgoe37.k8s.hw.ag/

## Interface Layout

The VIPR interface consists of two main sections:
- **Left Panel**: Processing pipeline steps configuration (Load Data → Load Model → Normalize → Preprocess → Predict → Postprocess)
- **Right Panel**: Results visualization (reflectivity curves, SLD profiles, parameters)

## Quick Start: Using Predefined Configurations

### Step 1: Load Example Configurations
![Screenshot 5](screenshot_2.png)

Click the **"LOAD EXAMPLES"** button in the top header to access predefined configurations.

### Step 2: Select Configuration
![Screenshot 4](screenshot_3.png)

A modal dialog will appear with available example configurations:
- **data_PTCDI-C3_XRR_2025-06-12T11-23-25-881Z.json**: X-ray reflectometry data
- **Ni500_NR_2025-06-12T11-30-19-178Z.json**: Nickel neutron reflectometry
- **Ni_on_Glass_NR_2025-06-12T11-41-04-080Z.json**: Nickel on glass neutron reflectometry

Select one of the configurations by clicking on it.

### Step 3: Configuration Import Confirmation
![Screenshot 3](screenshot_4.png)

After selecting a configuration, you will see an **"Import successful"** notification in the bottom right corner. The pipeline steps will be automatically configured with the selected example settings.

### Step 4: Run Prediction
![Screenshot 2](screenshot_5.png)

The results panel will show **"No results yet. Configure your settings and click 'Predict' to see the results here."** Click the **"RUN PREDICTION"** button to start the inference process.

### Step 5: View Results
![Screenshot 1](screenshot_6.png)

After the prediction completes, results will be displayed in the right panel:
- **Reflectivity Curves**: Graph showing experimental data (blue line), predicted values (orange dashed line), and polished results
- **Model Parameters Table**: Shows predicted and polished values for:
  - Layer thicknesses (L2, L1)
  - Surface roughnesses (L2, L1, substrate)
  - Scattering length densities (SLD L2)

## Additional Features

### Live Prediction
Toggle **"Live Prediction"** to automatically update results when configuration parameters change.

### Manual Configuration
Each pipeline step can be manually configured by clicking the **"EDIT CONFIGURATION"** button next to any step in the left panel.

### Save/Load Custom Configurations
Use the **"SAVE"** and **"LOAD"** buttons in the header to export or import your own configuration files.

## Pipeline Steps Overview

1. **Load Data**: Specifies the experimental data file (reflectometry measurements)
2. **Load Model**: Selects the neural network model for analysis (e.g., reflectorch)
3. **Normalize**: Optional data normalization step
4. **Preprocess**: Data preprocessing (e.g., interpolation)
5. **Predict**: Main inference step with parameter prediction
6. **Postprocess**: Post-processing of results

