6.2. Workflow Pages¶
The GUI guides you through a 5-page workflow for curve fitting.
6.2.1. Page 1: Data Loading¶
Purpose: Import your data into NLSQ.
Features:
Load CSV files (drag-and-drop or file dialog)
Paste from clipboard
Preview data table
Select X and Y columns
View data statistics
How to use:
Click “Open File” or drag a CSV onto the window
Select the X column (independent variable)
Select the Y column (dependent variable)
Optionally select a sigma column (uncertainties)
Click “Next” or Ctrl+2
Supported formats:
CSV (comma, tab, or semicolon separated)
TSV
Excel (xlsx) with openpyxl installed
6.2.2. Page 2: Model Selection¶
Purpose: Choose a mathematical model for fitting.
Features:
Built-in models (exponential, Gaussian, etc.)
Polynomial (select degree)
Custom Python model (advanced)
Model preview with formula
How to use:
Select a model category (Decay, Peak, Growth, etc.)
Choose a specific model
View the mathematical formula
Click “Next” or Ctrl+3
Built-in models:
Exponential decay
Gaussian peak
Lorentzian peak
Logistic growth
Power law
Polynomial (degree 1-10)
6.2.3. Page 3: Fitting Options¶
Purpose: Configure fit parameters and run the fit.
Features:
Workflow preset selection (Fast/Robust/Quality)
Initial parameter guess (auto or manual)
Parameter bounds (optional)
Advanced options (tolerances, iterations)
Live cost function plot
How to use:
Select a preset: - Fast: Quick fit with default settings - Robust: Multi-start global optimization - Quality: Thorough search with tight tolerances
Set initial guess (or use auto-estimate)
Optionally set bounds on parameters
Click “Run Fit” (or Ctrl+R)
Watch the live cost plot during fitting
Guided vs Advanced Mode:
Guided: Simple preset selection
Advanced: Full control over tolerances, iterations, etc.
6.2.4. Page 4: Results¶
Purpose: View and analyze fit results.
Features:
Fitted parameters with uncertainties
Goodness-of-fit statistics (R², chi-squared)
Interactive fit plot
Residual plot
Correlation matrix
How to use:
Review fitted parameters
Examine the fit plot (zoom, pan, export)
Check residuals for systematic patterns
View statistics panel
Click “Next” to export or “Back” to adjust
Quality indicators:
R² close to 1.0 indicates good fit
Reduced chi-squared ~1.0 with known uncertainties
Random residuals (no patterns)
6.2.5. Page 5: Export¶
Purpose: Save results in various formats.
Features:
ZIP session bundle (complete backup)
JSON (parameters and metadata)
CSV (data with fit curve)
Python code generation
Plot export (PNG, PDF, SVG)
Export formats:
ZIP Bundle: Complete session including: - Original data - Fitted parameters - Covariance matrix - Settings and configuration - Session state for reload
JSON: Structured results:
{ "parameters": {"A": 2.5, "k": 0.5, "c": 0.3}, "uncertainties": {"A": 0.02, "k": 0.01, "c": 0.005}, "statistics": {"r_squared": 0.998, "chi_squared": 45.2} }
CSV: Data table with fit values:
x,y,y_fit,residual 0,1.0,1.02,-0.02 1,0.62,0.61,0.01 ...
Python Code: Reproducible script:
from nlsq import fit import jax.numpy as jnp def model(x, A, k, c): return A * jnp.exp(-k * x) + c popt, pcov = fit(model, xdata, ydata, p0=[2.5, 0.5, 0.3])
6.2.7. Next Steps¶
Fitting Presets - Learn about fitting presets
Common Issues - Troubleshooting