Release 22.1

Release 22.0 was skipped because of technical issues with deployment to PyPI.

So this is major release 22, the result of a long development cycle with deep internal restructuring and cleanup. Altogether, we now achieve improved stability and functionality with 15% less lines of source code.

For a full list of changes see the CHANGELOG.

Windows users who are working in Pyenv or Conda environments please be advised that a bug in Python 3.10 may cause a crash when a Python script is imported to the GUI unless certain environment variables are set, see here and here. We recommend upgrading to Python 3.11 or newer.

For Mac users, the two supported deployment methods are build from source and install as a Homebrew package. Because of Apple’s increasingly restrictive policies we gave up on producing installer packages (MacOS bundles).

Best greetings from the BornAgain maintainer team:

Ammar Nejati, Mikhail Svechnikov, Joachim Wuttke

Some highlights:

The auto-generated Python bindings were simplified, and are now ready for NumPy 2. NumPy 1 continues to be supported.

Simulations now return a unified data type Datafield. Plot functions in module ba_plot were simplified and unified. Documentation is provided in the online reference, chapters “Data types” and “Plotting”.

Time-of-flight off-specular neutron scattering is now supported by classes LambdaScan and QzScan.

In the sample model, class Sample replaces Multilayer. Class Roughness is now an attribute of Layer. The roughness model has become more versatile. Beside the previous default, now called SelfAffineFractalModel, there is a LinearGrowthModel that propagates real-space features from lower to upper interfaces. Otherwise interface-interface crosscorrelations can be set as a separate model component. New classes TanhTransient and ErfTransient are 1:1 replacements for the previous enum-based syntax.

Incompatibility with v21

On the downside, all GUI project files compatibility is broken.

For upgrading Python scripts from v21 to v22, we provide for the first time a tool: upgrade-21-to-22.py. This tool, however, will fail if it encounters some old-style plot commands or some class names that have no simple 1:1 correspondence.

Beware in particular that the semantics of the Spheroid constructor has changed: The arguments are now Rxy and Rz instead of Rxy and H.

Roughness API

Rough interfaces used to be constructed like this:

    sample = ba.MultiLayer()
    layer = ba.Layer(material, thickness)
    roughness = ba.LayerRoughness(sigma, hurst, corrLength)
    sample.addLayerWithTopRoughness(layer, roughness)

Now this has been replaced by

    autocorr = ba.SelfAffineFractalModel(sigma, hurst, horizontal_corr_length)
    transient = ba.ErfTransient()
    crosscorrelation = ba.CommonDepthCrosscorrelation(vertical_corr_length)
    roughness = ba.Roughness(autocorr, transient, crosscorrelation)

    sample = ba.Sample()
    layer = ba.Layer(material, thickness, roughness)
    sample.addLayer(layer)

April 22, 2025