Home > RFI > make_plots_P.m

make_plots_P

PURPOSE ^

Read in the data:

SYNOPSIS ^

function make_plots_P(filestring)

DESCRIPTION ^

 Read in the data:

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % Read in the data:
0002 function make_plots_P(filestring)
0003 
0004 dirname = '/home/heikoh/cbass/New_Codes/Full_Sky/Working_With_Stephen/Matlab';
0005 txt = sprintf('ls %s/%s*.mat', dirname, filestring);
0006   [s w] =unix(txt); % reads in the file list
0007 
0008   index = 1;
0009   while(~isempty(w)) % goes through file list and assigns each file an index
0010     [filename{index}, w] = strtok(w);
0011     index = index+1;
0012   end
0013   
0014   dall = [];
0015   for m=1:length(filename)-1
0016       eval(sprintf(' load %s drfi', filename{m}));% loads each file
0017       if(exist('drfi', 'var'))
0018       if(isempty(dall))
0019           dall = drfi; % for first value, assigns dall = drfi
0020       else
0021           dall = [dall, drfi]; % concantenates each drfi
0022       end % if
0023       end % if
0024 
0025   end %for
0026 plotfigs_P(dall)
0027 
0028 end % read_data_HMH
0029 
0030 
0031 %%%  plotting figures
0032 function plotfigs_P(drfi)
0033 clc
0034 close all
0035 %cbass_startup
0036 
0037 % first, let's just find the peak and see what its spectrum looks like
0038 figure()
0039 allspectra = [];
0040 Polarization_freq1 = [];
0041 Polarization1 = [];
0042 Polarization_freq2 = [];
0043 Polarization2 = [];
0044 
0045 for m=1:size(drfi,2)
0046 
0047     Q1freq = drfi{m}.antenna0.roach1.Qfreq;
0048     Q2freq = drfi{m}.antenna0.roach2.Qfreq;
0049     U1freq = drfi{m}.antenna0.roach1.Ufreq;
0050     U2freq = drfi{m}.antenna0.roach2.Ufreq;
0051     Polarization_freq1{m} = sqrt((Q1freq.*Q1freq + U1freq.*U1freq));
0052     Polarization_freq2{m} = sqrt((Q2freq.*Q2freq + U2freq.*U2freq));
0053     
0054     Q1 = drfi{m}.antenna0.roach1.LL;
0055     Q2 = drfi{m}.antenna0.roach2.LL;
0056     U1 = drfi{m}.antenna0.roach1.RR;
0057     U2 = drfi{m}.antenna0.roach2.RR;
0058     Polarization1{m} = sqrt((Q1.*Q1 + U1.*U1));
0059     Polarization2{m} = sqrt((Q2.*Q2 + U2.*U2));
0060     
0061    
0062     aa1 = find(Polarization_freq1{m} == max(Polarization_freq1{m}));
0063     aa2 = find(Polarization_freq2{m} == max(Polarization_freq2{m}));
0064     
0065     
0066     % to visualize them (First step)
0067     subplot(2,1,1); plot(Polarization1{m}(aa1,:));hold on
0068     title('Peak Polarization Values Across All Channels: Roach1')
0069     xlabel('Channels')
0070     ylabel('Polarization Intensity')
0071     subplot(2,1,2); plot(Polarization2{m}(aa2,:)); hold on
0072     title('Peak Polarization Values Across All Channels: Roach2')
0073     xlabel('Channels')
0074     ylabel('Polarization Intensity')
0075     allspectra(m,:) = [Polarization1{m}(aa1,:), Polarization2{m}(aa2,:)];
0076     %allspectra(m,:) = [drfi{m}.Intensity(aa,:)];
0077     %hold on
0078 end
0079 hold off
0080 %{
0081 keyboard;
0082 
0083 figure()
0084 for m=1:length(drfi)
0085   disp('New Event');
0086   f = find(drfi{m}.antenna0.roach1.LLfreq == max(drfi{m}.antenna0.roach1.LLfreq));
0087   minInt = f-200;
0088   maxInt = f+200;
0089   if(minInt < 1)
0090     minInt = 1;
0091   end
0092   if(maxInt > length(drfi{m}.antenna0.roach1.LLfreq))
0093     maxInt = length(drfi{m}.antenna0.roach1.LLfreq);
0094   end
0095   
0096   maxval = max(drfi{m}.antenna0.roach1.LL(:));
0097   cc = [drfi{m}.antenna0.roach1.LL(f,:) , drfi{m}.antenna0.roach2.LL(f,:)];
0098   for mm=minInt:maxInt
0099      bb = [drfi{m}.antenna0.roach1.LL(mm,:) , drfi{m}.antenna0.roach2.LL(mm,:)];
0100      plot(bb);
0101      ylim([0,maxval]);
0102      hold on
0103      plot(cc, 'r-');
0104      txt = sprintf('Event # %d', m);
0105      title(txt);
0106      pause(0.025);
0107      hold off     
0108   end
0109   pause(1)
0110   
0111 end
0112 
0113 keyboard;
0114 %}
0115 figure()
0116 plot(allspectra');
0117 title('Each RFI Event Across All Channels')
0118 ylabel('Polarization Intensity')
0119 xlabel('Channels')
0120 
0121 
0122 %{
0123 
0124 % later, we can take the "rfi event", and compare them to each other (once
0125 % normalized)
0126 figure()
0127 for m=1:size(drfi,2)
0128     bb = drfi{m}.antenna0.roach1.LL;
0129     bb = bb./repmat(bb(1,:), [size(bb,1), 1]);
0130     bb = bb-1;
0131     plot(sum(bb,1));
0132     hold on;
0133 end
0134 title('Search For Peak RFI Across All Channels')
0135 xlabel('Channels')
0136 ylabel('LL Intensity')
0137 hold off
0138 %}
0139 end

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