A webapp for SANS data fitting using SANS-fitter module.
Project description
SANS Model Fitter
SANS-webapp
A Streamlit-based web application is now available for interactive SANS data analysis with a user-friendly interface.
Features
- 📤 Data Upload: Upload your SANS datasets (CSV or .dat files)
- 🤖 AI-Assisted Model Selection: Get intelligent model suggestions based on your data
- 🎯 Manual Model Selection: Choose from all available SasModels
- ⚙️ Interactive Parameter Tuning: Adjust parameters with real-time UI controls
- 📊 Interactive Plots: Visualize data and fits with Plotly's zoom, pan, and export features
- 💾 Export Results: Save fitted parameters and curves to CSV
Quick Start (Web App)
# Install the application
pip install -e .
# Run the Streamlit app (choose one)
sans-webapp # CLI command
python -m sans_webapp # Module execution
The app will open in your browser at http://localhost:8501.
Install from PyPI
pip install sans-webapp
sans-webapp
Using the Web Application
- Upload Data: Use the sidebar to upload your SANS data file (CSV or .dat format with Q, I, dI columns) or load the example dataset
- Select Model:
- Manual: Choose from dropdown of all SasModels models
- AI-Assisted: Optionally provide an OpenAI API key for AI-powered suggestions, or use built-in heuristics
- Configure Parameters: Set initial values, bounds, and which parameters to fit
- Run Fit: Choose optimization engine (BUMPS or LMFit) and method, then click "Run Fit"
- View Results: Interactive plots show data with error bars and fitted curve
- Export: Download fitted parameters as CSV
Web App Deployment
Streamlit Cloud
- Push this repository to GitHub
- Go to share.streamlit.io
- Connect your GitHub account and deploy from the repository
- Set
src/sans_webapp/app.pyas the main file
Heroku
# The Procfile is already configured
# Deploy directly
heroku create your-app-name
git push heroku main
Docker
# Build image
docker build -t SANS-webapp-app .
# Run container
docker run -p 8501:8501 SANS-webapp-app
API Integration
The web app supports optional AI-powered model suggestions via the OpenAI API:
- Get an API key from platform.openai.com
- Enter the key in the sidebar when using AI-Assisted mode
- Or set as environment variable:
export OPENAI_API_KEY=your-key-here
Note: The app also works without an API key using built-in heuristic suggestions.
License
BSD 3-Clause License. See LICENSE for the full text.
References
- SasModels: https://github.com/SasView/sasmodels
- BUMPS: https://github.com/bumps/bumps
- LMFit: https://lmfit.github.io/lmfit-py/
- Streamlit: https://streamlit.io
- Plotly: https://plotly.com/python/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sans_webapp-0.0.2.tar.gz.
File metadata
- Download URL: sans_webapp-0.0.2.tar.gz
- Upload date:
- Size: 36.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
780070855c4b30154d0edb8ce4aa7fdc5b12c682f9eb1e2aa3a6dbdc335c4c4f
|
|
| MD5 |
d6a58b8c00649019f1f1814d4a1233cc
|
|
| BLAKE2b-256 |
5ef1cdd4f0deaddebb61e6a1f330a935024e5c20546c92272d953ceef31b37a7
|
Provenance
The following attestation bundles were made for sans_webapp-0.0.2.tar.gz:
Publisher:
ci.yml on ai4se1dk/SANS-webapp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sans_webapp-0.0.2.tar.gz -
Subject digest:
780070855c4b30154d0edb8ce4aa7fdc5b12c682f9eb1e2aa3a6dbdc335c4c4f - Sigstore transparency entry: 832898840
- Sigstore integration time:
-
Permalink:
ai4se1dk/SANS-webapp@00ccb8bf75a4a0360f4c6c7e3a5946de05adf223 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/ai4se1dk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@00ccb8bf75a4a0360f4c6c7e3a5946de05adf223 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sans_webapp-0.0.2-py3-none-any.whl.
File metadata
- Download URL: sans_webapp-0.0.2-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d587ee48ec1d16fd4ab4602c322d67af1063d412248e32485668fefc927d685
|
|
| MD5 |
a2c04f82cc5cc1dd8980fddd9f04d5bd
|
|
| BLAKE2b-256 |
d62a55f357377d1baab338bd9fad6ec0bfdf33a5aa2ee3bd4d4014a821ac0cb2
|
Provenance
The following attestation bundles were made for sans_webapp-0.0.2-py3-none-any.whl:
Publisher:
ci.yml on ai4se1dk/SANS-webapp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sans_webapp-0.0.2-py3-none-any.whl -
Subject digest:
4d587ee48ec1d16fd4ab4602c322d67af1063d412248e32485668fefc927d685 - Sigstore transparency entry: 832898841
- Sigstore integration time:
-
Permalink:
ai4se1dk/SANS-webapp@00ccb8bf75a4a0360f4c6c7e3a5946de05adf223 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/ai4se1dk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@00ccb8bf75a4a0360f4c6c7e3a5946de05adf223 -
Trigger Event:
push
-
Statement type: