Home > Angelas_Raster_Code > interactive_flag.m

interactive_flag

PURPOSE ^

%

SYNOPSIS ^

function flagDodgy = interactive_flag(data)

DESCRIPTION ^

%
 Quick deglitcher - pick out time regions from plot
 Use cursor to identify ranges of data to flag. Pick points in pairs.Press
 return when done. It'll then plot the unflagged data to see if you are
 happy.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function flagDodgy = interactive_flag(data)
0002 %%
0003 % Quick deglitcher - pick out time regions from plot
0004 % Use cursor to identify ranges of data to flag. Pick points in pairs.Press
0005 % return when done. It'll then plot the unflagged data to see if you are
0006 % happy.
0007 
0008 % Get rid of this once we have full pipeline functionality
0009 flagging=input('Do you want to flag the timestream data interactively (y/n) ', 's');
0010 
0011 % Plot data in small chunks to ease interactive flagging if file very large
0012 chunk_size = 250000.0;
0013 number_of_chunks=floor(size(data,1)/chunk_size)
0014 remainder =      size(data,1)-(chunk_size*number_of_chunks)
0015 last_chunk_start = size(data,1)-remainder
0016 
0017 
0018 
0019 if (flagging=='y')
0020     
0021     % Set up a temporary array to keep track of the user flagged data
0022     flagDodgy = logical((data)*0);
0023     size(flagDodgy)
0024     % plot dta in small chunks if it is very large
0025     
0026     
0027     happy='n';
0028     while(happy=='n')
0029         
0030         figure
0031         for m=1:number_of_chunks+1
0032             if(m==number_of_chunks+1)
0033                 xaxis=[last_chunk_start:size(data,1)];
0034                 plot(xaxis,data(last_chunk_start:end));
0035             else
0036                 startpoint=((m-1)*chunk_size)+1
0037                 endpoint=m*chunk_size
0038                 xaxis=[startpoint:endpoint];
0039                 plot(xaxis,data(startpoint:endpoint))
0040             end
0041             
0042             
0043             
0044             disp('Plotting your data. Pick time ranges that you want to exclude from the data. Press return when done')
0045             
0046             [x,y]=ginput
0047             
0048             % Make that data NaNs
0049             for i=1:2:length(x)
0050                 data(x(i):x(i+1),:)=NaN;
0051                 flagDodgy(x(i):x(i+1),:)=1;
0052             end
0053         end
0054         
0055         figure
0056         plot(data)
0057         happy = input('Happy? (y/n) ', 's');
0058     end
0059 end

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