Chapter 9. RELACS for Programmers

This is an introduction about the RELACS internals that you need if you want to improve RELACS.

9.1. Directory Structure

  • numerics: Source code for dealing with arrays of numbers and events.

  • daq: Source code of classes closely related to the data acquisition: data classes for analog input and output, base classes for daq-drivers, attenuators and other devices.

  • options: Source code for dealing with strings and options.

  • datafile: Source code for dealing with ascii data files.

  • plot: Source code for plot widgets.

  • widgets: Source code for other widgets, mainly related to the options dialog.

  • relacs: Source code specific for RELACS.

  • src: The remaining RELACS source code.

  • plugins: RELACS plugins.

  • doc: Main documentation for RELACS and doxygen configuration file.

  • doc/html: The documentation of RELACS.

  • examples: Some example code for RELACS plugins (RePros).

  • utils: Some utility programs for RELACS.

  • dry: The directory used to store data from RePro's that are executed while no Session is started.

  • m4: Autoconf macros.

  • debian: Files needed for building a debian package.

9.2. The RELACS Makefiles

Each directory containing some source code has its own Makefile. You have the following options to invoke make:

  • make: Compile.

  • make install: Install RELACS.

  • make dist: Make a tar archive with a source code distribution.

  • make distcheck: Check a source code distro.

  • make clean: Clean up.

9.3. Naming Conventions

For conventions used for naming files, classes, functions, variables, etc. see Naming Conventions.

9.4. The Structure of RELACS

See the inheritance graph!

9.4.1. Analog Input

Through the AnalogInput interface Acquire::read() initializes analog input of the data acquisition devices. Acquire::readData() copies the acquired data from the hardware driver into instances of InData. Each InData describes and contains data fom a single analog input line. InList is a container for InData.

9.4.2. Events

After reading analog data, an EventDetector can be applied to each of the analog input traces in order to extract events (e.g. spikes). An event is a time relative to the beginning of data acquisition measured in seconds. It is also possible to associate a size and a width with each event. Events are stored in an EventData. All instances of EventData are accesible by EventList. The detectors are organized by the Detectors class. An EventDetector gets the analog data or a list of events as input from which it extracts the events. Some template functions for detecting events are defined in detector.h . They operate via iterators on the data (InputDataIterator, InputDiffIterator, OutputDataIterator, EventIterator, EventFrequencyIterator, EventSizeIterator).

9.4.3. Analog Output

An OutData specifies a stimulus for analog output. OutList is a container for OutData. Acquire::write() sends the stimulus to the data acquisition board via the AnalogOutput interface. It is possible in OutData to specify a stimulus intensity which is used to attenuate the voltage signal generated by the data acquisition board. Attenuation is implemented in a two step process. First, a class derived from Attenuate computes the desired attenuation level from the requested intensity. This class defines the units in which an intensity is given. Then a class derived from Attenuator gets the attenuation level and sets the attenuator device appropriately. This class serves as an interface to the hardware driver of an attenuator. The Attenuator devices are organized by the AttDevices class, all Attenuate interfaces are organized by the AttInterfaces class.

9.4.4. Options

Whenever variables (parameters) should be set by the user via a dialog (OptDialog, OptWidget) or a configuration file (Config, Configure), Options are used. A single option (Parameter) stores the value of the variable together with its name (identifier) and a default value. In addition, numbers have an error (e.g. standard deviation), a format string, minimum and maximum values, a step size, and an internal and an external unit; the latter is used for communication with the user. The Str class is an extension of the standard string class. It provides a lot of functions for manipulating strings, especially for handling numbers.

Datafile

TableKey defines a key to the columns of a table, TableData holds the content of table, and DataFile reads in data and metadata from a file. In translate.h functions are defined that replace tags in a string with the content of metadata or a table key.

Numerics

For handling arrays of numbers there are the template classes Array, Map, SampleData. Some basic algorithms can be found in stats.h, fourier transform algorithms in spectrum.h .

Plots

Plot displays data in a single plot. Multiple plots can be handled with MultiPlot.

Widgets

A few new widgets are defined in widgets/. For communication with the user to set data values there are the classes DoubleSpinBox, LCDRange, OptWidget and OptDialog. MessageBox opens a new window which displays a message.

Configuration

The Config class is the base class of all classes which contain Options that should be set by the user via the relacs config files or by dialogs (ConfigDialog). The configuration of the Config classes is managed by Configure.

RELACS Specific Classes

Plugins loads shared object files into the running programm. Special types of plugins are defined in relacsplugins.h (see also RELACS Plugins).

PlotTrace displays the read in data from the data acquisition board and the detected events.

RePro is the base class for all research programs which are organized by the RePros class. Several RePros can be summarized to a macro, which is handled by the Macros class.

User supplied widgets derived from Control control hardware, analyze data in parallel to the RePros, or display some general information about the recording.

RELACSWidget holds everything together.