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
streamlit run src/app.py

The app will open in your browser at http://localhost:8501.

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/app.py as the main file

Heroku

# Create Procfile
echo "web: streamlit run src/app.py --server.port=$PORT --server.address=0.0.0.0" > Procfile

# Deploy
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.1.tar.gz (28.9 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.1-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sans_webapp-0.0.1.tar.gz
  • Upload date:
  • Size: 28.9 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.1.tar.gz
Algorithm Hash digest
SHA256 1ba075a6ee61dd4ef71f244d94434d23b9d12721ea78f8857396e2483ea3f51b
MD5 dac1059d2de0c1be42943357a53cbb2a
BLAKE2b-256 e57c50f837315e02df382b7ace61cfabbf459dfa6d8159b290064e9d1f543357

See more details on using hashes here.

Provenance

The following attestation bundles were made for sans_webapp-0.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: sans_webapp-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 34.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f08a4cb0e47056e42afc795d508a919fbd83431b4fc5b27cd3340e79c39c5628
MD5 3c75e1795f4b684c251d50647e4564f3
BLAKE2b-256 5e67f2af10719b580023465a5d9083eec98168d62a7aceccf3a71c4b1934c1a8

See more details on using hashes here.

Provenance

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