The PyMORGAN Boundary#
Ownership of Concerns#
Most architectural questions of the form “where does this code belong?” are answered by the table below:
Concern |
Owner |
Entry Point |
|---|---|---|
File formats & loader registry |
PyMORGAN |
|
Dataset objects |
PyMORGAN |
|
Background, chirp, solvent, SVD, stitching |
PyMORGAN |
|
Contour / spectra / kinetics plots |
PyMORGAN |
|
Species-spectra rendering |
PyMORGAN |
|
Aesthetics, colourmaps, unit labels |
PyMORGAN |
|
Kinetic models & rate matrices (\(\mathbf{K}\)) |
PyRATE-TA |
|
Fitting engines (Global, Target, LDA) |
PyRATE-TA |
|
Fit results, uncertainties & sessions |
PyRATE-TA |
|
Analysis-only plots (\(\mathbf{c}(t)\), \(\mathbf{K}\)-graph, L-curve) |
PyRATE-TA |
|
Three Architectural Rules#
The dependency is strictly one-way:
import pymorganinside PyRATE-TA is expected;import pyrate_tainside PyMORGAN is a design error. PyMORGAN’splot_species_spectradeliberately takes plain arrays (Sfit,Taus,TauErr,isFixTau,modelType) rather than a PyRATE-TA result object so the dependency arrow never reverses; the adapter (fit.as_species_args()) lives on the PyRATE-TA side.scripts/run_checks.pyasserts this boundary.No duplicate file readers: Loading goes through
pm.load_1D(path, data_type=...), which resolves the format through PyMORGAN’s registry and automatically picks up every format PyMORGAN supports.One aesthetics system: Call
pm.apply_style()and readpm.get_settings()for label style, colourmap, time-axis convention, and figure sizes. PyRATE-TA’s ownSettingsholds analysis-only fields.
A Minimal Session#
import pymorgan as pm
import pyrate_ta as pr
data = pm.load_1D("scan.pdat", data_type="PDAT") # PyMORGAN loads
data.background_correct(tmin=-20, tmax=-5) # PyMORGAN processes
fit = pr.fit_global(data, n_components=3) # PyRATE-TA fits
data.plot_species_spectra(*fit.as_species_args()) # PyMORGAN plots
Units & Trace Extraction#
Units: Signal data is in \(\text{mOD}\), delays are in the dataset’s own time unit, and the probe axis is in its native spectral unit. Fitted lifetimes are reported in the dataset’s time unit and are never silently converted.
Trace extraction: For a headless single-trace fit, slice the dataset directly (
data.Z[:, idx, detector]) or obtain extracted traces fromDataset1D.plot_kinetics, which returns(ax, t, Y).