Python scripting

The Python application programming interface (API) enables users to run simulations and fits from the high-level programming language Python. This can be done in interactive sessions or by executing a script, using the command line, a Jupyter notebook, or an integrated development environment (IDE) like PyCharm.

Scripting is more versatile than the GUI and provides functionality that is not yet available in the GUI, or never will be. For instance, one can

  • set up arbitrarily complicated combined and constrained fits;
  • batch process huge data sets;
  • react to a simulation or fit outcome through control clauses;
  • extend the functionality of the BornAgain core, for instance by adding particle form factors or correlation functions.

Installing the Python package

The installer for any supported platform includes, among others, a Python package (‘wheel’); for instance, for Python 3.9, the package can be found under python/3.9/wheel folder.

The package can be installed via the standard Python’s pip; e.g.,

python3 -m pip install <BornAgain-wheel-file>

For further options, consult pip’s documentation.

Read on: