Format

HDF5 is a binary container of named datasets; NeXus files (.nxs) are HDF5 with a standardized internal layout.

Import

Read with h5py; it is not installed with BornAgain, install it once with pip install h5py. Then:

import h5py
import numpy as np

with h5py.File("data.nxs", "r") as f:
    image = np.asarray(f["entry/data/counts"])  # dataset path depends on the file

If the file comes from a detector whose HDF5 flavor Fabio knows (e.g. Eiger), fabio.open works as well, as for any detector image — no dataset path needed.