Home > pointing > plot_res.m

plot_res

PURPOSE ^

plot_res(model,ide,obs,plottitle,gof)

SYNOPSIS ^

function [rmssa ind sa]=plot_res(model,ide,obs,plottitle,gof, junk)

DESCRIPTION ^

 plot_res(model,ide,obs,plottitle,gof)

 Plot the model residuals.  gof is the goodness of fit for plots of
 fit models

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [rmssa ind sa]=plot_res(model,ide,obs,plottitle,gof, junk)
0002 % plot_res(model,ide,obs,plottitle,gof)
0003 %
0004 % Plot the model residuals.  gof is the goodness of fit for plots of
0005 % fit models
0006 
0007 d2r=pi/180;
0008 
0009 % Find the model values
0010 [mva.az,mva.el]=pointing_model(model,ide.az,ide.el);
0011 
0012 % Find the az/el residuals
0013 res.az=obs.az-mva.az;
0014 
0015 ind=res.az>180; res.az(ind)=res.az(ind)-360;
0016 ind=res.az<-180; res.az(ind)=res.az(ind)+360;
0017 res.el=obs.el-mva.el;
0018 
0019 % Find the space angles between observed and reference values
0020 sa=spaceangle(obs.az,obs.el,mva.az,mva.el,'deg');
0021 rmssa=rms(sa);
0022 ind=sa>3*rmssa;
0023 
0024 % Calc the cos(el) factor
0025 ide.cosel=cos(ide.el*d2r);
0026 
0027 setwinsize(gcf,600,600); clf
0028 
0029 
0030 % Plot the sky positions hit
0031 subplot(3,3,3)
0032 polar(ide.az*d2r,90-ide.el,'+');
0033 view(90,-90);
0034 hold on; polar(ide.az(ind)*d2r,90-ide.el(ind),'ro'); hold off
0035 
0036 
0037 subplot(3,3,1)
0038 plot(ide.az,res.az,'+'); xlabel('az'); ylabel('az residual'); %ylim([-0.5 0.5]);
0039 hold on;  plot(ide.az(ind),res.az(ind),'ro'); hold off
0040 subplot(3,3,2);
0041 plot(ide.el,res.az,'+'); xlabel('el'); ylabel('az residual'); %ylim([-0.5 0.5]);
0042 hold on; plot(ide.el(ind),res.az(ind),'ro'); hold off
0043 
0044 subplot(3,3,4)
0045 plot(ide.az,res.az.*ide.cosel,'+'); xlabel('az'); ylabel('az residual * cos(el)'); %ylim([-0.5 0.5]);
0046 hold on; plot(ide.az(ind),res.az(ind).*ide.cosel(ind),'ro'); hold off
0047 subplot(3,3,5);
0048 plot(ide.el,res.az.*ide.cosel,'+'); xlabel('el'); ylabel('az residual * cos(el)'); %ylim([-0.5 0.5]);
0049 hold on; plot(ide.el(ind),res.az(ind).*ide.cosel(ind),'ro'); hold off
0050 
0051 subplot(3,3,7)
0052 plot(ide.az,res.el,'+'); xlabel('az'); ylabel('el residual'); %%ylim([-0.01,0.02]);
0053 hold on; plot(ide.az(ind),res.el(ind),'ro'); hold off
0054 subplot(3,3,8)
0055 plot(ide.el,res.el,'+'); xlabel('el'); ylabel('el residual'); %%ylim([-0.01,0.02]);
0056 hold on; plot(ide.el(ind),res.el(ind),'ro'); hold off
0057 
0058 % Write the model parameters if available
0059 if(exist('model'))
0060    subplot(3,3,6);
0061   modpar={'flex sin','flex cos','az tilt ha','az tilt lat',...
0062       'el tilt','collim x','collim y','az zero','el zero','gof','num pts'};
0063   disp_vals=[model,gof,sum(~isnan(obs.az))];
0064   for i=1:length(modpar)
0065     h=text(0.1,(10-i)*0.1,sprintf('%s = %f',modpar{i},disp_vals(i)));
0066     if(disp_vals(i)~=0)
0067       set(h,'Color','b');
0068     end
0069   end
0070   axis off
0071 end
0072 
0073 % Plot space angle histograms
0074 subplot(3,3,9)
0075 sa=sa*60;
0076 m=max(sa)*1.000001;
0077 %hfill(sa,20,0,m,[]);
0078 %hfill(sa(~ind),20,0,m,[]);
0079 xlabel('space angle error (arcmin)');
0080 y=ylim; ylim([0,y(2)*1.1]);
0081 axes('Position',get(gca,'Position'),'Xlim',[0,1],'Ylim',[0,1],'Visible','off');
0082 text(0.4,0.9,sprintf('rms=%f',rms(sa(~ind))),'Color','b');
0083 if(sum(ind)>0)
0084   text(0.4,0.8,sprintf('rms=%f',rms(sa)),'Color','r');
0085 end
0086 
0087 if(exist('plottitle'))
0088   gtitle(plottitle);
0089 end
0090 
0091 return

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