refnx has been tested on Python 3.5, 3.6 and 3.7. It requires the numpy, scipy, cython packages to work. Additional features require the pytest, h5py, xlrd, uncertainties, ptemcee, matplotlib, Jupyter, ipywidgets, traitlets, tqdm, pandas, pyqt, periodictable packages. To build the bleeding edge code you will need to have access to a C-compiler to build a couple of Python extensions. C-compilers should be installed on Linux. On OSX you will need to install Xcode and the command line tools. On Windows you will need to install the correct Visual Studio compiler for your Python version.
Installation into a conda environment¶
Perhaps the easiest way to create a scientific computing environment is to use the miniconda package manager. Once conda has been installed the first step is to create a conda environment.
Creating a conda environment¶
In a shell window create a conda environment and install the dependencies. The -n flag indicates that the environment is called refnx.
conda create -n refnx python=3.7 numpy scipy cython pandas h5py xlrd pytest
Activate the environment that we’re going to be working in:
# on OSX source activate refnx # on windows activate refnx
Install the remaining dependencies:
pip install uncertainties ptemcee
Installing from source¶
The latest source code can be obtained from github. You can also build the package from within the refnx git repository (see later in this document).
In a shell window navigate into the source directory and build the package. If you are on Windows you’ll need to start a Visual Studio command window.
pip install .
Run the tests, they should all work.
python setup.py test
Installing into a conda environment from a released version¶
There are pre-built versions on conda-forge:
conda install -c conda-forge refnx
Start up a Python interpreter and make sure the tests run:
>>> import refnx >>> refnx.test()