IDL EPICS Classes

Mark Rivers

Contents


Overview

This document describes a set of IDL classes which have been written for use with EPICS. These classes presently provide support for the motor, scaler and MCA records. There are some significant advantages of using classes (i.e. objects) to access these devices, rather than simply a set of subroutines:

This is an early release of the EPICS class library. There are likely to be modifications as experience is gained with the interface.


EPICS motor class

Object creation

New objects of class EPICS_MOTOR are created with the standard IDL obj_new() function as follows:
IDL> motor = obj_new('EPICS_MOTOR', pvname)
where pvname is the name of an EPICS motor record. pvname can include a field name which will be stripped off. For example '13IDA:Slit_Pos' and '13IDL:Slit_Pos.DESC' are both valid. This makes it convenient when dragging process variable names from MEDM windows to IDL windows.

When creating a new motor object with obj_new() the resulting object reference can be checked with obj_valid() to make sure that the object was created successfully.

When a new EPICS_MOTOR object is created the initialization function EPICS_MOTOR::INIT() is called automatically. For efficiency it sets channel access monitors on all of the record fields which the object methods read.

The following example shows how easy it is to create a new motor object and use it:

IDL> motor = obj_new('EPICS_MOTOR', '13IDA:Slit_Pos')
IDL> motor->move, 10.   ; Move to absolute position 10.
IDL> motor->wait        ; Wait for it to get there

The methods provided by the EPICS_MOTOR class are described in detail in the EPICS_MOTOR Class Reference.

The files for the EPICS_MOTOR class are available in the file epics_classes.tar


EPICS scaler class

Object creation

New objects of class EPICS_SCALER are created with the standard IDL obj_new() function as follows:
IDL> scaler = obj_new('EPICS_SCALER', pvname)
where pvname is the name of an EPICS scaler record. pvname can include a field name which will be stripped off. For example '13IDC:scaler1' and '13IDC:scaler1.S2' are both valid. This makes it convenient when dragging process variable names from MEDM windows to IDL windows.

When creating a new scaler object with obj_new() the resulting object reference can be checked with obj_valid() to make sure that the object was created successfully.

When a new EPICS_SCALER object is created the initialization function EPICS_SCALER::INIT() is called automatically. For efficiency it sets channel access monitors on all of the record fields which the object methods read.

The following example shows how easy it is to create a new scaler object and use it:

IDL> scaler = obj_new('EPICS_SCALER', '13IDA:Slit_Pos')
IDL> scaler->start, 10.      ; Start counting for 10 seconds
IDL> scaler->wait            ; Wait for it to finish
IDL> counts = scaler->read() ; Read out the counts on each channel

The methods provided by the EPICS_SCALER class are described in detail in the EPICS_SCALER Class Reference.

The files for the EPICS_SCALER class are available in the file epics_classes.tar


MCA class

This class is a device independent class. The MCA class itself is most commonly used for reading data from disk files. More importantly, this class is the superclass of the EPICS MCA class.

Object creation

New objects of class MCA are created with the standard IDL obj_new() function as follows:
IDL> mca = obj_new('MCA')

obj_new() always succeeds when creating MCA objects.

The following example shows how easy it is to create a new MCA object and use it:

IDL> mca = obj_new('MCA')
IDL> mca->READ_FILE, 'mca.001'  ; Read a disk file
IDL> data = mca->GET_DATA()
IDL> energy = mca->CHAN_TO_ENERGY(findgen(mca->GET_NCHANS()))
IDL> plot, energy, counts

The methods provided by the MCA class are described in detail in the MCA Class Reference.

The files for the MCA class are available in the file idl_mca.tar


EPICS MCA class

This is the device dependent MCA class. It uses the EPICS MCA record. The EPICS_MCA class is a subclass of MCA, and so all methods defined for the MCA class are also valid for EPICS_MCA.

Object creation

New objects of class EPICS_MCA are created with the standard IDL obj_new() function as follows:
IDL> mca = obj_new('EPICS_MCA', pvname)
where pvname is the name of an EPICS MCA record. pvname can include a field name which will be stripped off. For example '13IDC:mca1' and '13IDC:mca1.DESC' are both valid. This makes it convenient when dragging process variable names from MEDM windows to IDL windows.

When creating a new EPICS_MCA object with obj_new() the resulting object reference can be checked with obj_valid() to make sure that the object was created successfully.

When a new EPICS_MCA object is created the initialization function EPICS_MCA::INIT() is called automatically. For efficiency it sets channel access monitors on all of the record fields which the object methods read.

The following example shows how easy it is to create a new EPICS_MCA object and use it:

IDL> mca = obj_new('EPICS_MCA', '13IDC:mca1')
IDL> mca->erase             ; Erase the spectrum
IDL> mca->acquire_on        ; Turn on acquisition
IDL> data = mca->get_data() ; Read the counts

The methods provided by the EPICS_MCA class are described in detail in the EPICS_MCA Class Reference.

The files for the EPICS_MCA class are available in the file idl_mca.tar

Multi-element detector (MED) class

This class is a device independent class. The MED class is basically a collection of MCA objects. Its methods generally simply apply the MCA class methods to each MCA object in the collection. The MED class itself is most commonly used for reading data from disk files. More importantly, this class is the superclass of the EPICS MED class.

Object creation

New objects of class MED are created with the standard IDL obj_new() function as follows:
IDL> mca = obj_new('MED', n_detectors)  ; n_detectors defaults to 13

obj_new() always succeeds when creating MED objects.

The following example shows how easy it is to create a new MED object and use it:

IDL> med = obj_new('MED')
IDL> med->READ_FILE, 'med.001'  ; Read a disk file
IDL> data = med->GET_DATA()
IDL> plot, data[*,0]
IDL> oplot, data[*,1]

The methods provided by the MED class are described in detail in the MED Class Reference.

The files for the MED class are available in the file idl_mca.tar


EPICS MED class

This is the device dependent MED class. It uses an EPICS MED database. The EPICS_MED class is a subclass of MED, and so all methods defined for the MED class are also valid for EPICS_MED.

Object creation

New objects of class EPICS_MED are created with the standard IDL obj_new() function as follows:
IDL> med = obj_new('EPICS_MED', prefix)
where prefix is the prefix of the EPICS MED database.

When creating a new EPICS_MED object with obj_new() the resulting object reference can be checked with obj_valid() to make sure that the object was created successfully.

When a new EPICS_MED object is created the initialization function EPICS_MED::INIT() is called automatically. For efficiency it sets channel access monitors on all of the record fields which the object methods read.

The following example shows how easy it is to create a new EPICS_MED object and use it:

IDL> med = obj_new('EPICS_MED', '13IDC:med:')
IDL> med->erase             ; Erase the spectrum
IDL> med->acquire_on        ; Turn on acquisition
IDL> data = med->get_data() ; Read the counts

The methods provided by the MED class are described in detail in the EPICS_MED Class Reference.

The files for the EPICS_MED class are available in the file idl_mca.tar


JCPDS class

This class is used to contain powder diffraction information. It is used by the IDL MCA display program for displaying diffraction lines. It can be used to compute diffraction line positions at high pressure and temperature.

Object creation

New objects of class JCPDS are created with the standard IDL obj_new() function as follows:
IDL> jcpds = obj_new('JCPDS')

When creating a new JCPDS object with obj_new() the resulting object reference can be checked with obj_valid() to make sure that the object was created successfully.

The following example shows how easy it is to create a new JCPDS object and use it:

IDL> jcpds = obj_new('JCPDS')
IDL> jcpds->read_file('alumina.jcpds')  ; Read a file into the object

The methods provided by the JCPDS class are described in detail in the JCPDS Class Reference.

The IDL files for the JCPDS class are available in the file idl_mca.tar

The data files for the GSECARS JCPDS database are available in the file jcpds.tar


Release Notes

The class reference for each of the classes contains up-to date documentation and release note information.

Version 1.0, October 3, 1997.

First public release of class library.

Version 2.0, April 7, 2000.

Added JCPDS class.

Version 3.0, February 27, 2001.

Broke up distribution into 3 separate tar files, epics_classes.tar, idl_mca.tar, jcpds.tar.

 


Future Additions

There are many features of the motor and scaler records which the IDL class libraries do not yet support. These features will be added as we find the need or in response to requests from others.


Suggestions and comments to: Mark Rivers : (rivers@cars.uchicago.edu)
Last modified: February 27, 2001