This is a static copy of a profile reportHome
pointing_model (5 calls, 3.465 sec)
Generated 05-Aug-2011 13:01:31 using cpu time.
function in file /home/LeechJ/cbass_analysis/pointing/pointing_model.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
calcAzEl2 | function | 5 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
43 | [az,el]=cart2sph(x,y,z); | 5 | 0.820 s | 23.7% |  |
39 | [x,y,z]=sph2cart(az,el,ones(si... | 5 | 0.579 s | 16.7% |  |
51 | el = asin(sin(el)./cos(model(5... | 5 | 0.339 s | 9.8% |  |
53 | az=az-asin(tan(model(5)).*sin(... | 5 | 0.328 s | 9.5% |  |
62 | el=asin(sin(el)./cos(model(6))... | 5 | 0.317 s | 9.1% |  |
All other lines | | | 1.082 s | 31.2% |  |
Totals | | | 3.465 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
cart2sph | function | 5 | 0.809 s | 23.3% |  |
sph2cart | function | 5 | 0.557 s | 16.1% |  |
rotaboutz | function | 10 | 0.142 s | 4.1% |  |
rotabouty | function | 5 | 0.033 s | 0.9% |  |
cross | function | 5 | 0.011 s | 0.3% |  |
Self time (built-ins, overhead, etc.) | | | 1.913 s | 55.2% |  |
Totals | | | 3.465 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 85 |
Non-code lines (comments, blank lines) | 50 |
Code lines (lines that can run) | 35 |
Code lines that did run | 33 |
Code lines that did not run | 2 |
Coverage (did run/can run) | 94.29 % |
Function listing
time calls line
1 function [maz,mel]=pointing_model(model,iaz,iel)
2 % [maz,mel]=pointing_model(model,iaz,iel)
3 %
4 % Convert ideal iaz,iel to model maz,mel using pointing model
5 % parameters tm
6
7 % Cope with older single flexure parameter model
5 8 if(length(model)==8)
9 model=[model(1),0,model(2:8)];
10 end
11
12 % All input params in degrees - convert to rad
5 13 d2r=pi/180;
5 14 model=model*d2r;
0.03 5 15 az=iaz*d2r;
0.02 5 16 el=iel*d2r;
17
18 % Flexure
0.10 5 19 el=el-model(1)*sin(el);
0.11 5 20 el=el-model(2)*cos(el);
21
22 % Az tilt
23 %display('New Az Tilt');
24 %[az1, el1] = azTiltCheck(model, az, el);
25 % the two are equivalent. they're off by about a tenth of an arcsecond.
26
27 % astronomy az is clockwise from north
28 % but want to work in frame with az anticlock from x as for matlab
29 % sph2cart function etc. Also x-east, y-north, z-up seems most
30 % natural.
5 31 az=-az+pi/2;
32
33 % Get normal vector to tilt plane
0.01 5 34 c=cross([1,0,tan(model(3))],[0,1,tan(-model(4))]);
35 % Find magnitude and dir of tilt
5 36 phi=atan2(c(2),c(1));
5 37 theta=atan(sqrt(c(1)^2+c(2)^2./c(3)));
38 % Apply rotation
0.58 5 39 [x,y,z]=sph2cart(az,el,ones(size(az)));
0.07 5 40 [x,y,z]=rotaboutz(x,y,z,phi); % rotate to x along tilt dir
0.04 5 41 [x,y,z]=rotabouty(x,y,z,theta); % rotate by tilt angle
0.10 5 42 [x,y,z]=rotaboutz(x,y,z,-phi); % rotate back
0.82 5 43 [az,el]=cart2sph(x,y,z);
44
45 % Convert back to az clock from north
0.02 5 46 az=-az+pi/2;
47
48 % El tilt
49 % There is no way to do this with vector rotation as axes not perp.
50 % Below is taken from Tim/Martin
0.34 5 51 el = asin(sin(el)./cos(model(5)));
0.02 5 52 el(imag(el)~=0)=NaN;
0.33 5 53 az=az-asin(tan(model(5)).*sin(el)./cos(el));
5 54 az(imag(az)~=0)=NaN;
55
56 % Cross-el Collimation
57
58 % There is no way to do cross-el collimation with vector rotation
59 % Below is taken from Tim/Martin for the case of deck=270
0.26 5 60 az=az-asin(-sin(model(6))./cos(el));
0.02 5 61 az(imag(az)~=0)=NaN;
0.32 5 62 el=asin(sin(el)./cos(model(6)));
0.01 5 63 el(imag(el)~=0)=NaN;
64
65 % El collimation
66 % Exactly the same as el zero point shift
5 67 el=el+model(7);
68
69 % Encoder zero points
0.01 5 70 az=az+model(8);
0.02 5 71 el=el+model(9);
72
73 % cosine of azimuth
74 %az = az + model(10).*sin(az);
75 %el = el + model(11).*cos(az);
76
77 % put phi into 0 to 2pi range
0.11 5 78 ind=az<0; az(ind)=az(ind)+2*pi;
5 79 ind=az>2*pi; az(ind)=az(ind)-2*pi;
80
81 % Convert back to deg
0.09 5 82 maz=az/d2r;
0.03 5 83 mel=el/d2r;
84
5 85 return