Graphical Curve Fit for Python

gcfpy is a graphical application for building, executing, and analyzing curve fitting workflows. Designed for scientists and engineers, it provides an interactive environment for fitting experimental data using user-defined models.

You can define models using a formula interface based on SymPy syntax, fit data using least-squares (lmfit), Bayes ian methods (emcee) or orthogonal distance regression (scipy), and compare multiple fits.

Key Features

  • Define custom models using symbolic formulas
  • Fit using least-squares (lmfit), orthogonal distance regression (scipy.odr), or MCMC (emcee)
  • Visualise residuals, confidence bands, and component contributions
  • Run and compare multiple fits in parallel tabs
  • Adjust parameters manually and explore model behavior
  • Import/export data and fit results (CSV)

The gcfpy package is free software, using an Open Source license. The software and this document are works in progress. If you are interested in participating in this effort please use the Git repository.


User guide

Tutorials

  • Basic fit: Start with a simple 1D fit using a basic formula on noisy data.
  • Plots lmfit/odr: Explore confidence bands, residuals, decomposition, and 2D contour plots (for non-MCMC methods).
  • Plots mcmc: Run a full MCMC fit and visualize results with corner, walkers, autocorrelation, and 99% bands.
  • Multi 1D fit: Perform 1D fits across slices of Y in a 2D dataset (Z = f(X), Y fixed), with a global formula including y.
  • 2D fit: Fit a full surface model Z = f(X, Y), using 2D plotting, surface rendering, and projections.
  • Manual fit: Manually adjust parameters using sliders and observe the live response.
  • Comparison: Store, toggle, and compare multiple fits using the integrated comparison tool.

Application Sections

  • UI Overview: Introduction to the interface layout and navigation
  • Menus: File, view, and advanced menu actions
  • Toolbar: Quick-access actions for fitting, plotting, and toggles
  • Docks: Modular panels for formulas, plots, results, and data inspection

Model Definition & Execution

  • Formula Editor: Writing and importing formulas using SymPy/NumPy syntax
  • Fit Options: Customizing method, bounds, initial values, and strategy
  • Manual Fit: Interactive sliders for manual parameter adjustment
  • Comparison Mode: Save and compare multiple fits
  • Fit result: View numerical fit reports and graphical diagnostics (residuals, decomposition, etc.)
  • MCMC result: corner plots, autocorrelation diagnostics, uncertainty intervals

Working with Data


Developpment

  • Overview: Supported formats and loading mechanisms (CSV)
  • FitTab: Main workspace for fitting operations and data handling
  • Toolbar: Toolbar setup, menus, and action handling
  • Fit Control: Fit parameter selection and orchestration
  • Fit Processor: Core fitting logic (lmfit, odr, emcee)
  • Fit Comparison: Manage, display, and export multiple fits
  • Plot System: 1D, 2D, an mcmc

More Information

  • Dependencies: PyQt5, lmfit, emcee, scipy, pandas, numpy, matplotlib
  • Source code: Git repository
  • License: MIT License