Home > webpage_logging > webpipeline_1.m

webpipeline_1

PURPOSE ^

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

SYNOPSIS ^

function d = webpipeline_1(d, root_name)

DESCRIPTION ^

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

  Contains commands for runing a basic analysis of pipelined data ready for
  web page viewing:

  Basic steps:

    Deglitch
    Alpha correction
    R-factor correction


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 Turn the logging function on

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function d = webpipeline_1(d, root_name)
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 %  Contains commands for runing a basic analysis of pipelined data ready for
0005 %  web page viewing:
0006 %
0007 %  Basic steps:
0008 %
0009 %    Deglitch
0010 %    Alpha correction
0011 %    R-factor correction
0012 %
0013 %
0014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0015 % Turn the logging function on
0016 
0017     diary([root_name,'.log'])
0018     
0019     disp('Starting the data reduction')    
0020     
0021 % First remove the 40Hz aliased harmonics of the mains since these
0022 % are the most obvious and easiest to remove
0023     disp('Removing 40Hz mains harmonic')
0024     d = mainsWrapper(d,0,0);
0025 
0026 % Do a first cut deglitch at 5 sigma above mean of smoothed datastream
0027     disp('Doing a 5-sigma cut on mean of smoothed raw data channels')
0028     sigma = 5;
0029     d = first_cut(d,sigma);
0030     
0031      
0032 % Applies alpha and r-factor correction
0033 
0034 % 1. Calculate the alpha corrections
0035     disp('Applying the alpha and r-factor corrections')
0036     
0037     try
0038     [t,A,G,T,horiz,equa, offStartPos, onEndPos, offEndPos, onStartPos] = calculateAlpha(d);
0039     catch
0040         disp('(Failed to calculate Alphas')
0041     end
0042     
0043 % 2. Applies the alpha corrections to the data and overwrites the switchData register
0044     try
0045     d = applyAlpha2(d,t,A,G);
0046     catch
0047         disp('Failed to apply the alpha corrections')
0048     end
0049     
0050 % 3. Some pre-processing before before r-factor correction:
0051     try
0052     thisAlpha = [t A G T horiz equa];
0053     d.correction.alpha.indices = [offStartPos' onEndPos' offEndPos' onStartPos'];
0054     d.correction.alpha.values = thisAlpha;
0055     catch
0056         disp('Failed to pre-process data ready for r-factors')
0057     end
0058     
0059 % 4. Calculate the r-factor during the noise diode off events (this is why the above steps need to have been done)
0060     try
0061     r = calculateRfactor(d);
0062     meanr = mean(r)
0063     catch
0064         disp('Failted to calculate r-factors')
0065     end
0066         
0067 % 5. Apply the r-factor, by subtracting a smoothed load signal (scaled by the r factor) from the sky signal.
0068 %    smoothLength is the length of the smoothing window function in seconds. This overwrites the data register.
0069     try
0070     smoothLength = 1
0071     rval =  [1.9,1.8,1.8,1.7];
0072     d = calculateStokes2_samer(d,r,smoothLength,rval);
0073     catch
0074         disp('Failed to apply r-factors')
0075     end
0076 
0077 % Generate plots and spectra of the stare events and the scan periods
0078     stare_stats_filename=strcat(root,'_stare_stats.dat');
0079     scan_stats_filename=strcat(root,'_scan_stats.dat');
0080     makeWebpageSpectra(d,stare_stats_filename,scan_stats_filename,root_name);
0081     
0082 % Now lets plot the spectrograms of this data to file
0083     
0084     disp('Making spectrograms of data');
0085     makeWebpageSpectrogram(d,0,root_name)
0086 
0087 % Now let's plot the sources - save the source list in 'sources'
0088 % Doesn't plot to screen but instead to a file (switch = 1)
0089     disp('Plotting source data to file');
0090     d = applyFlags(d)
0091     [sources] = plot_sourcesAll(d,1,root_name);
0092  
0093  
0094  diary('off')
0095     
0096 return

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