Home > reduc > flag > convertDataFlagsToFlagSize.m

convertDataFlagsToFlagSize

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function dflags = convertDataFlagsToFlagSize(flags)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   function dflags = convertDataFlagsToFlagSize(flags)

   function that converts our flag data (whatever size it is) to the Nby3
   standard in the data reduction

   sjcm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function dflags = convertDataFlagsToFlagSize(flags)
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 %   function dflags = convertDataFlagsToFlagSize(flags)
0006 %
0007 %   function that converts our flag data (whatever size it is) to the Nby3
0008 %   standard in the data reduction
0009 %
0010 %   sjcm
0011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0012 
0013 if(isstruct(flags))
0014   % if it's a structure, do this
0015   NUMDIMS = size(flags.fast,2);
0016   
0017   dflags = flags;
0018   % first the bits, and only the regular flags
0019   bitfast = convSubFunc(flags.bit.fast, NUMDIMS);
0020   if(isfield(flags.bit, 'switch'))
0021     bitfast2 = convSubFunc(flags.bit.switch, 24);
0022     bitfast  = bitor(bitfast, bitfast2);
0023     dflags.bit = rmfield(dflags.bit, 'switch');
0024   end
0025   
0026   % next the regular deal
0027   fast = convSubFunc(flags.fast, NUMDIMS);
0028   if(isfield(flags, 'switch'))
0029     fast2 = convSubFunc(flags.bit.switch, 24);
0030     fast  = bitor(fast, fast2);
0031     dflags = rmfield(dflags, 'switch');
0032   end
0033   
0034   
0035   dflags.bit.fast = bitfast;
0036   dflags.fast = (bitfast | fast)>0;
0037 
0038 else
0039   % it's an array
0040   dflags = convSubFunc(flags, size(flags,2));
0041 end
0042 
0043   
0044   
0045 return;
0046 
0047 
0048 
0049 function sizedFlags = convSubFunc(origFlag, NUMDIMS)
0050 
0051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0052 %
0053 %  function sizedFlags = cloneSubFunc(origFlag, NUMDIMS)
0054 %
0055 %
0056 %   subfunction that gets the current flag data and puts it in the right
0057 %   size for the register
0058 %
0059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0060 
0061 
0062 
0063 
0064 switch NUMDIMS
0065   case 6
0066     thisFlag(:,1)   = origFlag(:,1);
0067     thisFlag(:,2)   = arrayBitor(origFlag(:,2:5));
0068     thisFlag(:,3)   = origFlag(:,6);
0069     
0070   case 8
0071     thisFlag(:,1)   = origFlag(:,1);
0072     thisFlag(:,2)   = arrayBitor(origFlag(:,2:7));
0073     thisFlag(:,3)   = origFlag(:,8);
0074     
0075   case 10
0076     thisFlag(:,1)   = arrayBitor(origFlag(:,1:2));
0077     thisFlag(:,2)   = arrayBitor(origFlag(:,3:8));
0078     thisFlag(:,3)   = arrayBitor(origFlag(:,9:10));
0079     
0080   case 24
0081     thisFlag(:,1)   = arrayBitor(origFlag(:,1:4));
0082     thisFlag(:,2)   = arrayBitor(origFlag(:,5:20));
0083     thisFlag(:,3)   = arrayBitor(origFlag(:,21:24));
0084     
0085 end
0086 
0087 sizedFlags = thisFlag;
0088 
0089 return;
0090 
0091

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005