Installation

Requirements

MARXS has few hard requirements:

Numpy and astropy are best installed with a package manager such as conda. See the astropy installation instructions for a detailed discussion. transforms3d is easily installed with:

.. code-block:: bash

$ pip install transforms3d

The following Python packages are strongly recommended, but most parts of MARXS will work without them:

Again, all but mayavi are available through common package managers such as conda, apt-get etc. For mayavi see the mayavi installation instructions.

In addition MARXS has an interface to the classic marx C code used to simulate the Chandra mirrors (classic marx C code).

Install the python code

setup.py

To download the latest development version of MARXS:

$ git clone https://github.com/Chandra-MARXS/marxs.git
$ cd marxs

Now you install, run tests or build the documentation:

$ python setup.py install
$ python setup.py test
$ python setup.py build_docs

If you want to contribute to MARXS, but are not familiar with Python or git or Astropy yet, please have a look at the Astropy developer documentation.

classic marx C code

The classic marx code is an optional dependency. By default, it is not used and all modules build on classic marx will be unavailable.

In order to build the interface to the classic marx C code, you need to set the path to the classic marx source code and an installed version of classic marx on your machine in the setup.cfg file in the root directory of the installation package before you call python setup.py install in the root directory of the MARXS distribution.

The current classic marx default setup compiles static libraries, not shared objects. Static libraries are a tiny bit better in performance at the cost of extra difficulty of linking them into shared objects. Since classic marx is not meant to be used a library for external functions (like this python module), the default installation settings are tuned for performance. On some architectures (tested on 32-bit Ubuntu GNU/Linux) linking the static libraries works, on others you might see an error like this: relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC. In that case, simply recompile and install classic marx as position independent code (PIC). In the classic marx source code directory:

.. code-block:: bash

$ make distclean $ ./configure –prefix=/path/to/your/instalation/ CFLAGS=”-O2 -g -fPIC” $ make clean $ make $ make install

I promise that the performance difference is so small, you won’t notice it when you run the classic marx version, but it allows the setup process of this python module to compile the interface to use those libraries.