Home > reduc > plotting > plotRms.m

plotRms

PURPOSE ^

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

SYNOPSIS ^

function plotRms(d, flags, xc, txt, ax, prop);

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 function plotRms(d, flags, xc, txt, ax, prop);

 d       - data structure
 flag    - flag structure
 xc      - cell element of x and y data
           x{odd}  - x axis data
           x{even} - y axis data Nx1 or Nx6 or Nx24
 txt     - axis text
           txt{1} - title
           txt{2} - x axis
           txt{3} - y axis
           txt[4} - overall title
           txt{5} - legend
 ax         - manual axis settings.  [xmin xmax ymin ymax]
 prop    - initialize properties of plotting
           p.style = {'flag','feature'}
           p.swap  = swap to display plots in time.
           p.featmask= [bitmask for style='feature']

 Extensively modified by ogk on 16 June 2011.

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plotRms(d, flags, xc, txt, ax, prop);
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % function plotRms(d, flags, xc, txt, ax, prop);
0005 %
0006 % d       - data structure
0007 % flag    - flag structure
0008 % xc      - cell element of x and y data
0009 %           x{odd}  - x axis data
0010 %           x{even} - y axis data Nx1 or Nx6 or Nx24
0011 % txt     - axis text
0012 %           txt{1} - title
0013 %           txt{2} - x axis
0014 %           txt{3} - y axis
0015 %           txt[4} - overall title
0016 %           txt{5} - legend
0017 % ax         - manual axis settings.  [xmin xmax ymin ymax]
0018 % prop    - initialize properties of plotting
0019 %           p.style = {'flag','feature'}
0020 %           p.swap  = swap to display plots in time.
0021 %           p.featmask= [bitmask for style='feature']
0022 %
0023 % Extensively modified by ogk on 16 June 2011.
0024 %
0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0026 
0027 % check for axis setting
0028 if (~exist('ax'))
0029   ax=[];
0030 end
0031 
0032 % ogk: I don't understand what this is meant to do, so I'll comment it out.
0033 % % set the plot properties.
0034 % if (exist('prop'))
0035 %   p=setProperties(prop);
0036 % else
0037 %   p=setProperties([]);
0038 % end
0039 
0040 % num is the number of pages to be displayed.
0041 % matrix is the size of each of the pages to be displayed.
0042 num = 1;
0043 %plotsPerPage = 6;
0044 %matrix = [3 2];
0045 plotsPerPage = 1;
0046 matrix = [1 1];
0047 
0048 plotoptions = {'b', 'g', 'r', 'c', 'm', 'y', 'k', ...
0049     'b.', 'g.', 'r.', 'c.', 'm.', 'y.', 'k.', ...    
0050     'bo', 'go', 'ro', 'co', 'mo', 'yo', 'ko', ...    
0051     'bx', 'gx', 'rx', 'cx', 'mx', 'yx', 'kx'};
0052 
0053 % first we cut only the on-source data
0054 %d = cutObs(d, 'source', 'only');
0055 
0056 % MAS (May 28, 2013):
0057 % No, actually let's just subtract off the noise diode events.
0058 d = noiseRemove(d);
0059 
0060 if(isempty(d.array.frame.features))
0061   display('No data to display');
0062   return;
0063 end
0064 
0065 
0066 switch (size(d.antenna0.receiver.data,2))
0067   case 6
0068     % The data to be acted on is:
0069     I1 = d.antenna0.receiver.data(:,1);
0070     I2 = d.antenna0.receiver.data(:,6);
0071     Q = d.antenna0.receiver.data(:,2);
0072     U = d.antenna0.receiver.data(:,3);
0073   case 8
0074     % The data to be acted on is:
0075     I1 = d.antenna0.receiver.data(:,1);
0076     I2 = d.antenna0.receiver.data(:,8);
0077     Q = d.antenna0.receiver.data(:,6);
0078     U = d.antenna0.receiver.data(:,7);
0079     
0080   case 10
0081     % The data to be acted on is:
0082     I1 = d.antenna0.receiver.data(:,1);
0083     I2 = d.antenna0.receiver.data(:,9);
0084     Q = d.antenna0.receiver.data(:,7);
0085     U = d.antenna0.receiver.data(:,8);
0086 end
0087 
0088 % next we flag the data
0089 % diffData( sum(d.flags.fast,2)>0 ) = [];
0090 % Don't flag the data: this will mess up the filtering by changing the time
0091 % base.
0092 
0093 % What we can do is limit the data to a number of samples which are a
0094 % factor of 2:
0095 Nsel = 2^(floor(log2(size(I1,1))));
0096 
0097 % Create a matrix of data to be passed to the notchFilter routine:
0098 Y = [I1(1:Nsel) I2(1:Nsel) Q(1:Nsel) U(1:Nsel)];
0099 
0100 % Apply the standard notches, and some high-pass filters
0101 % MAS (May 28, 2013):  Standard notches don't make any sense.  Just do
0102 % high-pass filters.
0103 Yn005 = notchFilter(Y,[0 0.005]);
0104 Yn050 = notchFilter(Y,[0 0.05]);
0105 Yn500 = notchFilter(Y,[0 0.5]);
0106 
0107 % The data to integrate down:
0108 Yintegrate = [Y Yn005 Yn050 Yn500];
0109 if Nsel >= 4000
0110     intLength = 1:10:2000; % number of samples to integrate down to
0111 else
0112     intLength = 1:10:floor(Nsel/2); % number of samples to integrate down to
0113 end
0114 Ystd = integrateDown(Yintegrate,intLength);
0115 
0116 % corresponding times.
0117 timeVal = intLength*0.01;  % in seconds
0118 
0119 % actual plotting
0120 setwinsize(gcf, 750, 500); 
0121 
0122 tI = intLength*0.01;
0123 ylims = [0.95*min(min(Ystd)) 1.05*max(max(Ystd))];
0124 xlims = [0 max(tI)];
0125 if(any(isnan(ylims)))
0126   ylims = [0 0.2];
0127 end
0128 
0129 subplot(2,2,1)
0130 loglog(tI,Ystd(:,1),'k-',tI,Ystd(:,5),'r-',tI,1./sqrt(intLength)*Ystd(1,5),'k--',tI,Ystd(:,9),'b-',tI,Ystd(:,13),'g-')
0131 ylabel('I1 RMS')
0132 ylim(ylims)
0133 xlim(xlims)
0134 legend('Unfiltered','5mHz HPF','Ideal','50mHz HPF','500mHz HPF','Location','SouthWest')
0135 
0136 subplot(2,2,2)
0137 loglog(tI,Ystd(:,2),'k-',tI,Ystd(:,6),'r-',tI,1./sqrt(intLength)*Ystd(1,6),'k--',tI,Ystd(:,10),'b-',tI,Ystd(:,14),'g-')
0138 ylabel('I2 RMS')
0139 ylim(ylims)
0140 xlim(xlims)
0141 
0142 subplot(2,2,3)
0143 loglog(tI,Ystd(:,3),'k-',tI,Ystd(:,7),'r-',tI,1./sqrt(intLength)*Ystd(1,7),'k--',tI,Ystd(:,11),'b-',tI,Ystd(:,15),'g-')
0144 xlabel('Integration time [s]')
0145 ylim(ylims)
0146 ylabel('Q RMS')
0147 xlim(xlims)
0148 
0149 subplot(2,2,4)
0150 loglog(tI,Ystd(:,4),'k-',tI,Ystd(:,8),'r-',tI,1./sqrt(intLength)*Ystd(1,8),'k--',tI,Ystd(:,12),'b-',tI,Ystd(:,16),'g-')
0151 xlabel('Integration time [s]')
0152 xlim(xlims)
0153 ylim(ylims)
0154 ylabel('U RMS')
0155 
0156 
0157 gtitle('RMS Plot');
0158 
0159 
0160 return;

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