Repository navigation
Description
easyReflectometry vs. refnx / refl1d / BornAgain / GenX : Missing Functionality Analysis
Versions compared against: refnx 0.1.67 · refl1d 1.0.1 / bumps · GenX 3.8.11–3.9.0 · BornAgain 24.1 (released 2026-06-29).
Gap matrix (how common is each missing feature?)
✔ = supported, ◐ = partial / via companion package, ✘ = not available. Sorted by how many of the four reference codes have the feature.
| Missing from easyReflectometry 1.8.0 | refnx | refl1d | GenX | BornAgain | Count |
|---|---|---|---|---|---|
| User-defined models / profiles in Python (§3) | ✔ | ✔ | ✔ | ✔ | 4 |
| Angle / Q offset (misalignment) parameter (§5) | ✔ q_offset |
✔ theta_offset |
✔ tthoff |
– (unverified) | 3–4 |
| Resolution from Δθ/Δλ, non-Gaussian kernels (§5) | ✔ | ✔ | ✔ | ✔ | 4 |
| X-ray SLD from formula, energy-dependent f′/f″ (§8) | ✔ | ✔ (single λ) | ✔ | ✘ | 3 |
| Choice of interface profile (§4) | ✔ (6) | ✘ (erf only) | ✔ (4) | ✔ (2) | 3 |
| Footprint / illumination correction (§5) | ◐ (ReflectModelTL only) |
✘ (at reduction) | ✔ | ✔ | 2–3 |
| Freeform / spline / functional SLD profiles (§3) | ✔ Spline, FunctionalForm |
✔ FreeLayer, FreeInterface, Chebyshev, FunctionalProfile |
◐ spec_adaptive elements |
✘ | 2–3 |
| Informative (non-uniform) priors (§7) | ✔ any scipy.stats PDF |
✔ dev, soft_range, pdf |
✘ | ✘ | 2 |
| Parallel / accelerated fitting (§7) | ✔ threads, pools, MPI; OpenCL/JAX/torch kernels | ✔ --parallel, --mpi, numba |
✔ multiprocessing, numba, CUDA, MPI, remote server | ✔ multithreaded C++ core | 4 |
| Magnetic dead layers, magnetic roughness, twists, guide-field angle / applied field (§9) | ◐ Aguide only |
✔ | ✔ | ◐ | 2–3 |
| Polarizer / analyzer / flipper efficiencies at fit time (§9) | ◐ (in refnx.reduce) |
◐ (in reductus) | ✔ | ◐ | 1–2 |
| Synthetic data with noise, experiment design (§10) | ◐ (refnx-models) | ✔ --simulate, --noise, --entropy |
– | ✔ (it is a simulator) | 2 |
| Vendor / facility data loaders (§10) | ◐ (ANSTO) | ✔ NCNR, SNS, ANSTO, staj | ✔ Bruker, Rigaku, xrdml, Seifert, D17, Amor, SNS, SINQ… | ◐ .mft, csv |
2–3 |
| Wavelength-dependent (energy-dispersive / true TOF) calculation (§8) | ✔ ReflectModelTL |
✘ | ✔ neutron tof probes |
✔ LambdaScan |
3 |
| Domain models: polymer brushes / SCF (§6) | ◐ refnx-models | ✔ PolymerBrush, PolymerMushroom, EndTetheredPolymer |
✘ | ✘ | 1–2 |
Key structural observation: easyReflectometry does not compute reflectivity itself : it wraps refnx and refl1d. A large share of the gaps above are features already present in those backends but not exposed by the wrapper: interface types, q_offset, non-Gaussian kernels, MixedReflectModel, Spline, MaterialSLD(x-ray), refnx PNR (all refnx); theta_offset, sample_broadening, back_reflectivity, Aguide/H, magnetic dead layers/interfaces, MagnetismTwist, FreeLayer, MixedExperiment, polymer models, Δθ/Δλ resolution (all refl1d). These are "pass-through" gaps : cheap relative to anything requiring new physics.
3. Custom / user-defined models : still the biggest structural gap
| Code | What it offers |
|---|---|
| refnx | Custom Component subclasses (the base of Slab, Spline, LipidLeaflet, FunctionalForm, MixedSlab…), arbitrary fit functions via refnx.analysis.Model(fitfunc) ("generalised curvefitting"), swappable kernels (fkernel=, use_reflect_backend()), community refnx-models repo |
| refl1d | Models are Python scripts (from refl1d.names import *); FunctionalProfile / FunctionalMagnetism (any f(z)), monotonic-spline FreeLayer / FreeInterface, Chebyshev FreeformCheby / ChebyVF, FreeMagnetism |
| GenX | Every model is an editable Python script; "Writing a custom model" tutorial; plugin framework; UserVars / cp.new_var for coupled parameters; spec_adaptive sums nuclear/magnetic/elemental profiles and re-slices adaptively |
| BornAgain | Python scripting is now the only interface; arbitrary sample construction incl. particle-decorated layers averaged into the SLD profile |
| easyReflectometry | Fixed object model. The only non-slab profile is GradientLayer : linear only, fixed number of equal slices, single shared roughness. No hook for a user SLD(z), custom assembly maths, or a custom kernel. (New assemblies can be subclassed from BaseAssembly, but this is undocumented developer territory, and the calculators only understand slabs.) |
Concrete missing pieces, most-requested first: spline/freeform layer → functional-form layer (exponential/tanh/parabolic decay) → adaptive micro-slicing of arbitrary profiles.
4. Interface profile types
Only Nevot–Croce/erf roughness (layer.py). Available elsewhere: refnx Erf, Linear, Exponential, Tanh, Sinusoidal, Step per slab; GenX spec_adaptive gauss/linear/exp-1/exp-2; BornAgain erf/tanh transients. Not refl1d (corrected). Also absent: roughness that exceeds layer thickness handled by micro-slicing (refl1d Microslabs, GenX spec_adaptive) : with Nevot–Croce factors, σ ≳ d/3 silently gives wrong profiles.
5. Instrument / beam description
easyReflectometry: Gaussian Q-smearing (three ways to specify σ_Q), scalar scale, constant background. Missing:
- Angular / Q offset for sample misalignment : refnx
q_offset, refl1dtheta_offset, GenXtthoff. Near-universal and cheap; the refl1d wrapper even creates atheta_offsetparameter for polarized probes but does not expose it. - Resolution from instrument geometry: refl1d (
dT,dL, slit-basedMonochromatic/Pulsedinstruments,sample_broadening), GenX (sixrestypemodes incl. per-point and dx/x, user-replaceable resolution classes, Cu Kα1/α2 doublet), BornAgain (distributions on angle and wavelength). - Non-Gaussian resolution: refnx per-point arbitrary kernels (
dqof shape (N, 2, M)), refl1dresolution='uniform', GenXTrapezoidResolution, BornAgain Gate/Lorentz/Cosine/LogNormal. - Footprint / over-illumination: GenX (
footypegauss/square beam,beamw,samplelen; newer offset/trapezoid classes), BornAgain (FootprintGauss,FootprintSquare), refnx (Footprint, but only inReflectModelTL). Essential for lab XRR users; neutron users usually correct at reduction. - Back-reflection geometry: refl1d
back_reflectivity+back_absorption(beam through the substrate, with attenuation), refnxreverse_structure, GenXsample = -sample. In easyReflectometry the stack must be reversed by hand and substrate attenuation cannot be modelled. - Angle–wavelength (θ, λ) calculations: true TOF / energy-dispersive data with λ-dependent SLD and absorption : refnx
ReflectModelTL, GenXneutron tof/neutron pol tofprobes, BornAgainLambdaScan. easyReflectometry is Q-only with constant SLDs. - Non-constant background (GenX also offers systematic-error parameters
cp.new_sys_err).
6. Sample inhomogeneity and domain-specific models
- Incoherent sums / patchy samples: refnx
MixedReflectModel, refl1dMixedExperiment(incoherent or coherent). Standard for incomplete bilayers, islands, lateral domains. No equivalent. - Parameter distributions (thickness inhomogeneity across the footprint): refl1d
DistributionExperiment, GenXspec_inhom(sigma_inhom, Gaussian/PLD-empirical; also per-stack thickness/roughness/density gradients across repeats and supermirror sequences).RepeatingMultilayerrepeats are strictly identical. - Polymer physics: refl1d
PolymerBrush,PolymerMushroom,EndTetheredPolymer(SCF),VolumeProfile; refnx-modelsFreeformVFP,MaxEntVFP. None in easyReflectometry. - Lipid/surfactant modelling is not a gap (
SurfactantLayer,Bilayer,LayerAreaPerMoleculevs. refnxLipidLeaflet), though refnx additionally hasLipidLeafletGuestand per-slabvfsolvsolvation on everySlab.
7. Fitting and statistics
- Priors: uniform bounds only (
bayesian.pyhas no prior specification). refnx accepts anyscipy.statsdistribution asParameter.bounds; bumps hasdev()(normal),soft_range,pdf. - Samplers / model comparison: DREAM only. refnx: emcee + ptemcee parallel tempering built in, documented dynesty (evidence,
logz) and PyMC bridges; bumps: DREAM, parallel tempering, entropy estimates. No evidence / model-selection workflow in easyReflectometry. - Objective transforms: WLS χ² on R (+ Mighell) only. No log-R, R·Q⁴, or alternative figures of merit (refnx
Transform, GenX 14 FOMs + custom, BornAgain 4 metrics); no fittable error-scaling (refnxlnsigma). Matters for data with unreliable error bars : typical for lab XRR. - Optimizer coverage (the corrected version of the old claim): DE exists via LMFit, but bumps' own population/global methods (
de,pt,ps,rl) are not exposed, refnx offersdual_annealing/shgoas well, and because inequality constraints are BUMPS-only they cannot be used together with the only global optimizer. - Parallelism / acceleration: nothing explicit in
fitting.py. refnx (threads, pools, MPI; OpenCL/JAX/torch kernels), bumps (--parallel,--mpi), GenX (multiprocessing, numba, CUDA, MPI, remotegenx_server). - Batch / sequential fitting of series (kinetics, temperature scans): GenX has a batch dialog + CLI; refnx documents the recipe. No dedicated facility in
Project/MultiFitter. - Fit resume / checkpointing: bumps
--store/--resume. Posterior save/load exists in easyReflectometry, fit resume does not.
8. Materials
- X-ray SLD from formula:
MaterialDensityuses tabulated neutron scattering lengths only (material_density.py→neutron_scattering_length()), no wavelength argument. refnxMaterialSLD(formula, density, probe='x-ray', wavelength=…), refl1dMaterial/Compound/Mixturevia periodictable (fit by bulk/natural/relative/number density or cell volume), GenXfp/fw(Henke/CXRO, energy-dependent) +bc/bw, and an SLD calculator plugin that can query Materials Project / COD. BornAgain has none (corrected: so 3 of 4, not "all"). - Combined XRR + NR co-refinement from one chemical model follows from the above: in refl1d/GenX/refnx the same formula + density yields both contrasts; in easyReflectometry the x-ray SLD must be entered by hand and cannot be tied to the density parameter.
- Resonant / anomalous / energy scans: GenX only (
mag_refl,EnergySpecular) : niche, not "common". - Element-specific / mass-density profiles: GenX only.
9. Polarized neutrons beyond the ideal case
1.8.0 has 4-channel PNR with canted moments. Still missing, in order of how commonly needed:
- Magnetic layers inside
RepeatingMultilayer(blocked by refl1d'sRepeat; GenX handles magnetic superlattices natively; a workaround is explicit unrolling). - Magnetic ≠ structural profile: dead layers and independent magnetic interface widths : refl1d
Magnetism(dead_below, dead_above, interface_below, interface_above), GenXmagn_void,sigma_mag.LayerMagnetismhas onlyrho_m,theta_m. - Non-uniform magnetisation in a layer: refl1d
MagnetismTwist,MagnetismStack,FreeMagnetism,FunctionalMagnetism. - Guide-field angle and applied field: refl1d
Aguide,H(Zeeman splitting of spin-flip channels), refnxAguide, GenXzeeman/mag_field. Not set by the wrapper. - Polarization efficiencies at fit time: GenX (
p1,p2,F1,F2), BornAgain (imperfect polarizer + analyzer transmission). For NIST/ANSTO-style workflows this is done in reduction, so it is a gap mainly for users with uncorrected data. - PNR on the refnx backend (refnx ≥ 0.1.51 supports it).
- Moment in μB per formula unit (GenX
magn) rather than magnetic SLD : convenience.
10. Data, simulation and tooling
- Loaders: ORSO + 4-column text only (
measurement.py). GenX ships ~16 loaders (Bruker brml, Rigaku, PANalytical xrdml, Seifert, ILL D17, PSI Amor, SNS…); refl1d reads NCNR/SNS/ANSTO + legacy staj; refnx reads ANSTO NeXus. Lab-XRR users will hit this first. - Synthetic data / experiment planning: no noise model or
simulate(confirmed absent inproject.py). refl1d/bumps--simulate,--noise,Experiment.simulate_data(),--entropyfor information gain; BornAgain is simulation-first (Poisson noise/background). - Data reduction: only refnx (
refnx.reduce, ANSTO instruments). Not expected of an analysis library; listed for completeness. - Script / model export: refnx GUI exports a standalone script; GenX exports BornAgain scripts. easyReflectometry covers interchange via ORSO model language instead.
12. Bottom line
- Extensibility : no user-defined / freeform / functional SLD profiles (4 of 4 have this).
- Instrument realism : no angle/Q offset, no Δθ/Δλ or non-Gaussian resolution, no footprint, no back-reflection geometry, no θ–λ (TOF) mode. Mostly pass-through to existing backend parameters.
- Interface profiles other than erf (refnx, GenX, BornAgain : not refl1d).
- Sample inhomogeneity : incoherent mixed-area sums, thickness distributions, graded repeats.
- X-ray SLD from formula (and hence chemically-coupled XRR + NR co-refinement).
- Statistics : informative priors, fit transforms / alternative FOMs, additional samplers / evidence, parallel execution, inequalities restricted to BUMPS engines.
- Realistic PNR : magnetic superlattices, dead layers / magnetic roughness, twists, guide-field angle / applied field, efficiencies, refnx-backend PNR.
- Workflow : vendor data loaders, synthetic-data / experiment-design tools, batch fitting, polymer models.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsTODO next
Activity
jfkcooper commentedon Oct 7, 2026
Gap matrix analysis by Jos