The major components of relax

Each of the boxes in Figure 13.1 represents a different grouping of code.

relax:
The top level module. This initialises the entire program, tests the dependencies, sets up the multi-processor framework and specific processor fabric, and prints the program's introduction message.
Command line arguments:
This code processes the arguments supplied to the program and decides whether to print the help message, initialise the prompt, execute a script, initialise a different UI, run the program in test mode, or run the program as a slave thread.
Prompt:
The user interface consisting of highly modified Python prompt. The namespace of the interpreter contains the various user functions which are front ends to the functional code. The auto-generated user function front end tests the supplied arguments to make sure they are of the correct type (string, integer, list, or any other type) before sending the values to the functional code. The code for the prompt is located in the prompt/ directory and the user function front ends in the user_functions/ directory.
Script:
If a script is supplied on the command line or executed within another user interface it will be run in the same namespace as that of the prompt. Hence the script has access to all the user functions available at the relax prompt. This allows commands which are typed at the prompt to be pasted directly and unmodified into a text file to be run as a script. The code sits alongside the prompt user interface in the prompt/ directory.
GUI:
The graphical user interface code base is located in the gui/ directory. It is implemented using wxPython so that relax uses the native widgets of the operating system.
Other interfaces:
Any number of interfaces (for example a web-based interface or an ncurses interface) could be added to relax with minimal modification of the rest of relax. This must be, without question, developed within the relax source code repository otherwise the code will not be maintainable in the future and will be almost impossible to merge back into relax later on. Due to the almost complete test suite coverage, relax is continually being refactored for modularity, flexibility, and speed hence any out-of-tree code that is not safeguarded by the test suite will quickly suffer bit-rot and depreciate in a short period of time.
Pipe control code:
This code includes classes and functions which are independent of the UI and not specific to a certain data pipe type or `specific analysis'. Pipe control is about managing the relax data store and it is located in the pipe_control/ directory.
Specific analyses API:
This is the code which is specific to the data pipe type - model-free analysis, relaxation curve-fitting, reduced spectral density mapping, the NOE calculation, consistency testing, the N-state or ensemble model analysis, relaxation dispersion, and the frame order analysis. Each type is located in a separate directory (Python package) within the specific_analyses/ directory.
The relax library:
This is a diverse collection of functions located within the lib/ directory. Most independent functions that do not touch the relax data store or are not part of the internal relax API should be located within the relax library. This standalone library can be used independently of relax and it is used by all parts of relax. The relax data store combined with the relax library creates a development environment rivalling Mathematica, Matlab, Maxima, Octave, etc. but with a strong focus on NMR. This includes support for handling 3D molecular structures (or no structure), spectral data input, NMR phenomenon and many mathematics functions specific for NMR, and data visualization.
Target functions:
This is reserved for CPU intensive code involved in optimisations and calculations. Most of relax's execution time when performing an analysis is spent here. An optimisation algorithm feeds in different parameter values into a `target function' in its attempt to minimise the single value returned by that target function (often a χ2 value). The code may be written in Python however C code can be used to increase the speed of the calculations. Note that good design and the use of numpy can be orders of magnitude more important for speed than the choice of programming language. For optimisation the code can include function evaluations, calculation of gradients, and calculation of Hessians. These functions are located in the target_functions/ directory.
Data:
The program state is stored in the relax data store singleton object. This class contains all the program data and is accessed solely by the pipe control and specific analysis code. The data structures are located in the data_store/ directory. Note that some temporary program execution information is stored in the relax status singleton object (located in status.py).

The relax user manual (PDF), created 2020-08-26.