# VIPR Reflectometry Plugin - Getting Started

## Documentation

## Minimum Requirements

Python 3.10

## Installation

```bash
pip install git+https://codebase.helmholtz.cloud/vipr/vipr-core.git
pip install git+https://codebase.helmholtz.cloud/vipr/vipr-reflectometry-plugin.git
```

### Local Development

For local development, install from source:

```bash
cd vipr-reflectometry-plugin
pip install -e .

# Optional: Install with PANPE support
pip install -e .[plugin-panpe]
```

Or install directly from Git with PANPE:

```bash
pip install "git+https://codebase.helmholtz.cloud/vipr/vipr-reflectometry-plugin.git[plugin-panpe]"
```

## Examples

### Reflectorch XRR Example

```bash
vipr --config '@vipr_reflectometry/reflectorch/examples/configs/PTCDI-C3.yaml' inference run
```

### NSF Flow Model (HZDR)

1. Copy configuration file from HIFIS storage (dCache):
   - Path: `ROOT/Helmholtz/VIPR-project/models/w2vk83br/config.yaml`
   - Destination: `PWD/storage/reflectometry/flow_models/configs/mc1_nsf.yaml`

2. Copy model file from HIFIS storage (dCache):
   - Path: `ROOT/Helmholtz/VIPR-project/models/w2vk83br/model.pt`
   - Destination: `PWD/storage/reflectometry/flow_models/saved_models/mc1_nsf.pt`

Note: Access to HIFIS storage requires appropriate credentials and tools (e.g., WebDAV client, dCache tools).

3. Run inference:

```bash
vipr --config '@vipr_reflectometry/flow_models/examples/configs/NSF_XRR_full_postprocessing.yaml' inference run
```

## Acknowledgments

This plugin builds upon several open-source projects:

- **[VIPR Core](https://codebase.helmholtz.cloud/vipr/vipr-core)** (LGPL-3.0-or-later) - The VIPR framework foundation
- **[Reflectorch](https://github.com/schreiber-lab/reflectorch)** (MIT License) - Machine learning for X-ray and neutron reflectometry by Vladimir Starostin & Valentin Munteanu, University of Tübingen
- **[PANPE](https://github.com/mlcolab/panpe)** (MIT License, optional) - Deep learning for Bayesian reflectometry analysis

See [NOTICE.txt](NOTICE.txt) for complete third-party component information.

## License

This library is licensed under the **GNU Lesser General Public License v3.0** (LGPL-3.0).

### What this means for you:

**You CAN:**
- Use this library in commercial applications
- Use this library in proprietary/closed-source applications
- Modify the library for your needs

**You MUST:**
- Keep this library as a separate component (dynamic linking)
- Provide the source code of the library (including your modifications)
- Allow users to replace the library with a modified version
- Include the LGPL license text and copyright notices

**You CANNOT:**
- Statically link this library without releasing your entire application as LGPL
- Remove copyright notices
- Hold us liable for damages

### For proprietary applications:

You can use this library in your closed-source application by:
1. Linking dynamically (as a `.dll`, `.so`, or `.dylib`)
2. Providing a copy of this library's source code
3. Allowing users to replace the library version

See [LICENSE.txt](LICENSE.txt) for the full license text.
