How jbhopkins/bioxtasraw works
Project Type and Purpose
• BioXTAS RAW is a Python‑based desktop application (full‑stack in the sense of GUI + core library + external tool integration) for processing solution Small‑Angle Scattering (SAS) data.
• It exposes both a graphical front‑end (RAW GUI) and a programmatic API (RAWAPI and core bioxtasraw modules), integrates with external binaries (GNOM, DAMMIF, DENSS, ATSAS), reads/writes many file formats, and is packaged for Linux, macOS, and Windows.
File Structure
Top‑level directories:
• bioxtasraw/ – core Python package. Contains:
– GUI modules (RAW.py, RAWCustomDialogs.py, RAWPlot.py, RAWReport.py, RAWOptions.py, etc.)
– API/core compute modules (SASCalc.py, SASProc.py, DENSS.py, BIFT.py, REGALS.py, etc.)
– File I/O and parsers (SASFileIO.py, SASParser.py, RAWAPI.py)
– Resource definitions (denss_resources/, definitions/hdf5/)
• installer/ – PyInstaller spec and hooks, platform‑specific packaging scripts.
• docs/ – Sphinx documentation sources.
• Tests/ – pytest suite and sample data.
• LinuxLib/ – Linux launcher scripts and desktop entry.
• Packaging files: setup.py, pyproject.toml, requirements.txt.
README for Insights
• Describes main features (2D→1D integration, Guinier fits, Rg, MW, GNOM, DAMMIF, DENSS, EFA, REGALS).
• Mentions dependencies (ATSAS, hdf5plugins, PyFAI) and install targets (Linux, macOS, Windows).
Main Components
a. User Interface Layer
– RAW GUI (PyQt/PySide front‑end)
– Dialogs & Controls (RAWCustomDialogs, RAWCustomCtrl)
– Plotting components (RAWPlot)
b. Core Processing Layer
– RAWAPI & RAWAnalysis (or programmatic entry points)
– SASCalc, SASProc, SASUtils, DENSS, BIFT, REGALS modules (business logic)
c. Data I/O Layer
– File parsers (SASFileIO, SASParser)
– HDF5 definitions (definitions/hdf5)
d. External Tools & Services
– ATSAS suite (GNOM, DAMMIF, DAMAVER, DAMCLUST, AMBIMETER)
– DENSS binary
– PyFAI plugins (calibrant)
– HDF5 plugins
e. Packaging & Deployment
– PyInstaller spec (installer/RAW.spec) and hooks
– Linux launcher (LinuxLib/)
– Installer scripts per platform
Relationships & Data Flows
– User clicks in GUI → GUI controller invokes RAWAPI or directly calls SASCalc/SASProc → Data parser reads 2D image → produces 1D profile → business logic modules run fits or external binaries → results returned to GUI → plotted or saved.
– For external tools: Data written to temp file → external binary invoked (subprocess) → output file parsed back into Python → update in-memory model → displayed.
– Packaging flow (build time only): source + resources + hooks → PyInstaller → standalone executables → installer scripts wrap them into OS‑native packages.
Architectural Patterns & Principles
– Layered architecture: UI → API/Controller → Business logic → Data I/O → External services
– Modular design: each analysis algorithm (SASCalc, DENSS, BIFT, REGALS) is isolated in its own module.
– Plugin‑style resource loading (denss_resources JSON, HDF5 definitions).
– Separation of concerns: parsing, computation, and presentation are distinct.