Skip to content

Feature comparison with other packages #417

Open

Description

@rozyczko

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, refl1d theta_offset, GenX tthoff. Near-universal and cheap; the refl1d wrapper even creates a theta_offset parameter for polarized probes but does not expose it.
  • Resolution from instrument geometry: refl1d (dT, dL, slit-based Monochromatic / Pulsed instruments, sample_broadening), GenX (six restype modes 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 (dq of shape (N, 2, M)), refl1d resolution='uniform', GenX TrapezoidResolution, BornAgain Gate/Lorentz/Cosine/LogNormal.
  • Footprint / over-illumination: GenX (footype gauss/square beam, beamw, samplelen; newer offset/trapezoid classes), BornAgain (FootprintGauss, FootprintSquare), refnx (Footprint, but only in ReflectModelTL). 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), refnx reverse_structure, GenX sample = -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, GenX neutron tof / neutron pol tof probes, BornAgain LambdaScan. 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, refl1d MixedExperiment (incoherent or coherent). Standard for incomplete bilayers, islands, lateral domains. No equivalent.
  • Parameter distributions (thickness inhomogeneity across the footprint): refl1d DistributionExperiment, GenX spec_inhom (sigma_inhom, Gaussian/PLD-empirical; also per-stack thickness/roughness/density gradients across repeats and supermirror sequences). RepeatingMultilayer repeats are strictly identical.
  • Polymer physics: refl1d PolymerBrush, PolymerMushroom, EndTetheredPolymer (SCF), VolumeProfile; refnx-models FreeformVFP, MaxEntVFP. None in easyReflectometry.
  • Lipid/surfactant modelling is not a gap (SurfactantLayer, Bilayer, LayerAreaPerMolecule vs. refnx LipidLeaflet), though refnx additionally has LipidLeafletGuest and per-slab vfsolv solvation on every Slab.

7. Fitting and statistics

  • Priors: uniform bounds only (bayesian.py has no prior specification). refnx accepts any scipy.stats distribution as Parameter.bounds; bumps has dev() (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 (refnx lnsigma). 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 offers dual_annealing / shgo as 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, remote genx_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: MaterialDensity uses tabulated neutron scattering lengths only (material_density.py → neutron_scattering_length()), no wavelength argument. refnx MaterialSLD(formula, density, probe='x-ray', wavelength=…), refl1d Material / Compound / Mixture via periodictable (fit by bulk/natural/relative/number density or cell volume), GenX fp / 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:

  1. Magnetic layers inside RepeatingMultilayer (blocked by refl1d's Repeat; GenX handles magnetic superlattices natively; a workaround is explicit unrolling).
  2. Magnetic ≠ structural profile: dead layers and independent magnetic interface widths : refl1d Magnetism(dead_below, dead_above, interface_below, interface_above), GenX magn_void, sigma_mag. LayerMagnetism has only rho_m, theta_m.
  3. Non-uniform magnetisation in a layer: refl1d MagnetismTwist, MagnetismStack, FreeMagnetism, FunctionalMagnetism.
  4. Guide-field angle and applied field: refl1d Aguide, H (Zeeman splitting of spin-flip channels), refnx Aguide, GenX zeeman / mag_field. Not set by the wrapper.
  5. 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.
  6. PNR on the refnx backend (refnx ≥ 0.1.51 supports it).
  7. 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 in project.py). refl1d/bumps --simulate, --noise, Experiment.simulate_data(), --entropy for 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

  1. Extensibility : no user-defined / freeform / functional SLD profiles (4 of 4 have this).
  2. 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.
  3. Interface profiles other than erf (refnx, GenX, BornAgain : not refl1d).
  4. Sample inhomogeneity : incoherent mixed-area sums, thickness distributions, graded repeats.
  5. X-ray SLD from formula (and hence chemically-coupled XRR + NR co-refinement).
  6. Statistics : informative priors, fit transforms / alternative FOMs, additional samplers / evidence, parallel execution, inequalities restricted to BUMPS engines.
  7. Realistic PNR : magnetic superlattices, dead layers / magnetic roughness, twists, guide-field angle / applied field, efficiencies, refnx-backend PNR.
  8. Workflow : vendor data loaders, synthetic-data / experiment-design tools, batch fitting, polymer models.

Activity

  1. added
    [scope] enhancement
    [priority] high
    on Sep 20, 2026
  2. jfkcooper commented on Oct 7, 2026

    @jfkcooper
    Collaborator

    Gap matrix analysis by Jos

    Missing from easyReflectometry 1.8.0 important?
    User-defined models / profiles in Python (§3) Yes, ideally want arbitrary functions possible
    Angle / Q offset (misalignment) parameter (§5) No, do not do - mixing reduction and analysis too much
    Resolution from Δθ/Δλ, non-Gaussian kernels (§5) Yes, very important since we have non-Gaussian resolution
    X-ray SLD from formula, energy-dependent f′/f″ (§8) Yes, we will want to co-refine XRR and NR
    Choice of interface profile (§4) yes, though low priority, and can be part of user defined models?
    Footprint / illumination correction (§5) Not sure, very much a reduction thing, but commonly done
    Freeform / spline / functional SLD profiles (§3) Yes, part of user defined profiles?
    Informative (non-uniform) priors (§7) yes, though low priority as not commonly done
    Parallel / accelerated fitting (§7) Yes
    Magnetic dead layers, magnetic roughness, twists, guide-field angle / applied field (§9) There are alot of things here, not all the same. Mostly yes though
    Polarizer / analyzer / flipper efficiencies at fit time (§9) No, too much of a reduction thing
    Synthetic data with noise, experiment design (§10) Yes, HOGBEN
    Vendor / facility data loaders (§10) Maybe? low priority for now, but probably easy to implement
    Wavelength-dependent (energy-dispersive / true TOF) calculation (§8) Maybe, low priority if so, TB discussed
    Domain models: polymer brushes / SCF (§6) Yes, though with user defined models
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [priority] high[scope] enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions