Home > comms > raster.m

raster

PURPOSE ^

quick function to make a raster of a source when using the "beam_map.sch"

SYNOPSIS ^

function raster(d)

DESCRIPTION ^

 quick function to make a raster of a source when using the "beam_map.sch"
 schedule script.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function raster(d)
0002 % quick function to make a raster of a source when using the "beam_map.sch"
0003 % schedule script.
0004 
0005 % now we want to split the data into each scan.
0006 offsets = unique(d.antenna0.tracker.sky_xy_off, 'rows');
0007 noData = [];
0008 for m=1:size(offsets,1)
0009   ind = d.antenna0.tracker.sky_xy_off(:,1) == offsets(m,1) & d.antenna0.tracker.sky_xy_off(:,2)==offsets(m,2);
0010   indTrack = d.array.frame.features > 0;
0011   if(offsets(m,1)==0 & offsets(m,2)==0)
0012     indcenter = zeros(size(ind));
0013     indcenter(1:500) = 1;
0014     indcenter = ~indcenter;
0015     f = find(ind & indTrack & indcenter);
0016   else
0017     f = find(ind & indTrack);
0018   end
0019   
0020   if(~isempty(f))
0021     times = d.array.frame.utc(f(1):last(f));
0022     indRx = d.antenna0.receiver.utc>=times(1) & d.antenna0.receiver.utc<=last(times);
0023     rxVal(m,:) = mean(d.antenna0.receiver.dataNew(indRx,:));
0024     rxRms(m,:) = sqrt(var((d.antenna0.receiver.dataNew(indRx,:))));
0025   else 
0026     noData = [noData; f];
0027   end
0028   
0029 end
0030 
0031 if(~isempty(noData))
0032   offsets(noData) = [];
0033 end
0034 
0035 
0036 % re-arrange for plotting
0037 xoff = unique(offsets(:,1));
0038 yoff = unique(offsets(:,2));
0039 
0040 % calculate the median value for each row
0041 for m=1:length(yoff)
0042   ind = d.antenna0.tracker.sky_xy_off(:,2) == yoff(m);
0043   indTrack = d.array.frame.features > 0;
0044   f = find(ind & indTrack);
0045   medRms(m,:) = median(d.antenna0.receiver.dataNew(ind,:));
0046 end
0047 
0048 rxMapVal = zeros(length(xoff), length(yoff), 6);
0049 rxMapRms = zeros(length(xoff), length(yoff), 6);
0050 
0051 for m=1:length(xoff)
0052   for n=1:length(yoff)
0053     f = find(offsets(:,1)==xoff(m) & offsets(:,2)==yoff(n));
0054     if(~isempty(f))
0055       rxMapVal(m,n,:) = rxVal(f,:);
0056       rxMapRms(m,n,:) = rxRms(f,:);
0057     else 
0058       rxMapVal(m,n,:) = nan;
0059       rxMapRms(m,n,:) = nan;
0060     end
0061     
0062   end
0063 end
0064 
0065 
0066 % throw out data from bad pointings.
0067 if(any(isnan(rxMapVal(:))))
0068   badRow = sum(isnan(rxMapVal(:,:,6)));
0069   badCol = sum(isnan(rxMapVal(:,:,6)), 2);
0070   frow = find(badRow == max(badRow));
0071   fcol = find(badCol == max(badCol));
0072   rxMapVal(frow,:,:) = [];
0073   rxMapVal(:,fcol,:) = [];
0074   medRms(frow,:) = [];
0075   xoff(frow) = [];
0076   yoff(fcol) = [];
0077 end
0078 
0079 
0080 % reshape the mean so we can extract the common mode
0081 medRms = reshape(medRms, [1 size(medRms)]);
0082 medRms = repmat(medRms, [length(xoff) 1 1]);
0083 
0084 % rxMapVal2 has the mean of each row (atmosphere) removed.
0085 rxMapVal2 = rxMapVal - medRms;
0086 
0087 % plot of the total intensity channels
0088 figure(1)
0089 subplot(2,1,1);
0090 imagesc(xoff, yoff, rxMapVal(:,:,6)');
0091 xlabel('x offset (degrees)');
0092 ylabel('y offset (degrees)');
0093 colorbar('horiz');
0094 title('Chan 2: No mean extracted');
0095 
0096 subplot(2,1,2)
0097 imagesc(xoff, yoff, rxMapVal2(:,:,6)');
0098 xlabel('x offset (degrees)');
0099 ylabel('y offset (degrees)');
0100 colorbar('horiz')
0101 title('Chan 1: Mean of row removed');
0102 
0103 figure(2)
0104 subplot(2,1,1);
0105 imagesc(xoff, yoff, rxMapVal(:,:,1)');
0106 xlabel('x offset (degrees)');
0107 ylabel('y offset (degrees)');
0108 colorbar('horiz');
0109 title('Chan 2: No mean extracted');
0110 
0111 subplot(2,1,2)
0112 imagesc(xoff, yoff, rxMapVal2(:,:,1)');
0113 xlabel('x offset (degrees)');
0114 ylabel('y offset (degrees)');
0115 colorbar('horiz')
0116 title('Chan 1: Mean of row removed');
0117 
0118 
0119 keyboard;

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