This is a static copy of a profile reportHome
coco (1 call, 0.853 sec)
Generated 05-Aug-2011 13:00:30 using cpu time.
function in file /home/LeechJ/cbass_analysis/pointing/coco.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
153 | OutCoo = cosined([OutCosDir.']... | 1 | 0.601 s | 70.5% |  |
89 | InCosDir = cosined(InCoo); | 1 | 0.131 s | 15.4% |  |
149 | OutCosDir = TotRot*[InCosDir.'... | 1 | 0.066 s | 7.7% |  |
72 | OutList = zeros(size(InList)); | 1 | 0.022 s | 2.6% |  |
139 | RotM2 = rotm_coo('g',2451545.5... | 1 | 0.011 s | 1.3% |  |
All other lines | | | 0.022 s | 2.6% |  |
Totals | | | 0.853 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
cosined | function | 2 | 0.678 s | 79.5% |  |
rotm_coo | function | 1 | 0 s | 0% |  |
str2num | function | 1 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.175 s | 20.5% |  |
Totals | | | 0.853 s | 100% | |
Code Analyzer results
Line number | Message |
1 | Extra semicolon is unnecessary. |
59 | STR2DOUBLE is faster than STR2NUM; however, STR2DOUBLE operates only on scalars. Use the function that best suits your needs. |
65 | STR2DOUBLE is faster than STR2NUM; however, STR2DOUBLE operates only on scalars. Use the function that best suits your needs. |
71 | The value assigned to variable 'OutCoo' might be unused. |
149 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
153 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 168 |
Non-code lines (comments, blank lines) | 68 |
Code lines (lines that can run) | 100 |
Code lines that did run | 36 |
Code lines that did not run | 64 |
Coverage (did run/can run) | 36.00 % |
Function listing
time calls line
1 function [OutList,TotRot]=coco(InList,InCooType,OutCooType,InUnits,OutUnits);
2 %--------------------------------------------------------
3 % coco function General coordinate convertor.
4 % Convert/precess coordinate from/to
5 % Equatorial/galactic/Ecliptic.
6 % Input : - Matrix of input coordinates.
7 % First column for Long/RA and second column
8 % for lat/Dec.
9 % - Type of input coordinates.
10 % 'j####.#' - equatorial, mean of date (default 'j2000.0'). [Julian].
11 % 'J####.#' - equatorial, true of date (default 'j2000.0'). [Julian].
12 % 'g' - J2000.0 galactic.
13 % 'e' - Ecliptic with J2000.0 equinox.
14 % - Type of outpt coordinates.
15 % 'j####.#' - equatorial, mean of date (default 'j2000.0'). [Julian].
16 % 'J####.#' - equatorial, true of date (default 'j2000.0'). [Julian].
17 % 'g' - J2000.0 galactic. (default)
18 % 'e' - Ecliptic with J2000.0 equinox.
19 % - Units for input coordinates.
20 % 'r' - radians. (default)
21 % 'd' - degrees.
22 % 'h' - hours/deg.
23 % - Units for outpu coordinates.
24 % 'r' - radians. (default)
25 % 'd' - degrees.
26 % 'h' - hours/deg.
27 % Output : - Matrix of output coordinates.
28 % - Total rotation matrix.
29 % Tested : Matlab 5.3
30 % By : Eran O. Ofek Febuary 2000 / June 2000 / December 2002
31 % URL : http://wise-obs.tau.ac.il/~eran/matlab.html
32 %--------------------------------------------------------
1 33 RADIAN = 180./pi;
34
1 35 if (nargin==1),
36 InCooType = 'j2000.0';
37 OutCooType = 'g';
38 InUnits = 'r';
39 OutUnits = 'r';
1 40 elseif (nargin==2),
41 OutCooType = 'g';
42 InUnits = 'r';
43 OutUnits = 'r';
1 44 elseif (nargin==3),
45 InUnits = 'r';
46 OutUnits = 'r';
1 47 elseif (nargin==4),
48 OutUnits = 'r';
1 49 elseif (nargin==5),
50 % do nothing
51 else
52 error('Illigal number of input arguments');
53 end
54
1 55 LenInType = length(InCooType);
1 56 LenOutType = length(OutCooType);
57
1 58 if (LenInType>1),
1 59 InEquinox = str2num(InCooType(2:LenInType));
1 60 InEquinoxJD = 2451545.5 + 365.25.*(InEquinox - 2000);
1 61 InCooType = InCooType(1);
1 62 end
63
1 64 if (LenOutType>1),
65 OutEquinox = str2num(OutCooType(2:LenOutType));
66 OutEquinoxJD = 2451545.5 + 365.25.*(OutEquinox - 2000);
67 OutCooType = OutCooType(1);
68 end
69
0.01 1 70 InCoo = zeros(size(InList));
1 71 OutCoo = zeros(size(InList));
0.02 1 72 OutList = zeros(size(InList));
73
1 74 switch InUnits
1 75 case {'r'}
1 76 InCoo = InList;
77 case {'d'}
78 % convert deg. to radians
79 InCoo = InList./RADIAN;
80 case {'h'}
81 % convert h/d to radians
82 InCoo(:,1) = InList(:,1).*15./RADIAN;
83 InCoo(:,2) = InList(:,2)./RADIAN;
84 otherwise
85 error('Unknown type of input units');
86 end
87
88 % convert coordinates to direction cosines
0.13 1 89 InCosDir = cosined(InCoo);
90
91
1 92 RotM1 = diag([1 1 1]);
93
94 % calculate the first rotation matrix
1 95 switch InCooType
1 96 case {'j','J'}
1 97 if (InEquinox~=2000.0),
98 % precess coordinates to J2000.0
99 switch InCooType
100 case {'j'}
101 % mean equinox ...
102 RotM1 = rotm_coo('p',InEquinoxJD);
103 case {'J'}
104 % true equinox ...
105 RotM1 = rotm_coo('pd',InEquinoxJD);
106 otherwise
107 error('Illegal InCooType');
108 end
109 end
110 case {'g'}
111 % convert to Equatorial J2000.0
112 RotM1 = rotm_coo('G',2451545.5);
113 case {'e'}
114 % convert to Equatorial J2000.0
115 RotM1 = rotm_coo('E',2451545.5);
116 otherwise
117 error('Unknown input coordinaytes type');
118 end
119
1 120 RotM2 = diag([1 1 1]);
121 % calculate the second rotation matrix
1 122 switch OutCooType
1 123 case {'j','J'}
124 if (OutEquinox~=2000.0),
125 % precess coordinates from J2000.0
126 switch OutCooType
127 case {'j'}
128 % mean equinox ...
129 RotM2 = rotm_coo('P',OutEquinoxJD);
130 case {'J'}
131 % true equinox ...
132 RotM2 = rotm_coo('Pd',OutEquinoxJD);
133 otherwise
134 error('Illegal OutCooType');
135 end
136 end
1 137 case {'g'}
138 % convert to galactic
0.01 1 139 RotM2 = rotm_coo('g',2451545.5);
140 case {'e'}
141 % convert to ecliptic
142 RotM2 = rotm_coo('e',2451545.5);
143 otherwise
144 error('Unknown output coordinaytes type');
145 end
146
147 % rotate coordinates
1 148 TotRot = RotM2*RotM1;
0.07 1 149 OutCosDir = TotRot*[InCosDir.'];
150
151
152 % convert coordinates from direction cosines
0.60 1 153 OutCoo = cosined([OutCosDir.']);
154
155
1 156 switch OutUnits
1 157 case {'r'}
1 158 OutList = OutCoo;
159 case {'d'}
160 % convert radians to deg.
161 OutList = OutCoo.*RADIAN;
162 case {'h'}
163 % convert radians to h/d
164 OutList(:,1) = OutCoo(:,1).*RADIAN./15;
165 OutList(:,2) = OutCoo(:,2).*RADIAN;
166 otherwise
167 error('Unknown type of output units');
168 end
Other subfunctions in this file are not included in this listing.