Multi-element Detector (MED) Class

This page was created by the IDL library routine mk_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? mk_html_help

at the IDL command line prompt.

Last modified: Thu Apr 18 11:52:38 2013.


List of Routines


Routine Descriptions

MED::ADD_ROI

[Next Routine] [List of Routines]
 NAME:
       MED::ADD_ROI

 PURPOSE:
       This function adds a new region-of-interest to each MCA in the MED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       med->ADD_ROI, Roi, /ENERGY

 INPUTS:
       Roi:  A structure of type MCA_ROI which defines the ROI to be added.

 KEYWORD PARAMETERS:
       ENERGY: Set this keyword if the .LEFT and .RIGHT fields in the ROI
               are defined in energy rather than in channel numbers.  This
               is very useful when defining ROIs when the calibration
               parameters for each MCA in the MED are not identical.

 PROCEDURE:
       This function simply invokes MCA::ADD_ROI for each MCA in the MED.

 ADDITIONAL INFORMATION:
       See MCA::ADD_ROI.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::COPY_ROIS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      MED::COPY_ROIS

 PURPOSE:
       This procedure copies the ROIs defined for one MCA in the MED to all of
       the other MCAs.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       med->COPY_ROIS, Detector, /ENERGY

 INPUTS:
       Detector:  The number of the detector (MCA) from which the ROIs are to
                  be copied.  This number ranges from 1 to self.n_detectors.
                  The default is detector 1.

 KEYWORD PARAMETERS:
       ENERGY: Set this keyword if the ROIs should be copied by their position
               in energy rather than in channels. This is very useful when
               copying ROIs when the calibration parameters for each MCA in
               the MED are not identical.

 PROCEDURE:
       This function invokes MCA::GET_ROIS on the specified detector
       and then MED::SET_ROIS.

 ADDITIONAL INFORMATION:
       See MCA::SET_ROIS.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::DEL_ROI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::DEL_ROI

 PURPOSE:
       This function deletes a region-of-interest from each MCA in the MED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       med->DEL_ROI, Index

 INPUTS:
       Index:  The index of the ROI to delete in the range 0 to
               self.MAX_ROIS-1

 PROCEDURE:
       This function simply invokes MCA::DEL_ROI for each MCA in the MED.

 ADDITIONAL INFORMATION:
       See MCA::DEL_ROI.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::FINAL_CALIBRATION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::FINAL_CALIBRATION

 PURPOSE:
       This procedure does a final energy calibration for each MCA in the
       MED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:

       med->FINAL_CALIBRATION, Peaks

 INPUTS:
       Peaks:  An array of structures of type MCA_PEAKS containing the
               information on the peaks to be fit.  This array is typically
               read from a disk file with function READ_PEAKS().

 PROCEDURE:
       This function simply invokes MCA::FINAL_CALIBRATION for each MCA in
       the MED.

 ADDITIONAL INFORMATION:
       See MCA::FINAL_CALIBRATION.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::GET_CALIBRATION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::GET_CALIBRATION

 PURPOSE:
       This function returns the calibration parameters for the MED.
       The calibration information is contained in an array of structures
       of type MCA_CALIBRATION.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       Result = med->GET_CALIBRATION()

 OUTPUTS:
       This function returns an array of structures of type MCA_CALIBRATION.

 PROCEDURE:
       This function simply invokes MCA::GET_CALIBRATION for each MCA in the
       MED and stores the results in the returned array.

 ADDITIONAL INFORMATION:
       See MCA::GET_CALIBRATION().

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::GET_DATA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::GET_DATA

 PURPOSE:
       This function returns the data from the each MCA in the MED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       Result = med->GET_DATA(/TOTAL, /ALIGN)

 KEYWORD PARAMETERS:
       TOTAL:  Set this keyword to return the sum of the spectra from all
               of the MCAs.

       ALIGN: Set this keyword to return spectra which have been shifted and
               and stretched to match the energy calibration parameters of the
               first detector.  This permits doing arithmetic on a
               "channel-by-channel" basis. This keyword can be used alone
               or together with the TOTAL keyword, in which case the data
               are aligned before summing.

 OUTPUTS:
       By default this function returns a long 2-D array of counts dimensioned
       [self.nchans, self.n_detectors]

       If the TOTAL keyword is set then the function returns a long 1-D array
       dimensioned [self.nchans].

 PROCEDURE:
       This function simply invokes MCA::GET_DATA for each MCA in the MED and
       stores the results in the returned array.  If the ALIGN keyword is
       specified then all spectra except the first are shifted and stretched
       using IDL's POLY_2D procedure to match the energy calibration
       parameters of the first detector.

 ADDITIONAL INFORMATION:
       See MCA::GET_DATA().

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998
       Mark Rivers Nov. 24, 1998.  Added MIN_SLOPE to prevent divide by 0

(See med__define.pro)


MED::GET_ELAPSED

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::GET_ELAPSED

 PURPOSE:
       This function returns the elapsed parameters for the MED.
       The elapsed information is contained in an array of structures of type
       MCA_ELAPSED.

 CATEGORY:
       EPICS device class library.

 CALLING SEQUENCE:
       Result = med->GET_ELAPSED()

 OUTPUTS:
       This function returns an array of structures of type MCA_ELAPSED.

 PROCEDURE:
       This function simply invokes MCA::GET_ELAPSED for each MCA in the MED
       and stores the results in the returned array.

 ADDITIONAL INFORMATION:
       See MCA::GET_ELAPSED().

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::GET_ENERGY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::GET_ENERGY

 PURPOSE:
       This function returns a 2-D array containing the energy scale for
       each MCA in the MED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       Result = med->GET_ENERGY()

 OUTPUTS:
       This function returns a 2-D float array, dimensioned
       [self.nchans, self.n_detectors]

 PROCEDURE:
       This function simply invokes MCA::GET_ENERGY for each MCA in the
       MED and stores the results in the returned array.

 ADDITIONAL INFORMATION:
       See MCA::GET_ENERGY().

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 27, 1998

(See med__define.pro)


MED::GET_MCA_OBJECTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::GET_MCA_OBJECTS

 PURPOSE:
       This function returns the object pointers to the MCA objects in the
       MED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       Result = med->GET_MCA_OBJECTS()

 OUTPUTS:
       This function returns an array of object pointers to the MCA objects
       in the MED.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 27, 1998

(See med__define.pro)


MED::GET_PRESETS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::GET_PRESETS

 PURPOSE:
       This function returns the preset parameters for each MCA in the MED.
       The preset information is contained in an array of structures of type
       MCA_PRESETS.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       Result = med->GET_PRESETS()

 PROCEDURE:
       This function simply invokes MCA::GET_PRESETS for each MCA in the MED
       and stores the output in the returned array.

 ADDITIONAL INFORMATION:
       See MCA::GET_PRESETS().

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::GET_ROIS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::GET_ROIS

 PURPOSE:
       This function returns the region-of-interest information for each MCA
       in the MED. The ROI information is contained in an array of structures
       of type MCA_ROI.  Additional information about the number of ROIs
       defined for each MCA is returned in an array of structures of type
       MCA_ROI_INFO.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       Result = med->GET_ROIS(Roi_Info, /ENERGY)

 OUTPUTS:
       This function returns a 2-D array of structures of type MCA_ROI.  The
       dimensions of this array are [self.n_detectors, self.MAX_ROIS].

       Roi_Info: This optional output is an array of structures of type
                 MCA_ROI_INFO which contains information on the number of
                 rois defined for each MCA.

 PROCEDURE:
       This function simply invokes MCA::GET_ROIS for each MCA in the MED
       and stores the results in the returned arrays.

 ADDITIONAL INFORMATION:
       See MCA::GET_ROIS().

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::GET_ROI_COUNTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::GET_ROI_COUNTS

 PURPOSE:
       This procedures returns the net and total counts for each ROI in each
       MCA in the MED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       med->GET_ROI_COUNTS, Total, Net

 OUTPUTS:
       Total:  A 2-D array dimensioned [self.MAX_ROIS, self.n_detectors]
               containing the total counts in each ROI for each MCA.
       Net:    A 2-D array dimensioned [self.MAX_ROIS, self.n_detectors]
               containing the net counts in each ROI for each MCA.

 PROCEDURE:
       This function simply invokes MCA::GET_ROI_COUNTS for each MCA in the MED
       and stores the results in the returned arrays.

 ADDITIONAL INFORMATION:
       See MCA::GET_ROI_COUNTS().

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::GET_SEQUENCE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::GET_SEQUENCE

 PURPOSE:
       This function returns the current sequence number for each MCA in the
       MED.  Sequences are used for time resolved spectroscopy, and refer to
       different regions of MCA memory for data acquistion and readout.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       Result = med->GET_SEQUENCE()

 OUTPUTS:
       This function returns a long array containing the current sequence
       number of each MCA in the MED.

 PROCEDURE:
       This function simply invokes MCA::GET_SEQUENCE for each MCA in the MED
       and stores the result in the returned array.

 ADDITIONAL INFORMATION:
       See MCA::GET_SEQUENCE.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::INIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::INIT

 PURPOSE:
       This is the initialization code which is invoked when a new object of
       type MED is created.  It cannot be called directly, but only
       indirectly by the IDL OBJ_NEW() function.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       Result = OBJ_NEW('MED', N_detectors)

 INPUTS:
       N_detectors:  The number of detectors (MCA objects) in this MED.
                     The default is 13.

 OUTPUTS:
       This function always returns a 1 to indicate that it succeeded.

 RESTRICTIONS:
       This routine cannot be called directly.  It is called indirectly when
       creating a new object of class MED by the IDL OBJ_NEW()
       function.

 EXAMPLE:
       med = obj_new('MED', 15)

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::INITIAL_CALIBRATION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::INITIAL_CALIBRATION

 PURPOSE:
       This procedure does an initial energy calibration for each MCA in the
       MED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:

       med->INITIAL_CALIBRATION, Energy

 INPUTS:
       Energy:  The energy of the largest peak in the spectrum.

 PROCEDURE:
       This function simply invokes MCA::INITIAL_CALIBRATION for each MCA in
       the MED.

 ADDITIONAL INFORMATION:
       See MCA::INITIAL_CALIBRATION.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998
       04-APR-2000 MLR Read data before doing calibration

(See med__define.pro)


MED::READ_FILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::READ_FILE

 PURPOSE:
       This procedure reads a disk file into an MED object.  The file format
       is a tagged ASCII format.  The file contains the information from the
       MED object which it makes sense to store permanently, but does not
       contain all of the internal state information for the MCA.  This
       procedure reads files written with MED::WRITE_FILE.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:

       med->READ_FILE, File

 INPUTS:
       File:  The name of the disk file to read.

 OUTPUTS:
       None

 EXAMPLE:
       med = obj_new('MED')
       med->read_file, 'med.001'

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 29, 1998
       28-SEP-1998  MLR  Made common MCA_READ_FILE routine called by
                         MED::READ_FILE and MCA::READ_FILE
       18-NOV-1998  MLR  Added Environment to MCA_READ_FILE call
       24-NOV-1998  MLR  Corrected logic when med has fewer detectors than
                         the data file has.
       21-SEP-2001  MLR  Added set_name for each mca.

(See med__define.pro)


MED::SET_CALIBRATION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::SET_CALIBRATION

 PURPOSE:
       This procedure sets the calibration parameters for the MED.
       The calibration information is contained in a structure or an array
       of structures of type MCA_CALIBRATION.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:

       med->SET_CALIBRATION, Calibration

 INPUTS:
       Calibration:  A single structure or an array of structures of type
                     MCA_CALIBRATION containing the calibration parameters
                     for each MCA.  If a single structure is passed then this
                     is written to each MCA.  If an array of structures is
                     passed then Calibration[i] is written to MCA[i].

 PROCEDURE:
       This function simply invokes MCA::SET_CALIBRATION for each MCA in the
       MED.

 ADDITIONAL INFORMATION:
       See MCA::SET_CALIBRATION.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::SET_DATA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::SET_DATA

 PURPOSE:
       This procedure writes data to each MCA in the MED

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       med->SET_DATA, Data

 INPUTS:
       Data:
          Data to be written.  Dimensions are either [NCHANS], in which case
          the same data are written to each detector, or [NCHANS, NDETECTORS], in
          which case Data[*,i] is written to detector i.

 PROCEDURE:
       This procedure simply invokes MCA::SET_DATA for each MCA in the MED.

 ADDITIONAL INFORMATION:
       See MCA::GET_DATA().

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Nov. 16, 2003

(See med__define.pro)


MED::SET_ELAPSED

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       MED::SET_ELAPSED

 PURPOSE:
       This procedure set the elapsed parameters for the MED.
       The elapsed information is contained in a structure or an array of
       structures of type MCA_ELAPSED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       med->SET_ELAPSED(), Elapsed

 INPUTS:
       Elapsed:  A single structure or an array of structures of type
                 MCA_ELAPSED containing the elapsed parameters for each MCA.
                 If a single structure is passed then this is written to
                 each MCA.  If an array of structures is passed then
                 Elapsed[i] is written to MCA[i].

 PROCEDURE:
       This function simply invokes MCA::SET_ELAPSED for each MCA in the MED.

 ADDITIONAL INFORMATION:
       See MCA::SET_ELAPSED().

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED::SET_PRESETS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      MED::SET_PRESETS

 PURPOSE:
       This procedure sets the preset parameters for each MCA in the MED.
       The preset information is contained in a structure or array of
       structure of type MCA_PRESETS.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       med->SET_PRESETS, Presets

 INPUTS:
       Presets:  A single structure or an array of structures of type
                 MCA_PRESETS containing the preset parameters for each MCA.
                 If a single structure is passed then this is written to
                 each MCA.  If an array of structures is passed then
                 Presets[i] is written to MCA[i].


 PROCEDURE:
       This function simply invokes MCA::SET_PRESETS for each MCA in the MED.

 ADDITIONAL INFORMATION:
       See MCA::SET_PRESETS.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 28, 1998

(See med__define.pro)


MED::SET_ROIS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      MED::SET_ROIS

 PURPOSE:
       This procedure sets the region-of-interest information for each MCA
       in the MED.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       med->SET_ROIS, Rois, /ENERGY

 INPUTS:
       Rois:  A 1-D or 2-D array of structures of type MCA_ROI.  If Rois is a
              1-D array then the same ROIs are written to each MCA in the
              MED.  If Rois is a 2-D array then Rois[*,i] is written to
              detector i. If this input parameter is missing or not defined
              then all ROIs in each MCA are cleared.

 KEYWORD PARAMETERS:
       ENERGY: Set this keyword if the .LEFT and .RIGHT fields in each ROI
               are defined in energy rather than in channel numbers.  This
               is very useful when defining ROIs when the calibration
               parameters for each MCA in the MED are not identical.

 PROCEDURE:
       This function simply invokes MCA::SET_ROIS for each MCA in the MED.

 ADDITIONAL INFORMATION:
       See MCA::SET_ROIS.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998
       18-NOV-1998 MLR Added support for Rois being 1-D or 2-D

(See med__define.pro)


MED::SET_SEQUENCE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      MED::SET_SEQUENCE

 PURPOSE:
       This procedure sets the current sequence number for each MCA in the
       MED.  Sequences are used for time resolved spectroscopy, and refer to
       different regions of MCA memory for data acquistion and readout.

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       med->SET_SEQUENCE, Sequence

 INPUTS:
       Sequence: A scalar or array of sequence numbers.
                 If a single sequence number is passed then this is written to
                 each MCA.  If an array of sequences is passed then
                 Sequence[i] is written to MCA[i].

 PROCEDURE:
       This function simply invokes MCA::SET_SEQUENCE for each MCA in the MED.

 ADDITIONAL INFORMATION:
       See MCA::SET_SEQUENCE.

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)


MED__DEFINE

[Previous Routine] [List of Routines]
 NAME:
       MED__DEFINE

 PURPOSE:
       This is the definition code which is invoked when a new object of
       type MED is created.  It cannot be called directly, but only
       indirectly by the IDL OBJ_NEW() function,

 CATEGORY:
       IDL device class library.

 CALLING SEQUENCE:
       Result = OBJ_NEW('MED', N_detectors)

 INPUTS:
       N_detectors:  The number of detectors (MCA objects) in this MED.
                     The default is 13.

 OUTPUTS:
       None (but see MED::INIT)

 RESTRICTIONS:
       This routine cannot be called directly.  It is called indirectly when
       creating a new object of class MED by the IDL OBJ_NEW()
       function.

 EXAMPLE:
       med = obj_new('MED', 15)

 MODIFICATION HISTORY:
       Written by:     Mark Rivers, Sept. 25, 1998

(See med__define.pro)