Home > pointing > optical_pointing.m

optical_pointing

PURPOSE ^

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

SYNOPSIS ^

function [fm,ide,obs, sa, om]=optical_pointing(d, filename)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     % [fm,ide,obs]=optical_pointing(d, filename)
  function should give us an optical pointing model.


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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [fm,ide,obs, sa, om]=optical_pointing(d, filename)
0002  
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004   %     % [fm,ide,obs]=optical_pointing(d, filename)
0005 %  function should give us an optical pointing model.
0006 %
0007 %
0008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0009 
0010   
0011   
0012 % create some easier to parse variables:
0013 
0014 %obs.az=d.antenna0.tracker.horiz_topo(:,1);
0015 %obs.el=d.antenna0.tracker.horiz_topo(:,2);
0016 
0017 %ide.az=d.antenna0.tracker.horiz_mount(:,1);
0018 %ide.el=d.antenna0.tracker.horiz_mount(:,2);
0019 
0020 ide.az=d.antenna0.tracker.horiz_topo(:,1);
0021 ide.el=d.antenna0.tracker.horiz_topo(:,2);
0022 
0023 obs.az=d.antenna0.tracker.horiz_mount(:,1);
0024 obs.el=d.antenna0.tracker.horiz_mount(:,2);
0025 
0026 tilt.x=zeros(size(ide.az));
0027 tilt.y=zeros(size(ide.az));
0028 
0029 om(:,1)=d.antenna0.tracker.flexure(:,1);
0030 om(:,2)=d.antenna0.tracker.flexure(:,2);
0031 om(:,3)=d.antenna0.tracker.tilts(:,1);
0032 om(:,4)=d.antenna0.tracker.tilts(:,2);
0033 om(:,5)=d.antenna0.tracker.tilts(:,3);
0034 om(:,6)=d.antenna0.tracker.fixedCollimation(:,1);
0035 om(:,7)=d.antenna0.tracker.fixedCollimation(:,2);
0036 om(:,8)=d.antenna0.tracker.encoder_off(:,1);
0037 om(:,9)=d.antenna0.tracker.encoder_off(:,2);
0038 
0039 off.az=d.antenna0.tracker.horiz_off(:,1);
0040 off.el=d.antenna0.tracker.horiz_off(:,2);
0041 
0042 date=utc2date(d.array.frame.utc(1));
0043 %sources = unique(d.antenna0.tracker.source);
0044 
0045 
0046 % The actual online values are not recorded - reconstruct them by
0047 % adding in encoder zero points
0048 obs.az=obs.az+om(:,8);
0049 obs.el=obs.el+om(:,9);
0050 
0051 % From now on just use online model as it was at start of run -
0052 % shouldn't matter if it changes during a run although there is no
0053 % reason why it ever should.
0054 for i=1:size(om,2)
0055   if(any(om(:,i)~=om(1,i)))
0056     warning(sprintf('Online model parameter %d changed during run',i));
0057   end
0058 end
0059 om=om(1,:);
0060 
0061 % Put az values into 0-360 range
0062 ind=obs.az<0; obs.az(ind)=obs.az(ind)+360;
0063 ind=obs.az>360; obs.az(ind)=obs.az(ind)-360;
0064 
0065 % Convert tilt meter values to degrees
0066 tilt.x=tilt.x/60; tilt.y=tilt.y/60;
0067 
0068 disp(sprintf('Read in %d data points',length(obs.az)));
0069 %disp(sprintf('  ... %d unique sources', length(sources)));
0070 
0071 
0072 % Fit the model
0073 %fm=singlestep_fit(om,ide,obs,filename);
0074 [fm sa]=stepbystep_fit(om,ide,obs,filename);
0075 
0076 % what to add to the files
0077 display(sprintf('encoder_zeros  %1.4f, %1.4f, 0', fm(8), fm(9)));
0078 display(sprintf('tilts  %4.4f, %4.4f, %4.4f', fm(3), fm(4), fm(5)));
0079 display(sprintf('collimate_fixed optical, %4.4f, %4.4f, ptel=0+1+2', fm(6), ...
0080     fm(7)));
0081 display(sprintf('flexure optical, %4.4f, %4.4f, ptel=0+1+2', fm(1), fm(2)));
0082 
0083 
0084 
0085 return;
0086 
0087

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