Home > reduc > plotting > plot_calibrators.m

plot_calibrators

PURPOSE ^

Function to read the calibrator log (calibrator_list.txt) file

SYNOPSIS ^

function plot_calibrators(start_date, end_date,sched_name)

DESCRIPTION ^

 Function to read the calibrator log (calibrator_list.txt) file 
 and plot it out.

 Useage: plot_calibrators('01-Jun-2011','10-Jun-2011', 'scan_calibrators_2011.sch')
         start_date, end_date and sched_name are optional
         sched_name could just be 'scan_calibrator' if you want to pick up
         all variations of this schedule

 If you request dates outside the current log file it will tell you
 and then update the log file for you.

 Plots the calibrators vs day

 ACT 25/7/2011

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_calibrators(start_date, end_date,sched_name)
0002 % Function to read the calibrator log (calibrator_list.txt) file
0003 % and plot it out.
0004 %
0005 % Useage: plot_calibrators('01-Jun-2011','10-Jun-2011', 'scan_calibrators_2011.sch')
0006 %         start_date, end_date and sched_name are optional
0007 %         sched_name could just be 'scan_calibrator' if you want to pick up
0008 %         all variations of this schedule
0009 %
0010 % If you request dates outside the current log file it will tell you
0011 % and then update the log file for you.
0012 %
0013 % Plots the calibrators vs day
0014 %
0015 % ACT 25/7/2011
0016 [home,installeddir] = where_am_i();
0017 
0018 fid=fopen([home,'/',installeddir,'/log/calibrator_list.log'],'r');
0019 sources = textscan(fid,'%12s %20s %20s\n');
0020 usn = unique(sources{1});
0021 sd = sources{2};
0022 sn = sources{1};
0023 start_numbers = datenum(sd,'dd-mmm-yyyy:HH:MM:SS');
0024 min_time = min(start_numbers);
0025 max_time = max(start_numbers);
0026 
0027 if(nargin>1)
0028     min_t = datenum(start_date);
0029     max_t = datenum(end_date);
0030     
0031     if(min_t < min_time) | (max_t > max_time)
0032         fclose (fid)
0033         clear fid
0034         ('Your calibrator log file needs updating to cover these dates - will do so now then carry on')
0035         ('Will check all .sch files containing "scan_calibrator"')
0036         if(nargin<3)
0037             sched_name = 'scan_calibrator'
0038         end
0039         [sources usn] = get_calobs(start_date,end_date,sched_name);
0040         fid=fopen([home,'/',installeddir,'/log/calibrator_list.log'],'r');
0041         sources = textscan(fid,'%12s %20s %20s\n');
0042         usn = unique(sources{1});
0043         sd = sources{2};
0044         sn = sources{1};
0045         start_numbers = datenum(sd,'dd-mmm-yyyy:HH:MM:SS');
0046         min_time = min_t;
0047         max_time = max_t;
0048     else
0049         min_time = min_t;
0050         max_time = max_t;
0051     end
0052 end
0053 
0054 xticks = [min_time:1:max_time];
0055 for i=1:length(usn)
0056 temp_times(:,1) = start_numbers(strmatch(usn(i),sn));  %% find the startdates for all the source_names matching unique name 1,2,3..
0057 temp_times(:,2)=i;
0058 h(i) = plot(temp_times(:,1),temp_times(:,2),'p');
0059 xlim([min_time,max_time]);
0060 ylim([0,length(usn)+1]);
0061 set(gca,'xtick',xticks);
0062 hold all
0063 clear temp_times
0064 end
0065 
0066 
0067 datetick('x','dd/mm','keeplimits','keepticks');
0068 set(gca,'xtick',xticks);
0069 h = gca;
0070 th=rotateticklabel(h,45);
0071 names  = [' ';usn];
0072 set(gca,'YTickLabel',names);  % Label the y-axis with the calibrator names
0073 grid on;
0074 title('Calibrator observations','fontsize',15);
0075 
0076 fclose(fid);

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