# VIPR Reflectorch Examples

This directory contains example configuration files for the VIPR Reflectorch plugin.
The example datasets used by Reflectorch and other reflectometry submodules live in the
shared package-level directory `vipr_reflectometry/examples/data/`.

## Directory Structure

```text
vipr_reflectometry/
├── examples/
│   └── data/                  # Shared reflectometry example datasets
├── reflectorch/
│   └── examples/
│       ├── configs/           # Reflectorch example configurations
│       └── README.md
```

## Quick Start

### 1. Set Up Environment Variables

Before running predictions, set the required environment variables:

```bash
export REFLECTOMETRY_ROOT_DIR=${PWD}/storage/reflectometry
export VIPR_RESULTS_DIR=${PWD}/storage/results
export HF_HOME=${PWD}/storage/huggingface_cache
```

### 2. Run Example Predictions

**X-ray Reflectometry (PTCDI-C3):**
```bash
vipr --config @vipr_reflectometry/reflectorch/examples/configs/PTCDI-C3.yaml inference run
```

**Neutron Reflectometry (Ni on glass):**
```bash
vipr --config @vipr_reflectometry/reflectorch/examples/configs/Ni_on_glass.yaml inference run
```

**Other Examples:**
```bash
vipr --config @vipr_reflectometry/reflectorch/examples/configs/Ni500.yaml inference run
vipr --config @vipr_reflectometry/reflectorch/examples/configs/D17_SiO.yaml inference run
vipr --config @vipr_reflectometry/reflectorch/examples/configs/ORSO.yaml inference run
```

## Path Resolution in Configurations

The plugin supports multiple path formats for data files:

### Package Resources (Recommended for Installed Plugins)
```yaml
data_path: '@vipr_reflectometry/examples/data/PTCDI-C3.txt'
```
- Uses `@` prefix to indicate installed package resource
- Works after `pip install -e .` or `pip install vipr-reflectorch`
- Portable across different installations

### Relative Paths (Development)
```yaml
data_path: './my-data/PTCDI-C3.txt'
```
- Relative to the current working directory
- Useful for local experiments with your own measurement files
- Prefer `@vipr_reflectometry/examples/data/...` for packaged example datasets

### Absolute Paths
```yaml
data_path: '/full/path/to/data/PTCDI-C3.txt'
```
- Full file system path

## Storage Directory

Model storage and result output are controlled by the configured environment variables.
Typical locations are:

- `REFLECTOMETRY_ROOT_DIR`: downloaded model configurations and weights
- `VIPR_RESULTS_DIR`: inference results and visualizations
- `HF_HOME`: Hugging Face cache
