Skip to main content

A webapp for SANS data fitting using SANS-fitter module.

Project description

SANS Model Fitter

Tests PyPI badge Codacy Badge

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

  1. 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
  2. Select Model:
    • Manual: Choose from dropdown of all SasModels models
    • AI-Assisted: Optionally provide an Anthropic (Claude) API key for AI-powered suggestions and MCP tool access, or use built-in heuristics
  3. Configure Parameters: Set initial values, bounds, and which parameters to fit
  4. Run Fit: Choose optimization engine (BUMPS or LMFit) and method, then click "Run Fit"
  5. View Results: Interactive plots show data with error bars and fitted curve
  6. Export: Download fitted parameters as CSV

Web App Deployment

Streamlit Cloud

  1. Push this repository to GitHub
  2. Go to share.streamlit.io
  3. Connect your GitHub account and deploy from the repository
  4. Set src/sans_webapp/app.py as 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 and MCP tool usage via Anthropic (Claude):

  1. Get an API key from Anthropic (https://console.anthropic.com/)
  2. Enter the key in the sidebar when using AI-Assisted mode
  3. Or set as environment variable: export ANTHROPIC_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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sans_webapp-0.0.3.tar.gz (74.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sans_webapp-0.0.3-py3-none-any.whl (55.2 kB view details)

Uploaded Python 3

File details

Details for the file sans_webapp-0.0.3.tar.gz.

File metadata

  • Download URL: sans_webapp-0.0.3.tar.gz
  • Upload date:
  • Size: 74.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sans_webapp-0.0.3.tar.gz
Algorithm Hash digest
SHA256 9c539667595f37642145b1aaec90929bef16f026f85b2d42060e06479153b45c
MD5 7a2d11e04215b076396b53dd2a10248a
BLAKE2b-256 ae2ffa8d9d680a810a8710ac9c9fd831dc640f19fc777e2901fde7e93821a911

See more details on using hashes here.

Provenance

The following attestation bundles were made for sans_webapp-0.0.3.tar.gz:

Publisher: ci.yml on ai4se1dk/SANS-webapp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sans_webapp-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: sans_webapp-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 55.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sans_webapp-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b33601959e7ff6b26999fcc15b94577b4e68173d8e608e0bfa08620c823ef25a
MD5 ca6b557a614c10e3bfbfdb2c0f46912f
BLAKE2b-256 502603b0f55636c679b0a91bb1ad04ff5ca2bb5ac913a74b21f065089e5b789a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sans_webapp-0.0.3-py3-none-any.whl:

Publisher: ci.yml on ai4se1dk/SANS-webapp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page