Home > Angelas_Raster_Code > run_lots_of_rasters2.m

run_lots_of_rasters2

PURPOSE ^

%%%%%%%%%

SYNOPSIS ^

function run_lots_of_rasters2(cbass,save_path,input_filename,reduced_data_name,start_date,stop_date)

DESCRIPTION ^

%%%%%%%%%
  Code to analyse and calibrate raster scans
 
  run_lots_of_rasters2(cbass, save_path, input_filename, start_date, stop_date,reduced_data_file)

 -----
 cbass: 'N' or 'S' depending which instrument you are using - some hacks for S later in code 
 save_path: name of directory to save all plot and data in (will be placed
            in cbass_analysis directory)
 input_filename: 'file containing list of raster dates' or []
 
 reduced_data_file: .mat file containing d structure with all 8 data columns
    can use this instead of running pipeline again in this code
    not necessary - just use []
    example file spat out by this code is reduced_data_file='16-Jul-2013:13:48:20_m42_I_pipelined.mat'
 ----
 There are three ways to pick the rasters you want to analyse

 1) Specify an input_filename so you can analyse many rasters: 

     e.g. run_lots_of_rasters(cbass,save_path, 'm42_rasters.txt')
    
    The input filename should have at least the start and stop times of all the rasters you want to analyse (grabbed from obs_log.html)
      16-Jul-2013:13:48:20     16-Jul-2013:21:08:10      /home/cbass/gcpCbass/control/sch/source_raster_8x4x0.05.sch( 10h    , m42 )
      24-Apr-2013:20:32:44     25-Apr-2013:01:50:32    blah blah
      ...etc

 2) Specify a specific start and stop date to analyse just one raster:

     e.g. run_lots_of_rasters(cbass,save_path, [],   '24-Apr-2013:20:32:44',     '25-Apr-2013:01:50:32')

 3) If no inputs are given then it will read the list of dates explicitly given in this function (see in code below)

     e.g. run_lots_of_rasters(save_path)
 
 ACT 12/8/2013

 Overhauled Code to calculate calibration matrix for I1,I2,Q1,Q2,U1,U2 -
 ACT 16/1/204
%%%%%%%%%%%%
%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function run_lots_of_rasters2(cbass,save_path,input_filename,reduced_data_name,start_date,stop_date)
0002 %%%%%%%%%%
0003 %  Code to analyse and calibrate raster scans
0004 %
0005 %  run_lots_of_rasters2(cbass, save_path, input_filename, start_date, stop_date,reduced_data_file)
0006 %
0007 % -----
0008 % cbass: 'N' or 'S' depending which instrument you are using - some hacks for S later in code
0009 % save_path: name of directory to save all plot and data in (will be placed
0010 %            in cbass_analysis directory)
0011 % input_filename: 'file containing list of raster dates' or []
0012 %
0013 % reduced_data_file: .mat file containing d structure with all 8 data columns
0014 %    can use this instead of running pipeline again in this code
0015 %    not necessary - just use []
0016 %    example file spat out by this code is reduced_data_file='16-Jul-2013:13:48:20_m42_I_pipelined.mat'
0017 % ----
0018 % There are three ways to pick the rasters you want to analyse
0019 %
0020 % 1) Specify an input_filename so you can analyse many rasters:
0021 %
0022 %     e.g. run_lots_of_rasters(cbass,save_path, 'm42_rasters.txt')
0023 %
0024 %    The input filename should have at least the start and stop times of all the rasters you want to analyse (grabbed from obs_log.html)
0025 %      16-Jul-2013:13:48:20     16-Jul-2013:21:08:10      /home/cbass/gcpCbass/control/sch/source_raster_8x4x0.05.sch( 10h    , m42 )
0026 %      24-Apr-2013:20:32:44     25-Apr-2013:01:50:32    blah blah
0027 %      ...etc
0028 %
0029 % 2) Specify a specific start and stop date to analyse just one raster:
0030 %
0031 %     e.g. run_lots_of_rasters(cbass,save_path, [],   '24-Apr-2013:20:32:44',     '25-Apr-2013:01:50:32')
0032 %
0033 % 3) If no inputs are given then it will read the list of dates explicitly given in this function (see in code below)
0034 %
0035 %     e.g. run_lots_of_rasters(save_path)
0036 %
0037 % ACT 12/8/2013
0038 %
0039 % Overhauled Code to calculate calibration matrix for I1,I2,Q1,Q2,U1,U2 -
0040 % ACT 16/1/204
0041 %%%%%%%%%%%%%
0042 %%
0043 nargin
0044 if(nargin==3 || nargin==4)
0045     %reduced_data_file=[];
0046     [VarName1,VarName2] = import_raster_file(input_filename,1);
0047     date =[VarName1 VarName2];
0048     date = strtrim(date) %Make sure there are no  extra whitespaces in the date strings
0049     clear VarName1 VarName2;
0050     
0051 else
0052     if(nargin>=5)
0053         
0054          date = {start_date stop_date};
0055          date = strtrim(date); %Make sure there are no  extra whitespaces in the date strings
0056          
0057     else
0058         % Then read from this list below (edit and comment as required):
0059         
0060          date = {'25-Mar-2013:22:55:18' ,     '26-Mar-2013:06:29:04';...      %/home/cbass/gcpCbass/control/sch/source_raster_8x4x0.05.sch( 7h:30m       , taua )
0061          '24-Apr-2013:20:32:44',     '25-Apr-2013:01:50:32';...      %/home/cbass/gcpCbass/control/sch/source_raster_8x4x0.05.sch( 5h   , taua )
0062          '25-Apr-2013:18:28:08',  '26-Apr-2013:04:01:07';...      %/home/cbass/gcpCbass/control/sch/source_raster_8x4x0.05.sch( 9h:30m       , taua )
0063          '27-Apr-2013:18:20:14',  '28-Apr-2013:03:53:18';...      %/home/cbass/gcpCbass/control/sch/source_raster_8x4x0.05.sch( 9h:30m       , taua )
0064          '29-Apr-2013:18:12:25',  '30-Apr-2013:03:49:11';...      %/home/cbass/gcpCbass/control/sch/source_raster_8x4x0.05.sch( 9h:30m       , taua )
0065          '07-Nov-2012:07:22:02',  '07-Nov-2012:17:30:34';... %     /home/cbass/gcpCbass/control/sch/source_raster_8degM.sch( 10h    , taua )
0066          '12-Dec-2012:03:05:38',  '12-Dec-2012:13:39:01';...%      /home/cbass/gcpCbass/control/sch/source_raster_8x4x0.1.sch( 10h:30m        , taua )
0067          '13-Dec-2012:05:50:12',  '13-Dec-2012:15:54:05'}...%      /home/cbass/gcpCbass/control/sch/source_raster_8x4x0.05.sch( 10h    , taua )
0068          %'01-May-2013:18:25:25',  '02-May-2013:09:28:23';... %
0069           date = strtrim(date); %Make sure there are no  extra whitespaces in the date strings
0070     end
0071 end
0072 
0073 %%
0074 
0075  
0076 %save_path = 'test_fits_June2013'
0077 
0078 date
0079 for rasters=1:size(date,1)
0080 start_date = date{rasters,1};
0081 stop_date = date{rasters,2};
0082 %reduced_data_name
0083 
0084 if(nargin==3)
0085     reduced_data_file=[];
0086 else
0087     
0088     if(strmatch('m42',reduced_data_name,'exact'))
0089         
0090         disp('HERE')
0091         reduced_data_file=[start_date,'_m42_I_pipelined.mat']
0092         source_name='m42'
0093     else
0094         if(strmatch('taua',reduced_data_name,'exact'))
0095             reduced_data_file=[start_date,'_taua_I_pipelined.mat']
0096             source_name='taua'
0097         end
0098     end
0099 end
0100 reduced_data_file
0101     nchan=9;
0102     plot_labels = {'I1','Q1','U1','Q2','U2','Q3','U3','I2','V'};
0103     IntensityType = 'I'; % Archaic - need to rmove at some point!
0104     [source_name reduced_data_file nchan plot_labels] = Final_Raster_Analysis2(save_path,start_date, stop_date,cbass,IntensityType,reduced_data_file);
0105     
0106 %        clearvars -except nchan plot_labels cbass IntensityType save_path start_date source_name;
0107     
0108    fit_IQUV2(nchan, plot_labels,cbass,IntensityType,save_path,start_date,source_name);
0109     
0110 %        clearvars -except nchan  plot_labels cbass IntensityType save_path start_date source_name;
0111     
0112 %    fit_IQUV2_radec(nchan, plot_labels, cbass,IntensityType,save_path,start_date,source_name)
0113         
0114 %         clearvars -except nchan  plot_labels cbass IntensityType save_path start_date source_name;
0115 %
0116      plot_gfit_data2(nchan,plot_labels,save_path,start_date,source_name,IntensityType);
0117 %
0118 %         clearvars -except nchan  plot_labels cbass IntensityType save_path start_date source_name;
0119 %
0120 %     %TauARaster_quick2(nchan,plot_labels,save_path,source_name,start_date,IntensityType);
0121 %
0122 %     % Finally, apply the calibration matrix and repeat the plots in
0123 %     % TauARaster_quick
0124 %
0125 close all
0126 
0127     if(strmatch(source_name,'taua'))
0128        cal_source = 'TauA'
0129        [calmat data P]=calibrate_IQUV2(cal_source,save_path,start_date,source_name,IntensityType);
0130        
0131               % clearvars -except calmat nchan plot_labels cbass IntensityType save_path start_date source_name;
0132         
0133         %TauARaster_quick2(nchan,plot_labels,save_path,source_name,start_date,IntensityType,calmat);
0134     end
0135     
0136     if(strmatch(source_name,'m42'))
0137         cal_source = 'M42'
0138         [calmat data P]=calibrate_IQUV2(cal_source,save_path,start_date,source_name,IntensityType);
0139             
0140             %clearvars -except calmat nchan plot_labels cbass IntensityType save_path start_date source_name;
0141         
0142          %TauARaster_quick2(nchan,plot_labels,save_path,source_name,start_date,IntensityType,calmat);
0143     end
0144 %
0145     
0146 end
0147 
0148 % [home,installeddir] = where_am_i();
0149 % maindir= [home,'/',installeddir,'/',save_path,'/'];
0150 % filename = ([maindir,start_date,'_',source_name]);
0151 % load([filename,'_caldata.mat']);
0152 end
0153 
0154 
0155

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