EPICS csm Module


Götz Pfeiffer (HZB)
wrote the csm library
Ben Franksen (HZB)
wrote the cvtRecord


This module contains two parts: The first is a generic (EPICS-independent) library implementing one- and two-dimensional interpolation tables, including procedures to load and store them from a file system. The second is an EPICS record type specifically designed to make it easy to do conversion via interpolation table and other means. The cvtRecord uses the csm library to achieve conversion via tables.


You can download a release from the links in the table below, or get the latest development version via darcs:

darcs get http://www-csr.bessy.de/control/SoftDist/csm/repo/csm

You can also browse the repository.


For the csm library, have a look at the Doxygen generated API docs, otherwise see cvt - The Convert Record.

File Format

There are two kinds of table files accepted by the csm library: one-dimensional and two-dimensional. For both formats the file consists of a number of lines; each line must not be longer than 1023 bytes (including the line terminator(s)) for two-dimensional tables and 127 bytes for one-dimensional tables.

Lines that are empty (i.e. consist only of white space), or start with a ‘#’ byte (possibly preceded by white space) are silently ignored.

All other lines should consist of two or more elements, separated by (any positive amount of) white space (including tabs). Leading and trailing white space is ignored. The number of elements per line must not be greater than 512 for two-dimensional tables, and 2 for on-dimensional tables.

Elements are whatever scanf accepts when given the “%lf” format specifier, i.e. standard C floating point literals.

A one-dimensional table specifies a function of with one parameter. It must have exactly two elements per line. The first element is the X coordinate, the second the Y coordinate. The csm library has functions to convert in both directions (see csm_x and csm_y).

A two-dimensional table specifies a function with two parameters. The first line and the first column specify the XY-grid. The first line must have exactly one element less than the remaining lines; it specifies the Y coordinates of the grid. The first column (i.e. the first elements of the remaining lines) specify the X coordinates of the grid, while the remaining elements specify the value (Z coordinate) at the corresponding point in the grid (see csm_z).

Lines and columns can be specified in any order. Particularly, there is no need to specify them in ascending or descending order. However, for one-dimensional tables, the result is only well-defined if the table actually defines a function in the specified direction. That is, equal input coordinates should map to equal output coordinates. Also, for non-monotonic functions, csm_x is not the inverse of csm_y.


If you have any problems with this module, send a mail to one of the authors.

Table Of Contents

Previous topic

Site Map

Next topic

cvt - The Convert Record