MoDAS (Modular Data Acquisition System)
We developed MoDAS, a system that acquires, records, processes and displays data from our astronomical cameras in real-time.
MoDAS is used to record and monitor speckle images during our observations at different telescopes. With its data processing functions the system gives valuable information about data quality already during observation. MoDAS is also used for laboratory tests to improve the cameras, e.g., for image sensor characterization, noise analysis, etc.
The design of MoDAS is optimally adapted to the special needs of our activities. It has several key features:
- The data is put in by FireWire interface.
- Multiple cameras can run simultaneously.
- The software framework is modular.
- Data exchange allows multiple consumers.
- All processes access to shared data without blocking each other.
- Data handling is optimized for speed.
- There are real-time processing functions (power spectrum, histogram, bad pixel cosmetics, averaging, statistics, ...).
Data from one camera are sent via fiber optics to an interface box. This box receives and broadcasts the data to the FireWire bus (IEEE1394 serial bus) using one isochronous channel.
If more than one camera is used, multiple interface boxes can use the same FireWire bus. They send their data on different isochronous channels. Thus, any computer connected by FireWire can receive any of the data streams.
The interface boxes can be cascaded so that one camera can feed multiple boxes. Each interface box can transfer the data to a different FireWire bus, if this is desired.
The advantages of FireWire are:
- high speed
- easily available on notebook computers
- non-blocking broadcasting through isochronous channels
- isochronous channels provide guaranteed bandwidth
The software framework consists of:
- MODULES for data processing, e.g., acquisition, recording, displaying
- CHANNELS for interconnecting inputs and outputs of several modules
- FRAMES to be transported along channels and processed inside the modules
- a command structure to control the framework
In the context of MoDAS, a frame is a packet of connected data, e.g., the pixels of one complete image. It also includes auxiliary information like image dimensions, exposure time, etc. The size of a frame is variable. Frames appear locally inside modules or in channels between modules. MoDAS supports different types of frames depending on the nature of information they contain. However, all frame types have a set of common properties. Thus, a frame can be sent, transported and received without the need to know its type or content.
Channels are used to transport and distribute frames between modules. A channel arises from one output port of a sending module (one producer) and can serve multiple input ports of receiving modules (many consumers).
It is possible to subscibe to a certain number of frames in order to retrieve them at a later point in time. A channel holds a number of topical frames. A consumer can either fetch the oldest not-yet-fetched frame in the row, or can fetch the most recent one and skip frames that have possibly been issued since the last fetch. The former strategy is advisable for obtaining a complete sequence without loosing frames, e.g., for recording. The latter is for obtaining only the most recent frame, e.g., for displaying.
If a consumer is too slow to keep up with the rate, frames will be dropped at its input port. This effects neither the producer nor the other consumers connected to the channel. Channels are based on the Linux shared memory file system. They do not require dedicated processes.
Within MoDAS, there are independant processing units called modules. A typical module periodically reads a frame from a channel, applies an algorithm to it, produces a resulting frame and writes it out to a different channel. Every module is a specialist in its particular task. By chaining together modules, a data processing pipeline can be built up.
- Receiver: Acquires camera data from the FireWire interface and outputs frames of type CAM, a raw sequence of pixel values in the order they are produced by the readout electronics.
- Preparer: Inputs CAM-frames and outputs frames of type RAW, a well ordered sequence of pixel values to be adressed by x, y, z coordinates and a subwindow index. The pixel reordering depends on the special readout modes (e.g., multiple quadrants, multiple subwindows, rolling reset) and is detected automatically by the preparer.
- Differencer: Inputs RAW-frames and outputs frames of type DIF. Usually a RAW-Frame contains two (or even more) consecutive readouts of an imaging sensor. The first read has to be subtracted from the second one to get an usable image. In addition to subtracting, the differencer can also mask bad pixels.
- Recorder: Inputs RAW- or DIF-frames and records them on the file system.
- Display: Inputs CAM-, RAW- or DIF-frames and displays them on the screen. The display module is also able to calculate and show power spectra, long term images, histograms and statistics.
It is possible to run multiple instances of each module. Thus, it is possible to run multiple displays or recorders on the same or on different computers.
Concurrently to data operation, each module runs a command port in a seperate thread. This is used to change parameters and behavior during runtime.
By the use of internet sockets, a framework can extend over any desired network. Users can send commands to each module directly, if desired. This provides the maximum amount of flexibility. However, for most applications, there are graphical user interfaces to simplify the handling. When MoDAS is used for observations, the astronomer doesn't need to know about internal command structures.