Home > reduc > alpha > calculateStokes.m

calculateStokes

PURPOSE ^

function d = calculateStokes(d,selection[,r])

SYNOPSIS ^

function d = calculateStokes(varargin)

DESCRIPTION ^

 function d = calculateStokes(d,selection[,r])
 Calculate Stokes parameters from the data.
 Specify r = [r1,r2], the r-parameters to be used with the classic time
 stream data if you want to use them. If no r is specified then values of
 1 are used.

 ogk 12 March 2012

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function d = calculateStokes(varargin)
0002 % function d = calculateStokes(d,selection[,r])
0003 % Calculate Stokes parameters from the data.
0004 % Specify r = [r1,r2], the r-parameters to be used with the classic time
0005 % stream data if you want to use them. If no r is specified then values of
0006 % 1 are used.
0007 %
0008 % ogk 12 March 2012
0009 %
0010 
0011 d = varargin{1};
0012 selection = varargin{2};
0013 if nargin == 2
0014     r = [1;1];
0015 else
0016     r = varargin{3};
0017 end
0018 
0019 if strcmp(selection,'CLASSIC')
0020     d = DD(d,r);
0021 end
0022 
0023 if strcmp(selection,'FILTERED')
0024     if d.antenna0.receiver.utc(1) < tstr2mjd('01-oct-2011:00:00:00')
0025         disp('calculateStokes:: Cannot apply FILTERED option to data before October 2011')
0026     else
0027         % Nothing to do in this case
0028     end
0029 end
0030 if strcmp(selection,'POLONLY')
0031     % Nothing to do in this case.
0032 end
0033 
0034 end
0035 
0036 function d = DD(d,r)
0037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0038 % This function calculates the instrument Stokes parameters from the
0039 % data register. The d.antenna0.receiver.data register is then updated
0040 % with the Stokes parameters. The columns of the data register are:
0041 % [I1 Q1 U1 Q2 U2 Q3 U3 I2]
0042 % where (Qi,Ui) are the linear Stokes set i.
0043 %
0044 % OGK, 13 Mar 2012
0045 %
0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0047 
0048 if size(d.antenna0.receiver.data,2) ~= 10
0049   display('calculateStokes::DD:: R-factor should not be applied to this data');
0050   display('calculateStokes::DD:: Either you are trying to do alpha PolOnly');
0051   display('calculateStokes::DD:: Or you need to run assembleAlphaStreams');
0052   display('calculateStokes::DD:: and applyAlpha with "CLASSIC" option.')
0053   return;
0054 end
0055 
0056 swd = d.antenna0.receiver.data;
0057 d.antenna0.receiver.data = zeros(size(d.antenna0.receiver.data,1),8);
0058 
0059 d.antenna0.receiver.data(:,1) = swd(:,1)-r(1)*swd(:,2);
0060 d.antenna0.receiver.data(:,8) = swd(:,9)-r(2)*swd(:,10);
0061 
0062 % Polarization products:
0063 d.antenna0.receiver.data(:,2) = swd(:,3);
0064 d.antenna0.receiver.data(:,3) = swd(:,4);
0065 d.antenna0.receiver.data(:,4) = swd(:,5);
0066 d.antenna0.receiver.data(:,5) = swd(:,6);
0067 d.antenna0.receiver.data(:,6) = swd(:,7);
0068 d.antenna0.receiver.data(:,7) = swd(:,8);
0069 
0070 end

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