Released versions of NeXpy are available on PyPI and conda-forge.
You can therefore install using 'pip':
$ pip install nexpy
or 'conda':
$ conda install -c conda-forge nexpy
Note
You can add conda-forge to your default channels so that it is
automatically searched when installing. Just type
conda config --add channels conda-forge
.
If you have the Python Setup Tools, you can install the package from the source code either by downloading one of the Github releases or by cloning the latest development version in the NeXpy Git repository:
$ git clone https://github.com/nexpy/nexpy.git
Then use standard Python tools to build and/or install a distribution from within the source directory:
$ python -m build # build a distribution $ python -m pip install . # install the package
The Python API for reading and writing NeXus files is in a separate package, nexusformat, which is also available on PyPI and conda-forge.
If the NeXpy GUI is not required, the package may be used in any Python shell. It may be installed using:
$ pip install nexusformat
or:
$ conda install -c conda-forge nexusformat
The package can also be installed from the source code either by downloading one of the Github releases or by cloning the latest development version in the NeXpy Git repository:
$ git clone https://github.com/nexpy/nexusformat.git
NeXpy provides a GUI interface to the nexusformat API, which uses h5py to read and write HDF5 files that implement the NeXus data format standard. It does not use the NeXus C API, which means that the current version cannot read and write legacy HDF4 or XML NeXus files. One of the NeXus conversion utilities should be used to convert such files to HDF5.
If you only intend to utilize the Python API from the command-line, the only other required libraries are NumPy and SciPy. Autocompletion of group and field paths within an open file is available if IPython is installed.
Library | URL |
---|---|
nexusformat | https://github.com/nexpy/nexusformat |
h5py | https://www.h5py.org |
numpy | https://numpy.org/ |
scipy | https://scipy.org/ |
IPython | https://ipython.org/ |
The GUI is built using the PyQt. The qtpy package is used to import whatever PyQt library is installed, whether PyQt5, PyQt6, PySide2, or PySide6.
NeXpy embeds an IPython shell and Matplotlib plotting pane, within a Qt GUI based on the Jupyter QtConsole with an in-process kernel.
Least-squares fitting of 1D data uses the LMFIT package.
Library | URL |
---|---|
IPython | https://ipython.org/ |
qtconsole | https://qtconsole.readthedocs.io/ |
matplotlib | https://matplotlib.org/ |
lmfit | https://lmfit.github.io/lmfit-py/ |
pylatexenc | https://pylatexenc.readthedocs.io/ |
pillow | https://pillow.readthedocs.io/ |
ansi2html | https://pypi.python.org/pypi/ansi2html/ |
mplcursors | https://mplcursors.readthedocs.io/ |
Importers may require additional libraries to read the imported files in their native format, e.g., spec2nexus for reading SPEC files and FabIO for importing TIFF and CBF images.
From v0.9.1, a new 2D smoothing option is available in the list of
interpolations in the signal tab if astropy
is installed. It is labelled 'convolve' and provides, by default, a
2-pixel Gaussian smoothing of the data. The number of pixels can be
changed in the shell by setting plotview.smooth
.
Library | URL |
---|---|
fabio | https://pythonhosted.org/fabio/ |
spec2nexus | http://spec2nexus.readthedocs.org/ |
astropy | http://www.astropy.org/ |
Note
NeXpy should still run without these additional packages, but invoking the relevant menu items may trigger a warning.
To run from the installed location, add the $prefix/bin directory to your path if you installed outside the python installation, and then run:
$ nexpy [-r]
The -r option restores all files loaded in the previous session.
NeXpy uses Semantic Versioning.
Consult the NeXpy documentation for details of both the Python command-line API and how to use the NeXpy GUI. If you have any general questions concerning the use of NeXpy, please address them to the NeXus Mailing List. If you discover any bugs, please submit a Github issue, preferably with relevant tracebacks.
The NeXus format for neutron, x-ray and muon data is developed by an international collaboration under the supervision of the NeXus International Advisory Committee. The Python tree API used in NeXpy was originally developed by Paul Kienzle, who also wrote the standard Python interface to the NeXus C-API. The original version of NeXpy was initially developed by Boyana Norris, Jason Sarich, and Daniel Lowell, and Ray Osborn using wxPython, and formed the inspiration for the current PyQt version. I am grateful to Tom Schoonjans for installing the packages on conda-forge.