%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function d = getIV(d,filter_mode) function that checks what steps of the pipeline was applied, and generates the IQUVs accordingly JL: Completely rewritten 21/02/2012: Previous behaviour: 1) Used to check logcal to see if pha / rfactor had been % applied individually or both. This would not have worked becuase both raftor and alpha routines must be called in the reduction to get the data in the correct column order (even if rfactor correction of 1) is applied. The current routine assumes both has beeen called Current behaviour: 1) Queuries input paramter filter_mode. This is passed in and should be identical to parm.filtered.flag, which is 1 for FILTERED data and 0 for CLASSIC data. 2) Then implements data output accoring to the OGK Nov 5. 2011 "NDMemo" document (used to be called low level calibration document. 3) The filtered = 0 CLASSIC mode is the same as previous and outputs to 8 columns i.e. [I Q1 U1 Q2 U2 Q3 U3 V] 4) The filtered = 1 FILTERED mode outputs 4 columns [I Q U V] 5) the 4 and 8 columns are then handled appropriately by writeFitsMap.m, cbass_write_fits.c and descart. the FITS header FITLERED = 0 or 1 can be exampined to see what format the data is in. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function d = getIV(d,filter_mode) 0002 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % function d = getIV(d,filter_mode) 0006 % 0007 % 0008 % function that checks what steps of the pipeline was applied, and 0009 % generates the IQUVs accordingly 0010 % 0011 % 0012 % JL: Completely rewritten 21/02/2012: 0013 % 0014 % Previous behaviour: 0015 % 0016 % 1) Used to check logcal to see if pha / rfactor had been % applied 0017 % individually or both. This would not have worked becuase both raftor 0018 % and alpha routines must be called in the reduction to get the data in 0019 % the correct column order (even if rfactor correction of 1) is applied. 0020 % The current routine assumes both has beeen called 0021 % 0022 % 0023 % Current behaviour: 0024 % 0025 % 1) Queuries input paramter filter_mode. This is passed in and should be identical to 0026 % parm.filtered.flag, which is 1 for FILTERED data and 0 for CLASSIC data. 0027 % 0028 % 2) Then implements data output accoring to the OGK Nov 5. 2011 "NDMemo" document 0029 % (used to be called low level calibration document. 0030 % 0031 % 3) The filtered = 0 CLASSIC mode is the same as previous and outputs to 8 columns i.e. 0032 % [I Q1 U1 Q2 U2 Q3 U3 V] 0033 % 0034 % 4) The filtered = 1 FILTERED mode outputs 4 columns [I Q U V] 0035 % 0036 % 5) the 4 and 8 columns are then handled appropriately by writeFitsMap.m, cbass_write_fits.c and descart. 0037 % the FITS header FITLERED = 0 or 1 can be exampined to see what format the data is in. 0038 % 0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0040 0041 % initialize variables 0042 I = []; 0043 0044 if(filter_mode==0) 0045 % data is CLASSIC 0046 % Using eqns (17) and (18) from NDmemo 0047 % while maintaining back compatibility i.e. 8 column output. 0048 0049 I1 = d.antenna0.receiver.data(:,1); 0050 I2 = d.antenna0.receiver.data(:,8); 0051 Q1 = d.antenna0.receiver.data(:,2); 0052 Q2 = d.antenna0.receiver.data(:,4); 0053 %Q3 = d.antenna0.receiver.data(:,6); 0054 U1 = d.antenna0.receiver.data(:,3); 0055 U2 = d.antenna0.receiver.data(:,5); 0056 %U3 = d.antenna0.receiver.data(:,7); 0057 d.antenna0.receiver.data = [I1 Q1 U1 Q2 U2 I2]; 0058 0059 elseif (filter_mode==1) 0060 % data is FILTERED 0061 % Using Eqn (19) from NDmemo 0062 % 0063 0064 I1 = d.antenna0.receiver.data(:,1); 0065 I2 = d.antenna0.receiver.data(:,8); 0066 Q1 = d.antenna0.receiver.data(:,2); 0067 Q2 = d.antenna0.receiver.data(:,4); 0068 %Q3 = d.antenna0.receiver.data(:,6); 0069 U1 = d.antenna0.receiver.data(:,3); 0070 U2 = d.antenna0.receiver.data(:,5); 0071 %U3 = d.antenna0.receiver.data(:,7); 0072 d.antenna0.receiver.data = [I1 Q1 U1 Q2 U2 I2]; 0073 0074 else 0075 error('getIV failed -> could not determine FILTERED parameter'); 0076 end 0077 0078 d = logcal(d, 'iv'); 0079 0080 return; 0081 0082 0083 0084 0085