Difference between revisions of "Mas data.pro"
Line 1: | Line 1: | ||
+ | {{obsolete|mce_data.py}} | ||
'''mas_data.pro''' contains the IDL function 'mas_data', which handles the loading of MCE flat file data into the IDL environment. It can be used interactively to examine data, and 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 but do require them to be present. | '''mas_data.pro''' contains the IDL function 'mas_data', which handles the loading of MCE flat file data into the IDL environment. It can be used interactively to examine data, and 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 but do require them to be present. | ||
Latest revision as of 16:55, 7 December 2016
- The following describes an obsolete procedure or component. See mce_data.py for a more recent alternative.
mas_data.pro contains the IDL function 'mas_data', which handles the loading of MCE flat file data into the IDL environment. It can be used interactively to examine data, and 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 but do require them to be present.
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.
Contents
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
Basic 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.
Limit to frame range
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]
Frame structure information
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>, 16 tags, length=76, data length=76, refs=1: VERSION LONG 6 ROW_LEN LONG 100 NUM_ROWS_REP LONG 33 DATA_RATE LONG 38 NUM_ROWS LONG 33 RAMP_ADDRESS LONG 458785 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
Time-varying header information
To obtain the (potentially) time-varying fields from the data header, pass an variable to the header_data keyword:
IDL> d = mas_data('1216245537_bc1_step',header_data=header_data) IDL> help,header_data,/struct ** Structure <8322bec>, 4 tags, length=160000, data length=160000, refs=1: FRAME_CTR LONG Array[10000] ADDRESS0_CTR LONG Array[10000] RAMP_VALUE LONG Array[10000] SYNC_BOX_NUM LONG Array[10000]
Data mode and the runfile
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)
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.
Mixed-mode data
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 mixed modes, the signal that is assigned to the primary signal is the first one to appear in this list:
- Filtered feedback
- Unfiltered feedback
- Flux-jump counter
- Co-added error
The other signal is assigned to data2. So in data mode 4, for example, the primary signal is the sq1 feedback while the co-added error is exposed through data2.