Mas data.pro

From MCEWiki
Revision as of 12:47, 8 April 2008 by 24.84.194.46 (talk)

Overview

mas_data is an easy way to load MCE flat file data into the idl environment. It can be used interactively to examine data. When combined with mas_runfile and mas_runparam, it is powerful enough to use in IDL scripting appliations. Currently the auto-tuning scripts do not take full advantage of mas_data and mas_runfile.

mas_data.pro is located in the idl_pro/mas directory of the mce_script source tree. This folder should be in the users IDL_PATH environment variable.

Dependencies

For full functionality, mas_data requires the following functions, all located in idl_pro/mas:

mas_runfile.pro
mas_runparam.pro
extract_bitfield.pro

Example usage

The most basic usage is like this:

IDL> d = mas_data('1207679527_RCs_iv')
IDL> help,d
D               FLOAT     = Array[32, 33, 1000]

The resulting array contains the primary signal in the data (feedback or filtered feedback, except for data mode 0). The first index is column, the second index is row, and the third index is the frame index.

By default, all frames in the file are returned. To select a particular frame range, use the frame_range keyword:

IDL> d = mas_data('1207679527_RCs_iv', frame_range=[100,199])
IDL> help,d                                                  
D               FLOAT     = Array[32, 33, 100]

To return a structure containing important timing and frame structure information, pass a variable to the frame_info keyword:

IDL> d = mas_data('1207679527_RCs_iv', frame_info=frame_info)
IDL> help,frame_info,/struc
** Structure <823038c>, 14 tags, length=68, data length=68, refs=1:
   VERSION         LONG                 6
   ROW_LEN         LONG               100
   NUM_ROWS_REP    LONG                33
   DATA_RATE       LONG                38
   NUM_ROWS        LONG                33
   RC_PRESENT      LONG      Array[4]
   RC_COUNT        FLOAT           4.00000
   N_FRAMES        LONG              1000
   N_COLUMNS       FLOAT           32.0000
   N_ROWS          LONG                33
   DATA_MODE       LONG                 4
   FRAME_SIZE      LONG              1100
   DATA_SIZE       LONG              1056
   FOOTER_SIZE     LONG                 1
   DATA_OFFSET     LONG                43

In mixed data modes, the auxiliary data (typically the lower order bits) are returned in the variable data2. For example, with data taken in data mode 4, the lower 14 bits are the error signal:

IDL> d = mas_data('1207679527_RCs_iv', data2=err)  
IDL> help,err
ERR             FLOAT     = Array[32, 33, 1000]

In some data modes, the feedback and error signals as packed in the data are scaled relative to the magnitudes present in data modes 0 and 1. mas_data.pro will automatically rescale those signals to match the data_mode 0 or 1 ranges unless the /no_rescale keyword is specified. If you want the "raw" extracted values, use the /no_rescale keyword.

The data_mode is obtained from the runfile, which is assumed to have the same name as the data with '.run' appended. You can force mas_data to use a different runfile by passing the name of the file in the runfile_name keyword. You can prevent mas_data from reading a runfile using the /no_runfile switch. When no runfile is used, the data_mode defaults to 0 and the data returned are simply the raw 32 bit integers from the MCE frame. When /no_runfile is used, the data_mode can be specified using the data_mode keyword. For example, if data is taken in mode 5 without a runfile we can still load it:

IDL> d = mas_data('dm5_1234', data2=flux_jumps, data_mode=5, /no_runfile)