BAMresearch / SasModelsExplorer

MIT License
3 stars 0 forks source link

SasModels Explorer App

A PyQt-based interactive application to explore scattering models using the sasmodels library.

SME

This app enables visualization and fine-tuning of model parameters via a user-friendly GUI, featuring both sliders and dropdown menus for parameter adjustments, and a real-time plot of scattering intensity.

Features

Installation and Usage

  1. clone the repository:
    git clone https://github.com/SasView/explorer`
    cd <repository folder>
  2. (optional). setup a virtual enviroment for this explorer: python3.12 -m venv .venv
  3. (optional). activate the virtual environment: .venv/bin/activate
  4. install the dependencies: pip install -r requirements.txt
  5. run the app: python -m ModelExplorer -v sphere@hardsphere
  6. (optional) deactivate the virtual environment: deactivate

Using the GUI

Loading a Model:

Type the model name (e.g., "sphere", "cylinder", or sasmodels-syntax combinations such as "sphere@hardsphere+cylinder") in the model field and press Enter to load it. The app will display parameter controls for the model.

Adjusting Parameters:

Sliders and Text Boxes: Each parameter has an adjustable slider and a text box for exact values. Logarithmic sliders enable wide-range adjustments. Dropdown Menus: Parameters with multiple text options (e.g., _pd_type for polydispersity) appear as dropdowns. Polydispersity Controls: Automatically includes controls for relevant parameters: polydispersity and (default number-weighted) distribution shape. Axis controls: Under the graph, the q limits and q units can be adjusted.

Example Models

Try these models to get started:

The entire sasmodels library is available, which you can combine, multiply, subtract with the syntax alluded to above... A help text with the available models is displayed when a nonexistent model is entered.

Under the hood

Logging and Debugging

The application uses logging for tracking parameter changes:

Current issues

Also check the "issues" in the Github repository.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License.