Skip to main content

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

Project description

SANS Model Fitter

Tests codecov

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 OpenAI API key for AI-powered suggestions, 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 via the OpenAI API:

  1. Get an API key from platform.openai.com
  2. Enter the key in the sidebar when using AI-Assisted mode
  3. 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

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.2.tar.gz (36.3 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.2-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

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

Hashes for sans_webapp-0.0.2.tar.gz
Algorithm Hash digest
SHA256 780070855c4b30154d0edb8ce4aa7fdc5b12c682f9eb1e2aa3a6dbdc335c4c4f
MD5 d6a58b8c00649019f1f1814d4a1233cc
BLAKE2b-256 5ef1cdd4f0deaddebb61e6a1f330a935024e5c20546c92272d953ceef31b37a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for sans_webapp-0.0.2.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.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

Hashes for sans_webapp-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4d587ee48ec1d16fd4ab4602c322d67af1063d412248e32485668fefc927d685
MD5 a2c04f82cc5cc1dd8980fddd9f04d5bd
BLAKE2b-256 d62a55f357377d1baab338bd9fad6ec0bfdf33a5aa2ee3bd4d4014a821ac0cb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for sans_webapp-0.0.2-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