Home > reduc > plotting > plot_sources.m

plot_sources

PURPOSE ^

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

SYNOPSIS ^

function [sources] = plot_sources(d,channel)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 function [sources] =  plot_sources(d,channel)
 
 Function to plot data and identify which sources have been observed
 Particularly useful for seeing what calibrator sources were looked at
 
 act - 16/7/2010
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [sources] =  plot_sources(d,channel)
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % function [sources] =  plot_sources(d,channel)
0005 %
0006 % Function to plot data and identify which sources have been observed
0007 % Particularly useful for seeing what calibrator sources were looked at
0008 %
0009 % act - 16/7/2010
0010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0011 
0012 
0013 
0014 % To plot the source data and name it - names of sources are stored in
0015 %     d.antenna0.tracker.source
0016 % The associated times of these frames is in:
0017 %    d.antenna0.tracker.utc
0018 
0019 %First find sources observed
0020 
0021 sources = unique(d.antenna0.tracker.source)
0022 
0023 ax(1) = subplot(4,1,1:2);
0024 
0025 for i = 1:length(sources);
0026 
0027     test = strcmp(sources(i),d.antenna0.tracker.source);
0028     
0029     % Grab the data for this source and plot it
0030     
0031     testData = framecut(d,test);
0032          
0033     h(i)=plot(ax(1),testData.antenna0.receiver.utc,testData.antenna0.receiver.data(:,channel),'.');
0034    
0035     hold all
0036     clear test
0037     clear testData;
0038     
0039 end
0040 
0041 % Now add places where there is skydips and noise cal
0042 % First we see if there's any skydip data
0043 
0044 j=i+1;
0045 
0046 if(length(find(d.index.skydip.fast))==0)
0047   display('no sky dips in your data');
0048 else
0049     skydip = framecut(d,d.index.skydip.fast);
0050     h(j) = plot(ax(1),skydip.antenna0.receiver.utc,skydip.antenna0.receiver.data(:,channel),'k.');
0051     clear skydip;
0052     sources(j) = cellstr('skydip')';
0053     j = j+1;
0054 end
0055 
0056 %Next look for noise source data
0057 
0058 if(length(find(d.index.noise.fast))==0)
0059   display('no noise source events in your data');
0060 else
0061   noise = framecut(d,d.index.noise.fast);
0062     h(j) = plot(ax(1),noise.antenna0.receiver.utc,noise.antenna0.receiver.data(:,channel), ...
0063      'mo', ...
0064         'LineWidth',2,...
0065         'MarkerEdgeColor','m',...
0066         'MarkerFaceColor',[.49 1 .63],...
0067         'MarkerSize',3);
0068     clear noise;
0069     sources(j) = cellstr('noise');
0070     j = j+1;
0071 end
0072 
0073 
0074 % Update legend names
0075 legend(h,sources(1:length(sources)) );
0076 %xlabel('UTC');
0077 ylabel('Nominal units');
0078 title(['Channel ', num2str(channel) ,' raw data']);
0079 
0080 % Also plot the azimuth and elevation tied to the same x -axis
0081 
0082 ax(2) = subplot(4,1,3);
0083 
0084 plot(ax(2),d.antenna0.receiver.utc, d.antenna0.servo.el);
0085 ylabel('Elevation, deg');
0086 
0087 ax(3) = subplot(4,1,4);
0088 
0089 plot(ax(3),d.antenna0.receiver.utc, d.antenna0.servo.az);
0090 ylabel('Azimuth, deg');
0091 xlabel('UTC')
0092 
0093 linkaxes(ax,'x');

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