This is a static copy of a profile reportHome
sunUpDown (1 call, 0.120 sec)
Generated 05-Aug-2011 13:00:34 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/sunUpDown.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 |
11 | [rhr,rmin,shr,smin]=sunrise(da... | 1 | 0.066 s | 54.5% |  |
30 | sundown=sort1|sort3|sort5; | 1 | 0.011 s | 9.1% |  |
28 | sort6= datemjd>(sunvecSort(... | 1 | 0.011 s | 9.1% |  |
26 | sort4= (datemjd>(sunvecSort... | 1 | 0.011 s | 9.1% |  |
23 | sort1= (datemjd>(sunvecSort... | 1 | 0.011 s | 9.1% |  |
All other lines | | | 0.011 s | 9.1% |  |
Totals | | | 0.120 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
sunrise | function | 1 | 0.066 s | 54.5% |  |
datenum | function | 1 | 0.011 s | 9.1% |  |
date2mjd | function | 2 | 0 s | 0% |  |
mjd2date | function | 1 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.044 s | 36.4% |  |
Totals | | | 0.120 s | 100% | |
Code Analyzer results
Line number | Message |
10 | The value assigned to variable 'date' might be unused. |
30 | The value assigned to variable 'sundown' might be unused. |
31 | IF might not be aligned with its matching END (line 40). |
39 | The value assigned to variable 'sundown' might be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 44 |
Non-code lines (comments, blank lines) | 12 |
Code lines (lines that can run) | 32 |
Code lines that did run | 21 |
Code lines that did not run | 11 |
Coverage (did run/can run) | 65.62 % |
Function listing
time calls line
1 function sunupdown=sunUpDown(datemjd,lat,long,buffer)
2 %%%%%%%
3 %function that returns 1 if the sun is up and 0 if the sun is down for a
4 %given lat long (in degrees) and mjd CJC 18/5/2010
5 %Inputs datemjd
6 % latitude (degrees)
7 % longitude (degrees)
1 8 [year,month,day,hour,minute,second]=mjd2date(datemjd(1));
9
0.01 1 10 date = datenum(year,month,day,hour,minute,second);
0.07 1 11 [rhr,rmin,shr,smin]=sunrise(day,month,year,lat,long);
1 12 MJD_rise = date2mjd(year, month, day, rhr, rmin, 0); %sun rise in MJD
1 13 MJD_set = date2mjd(year, month, day, shr, smin, 0); %sun set in MJD
1 14 MJD_risePrev=MJD_rise-1;
1 15 MJD_setPrev=MJD_set-1;
1 16 MJD_riseNext=MJD_rise+1;
1 17 MJD_setNext=MJD_set+1;
18
1 19 sunvec=[MJD_risePrev MJD_setPrev MJD_rise MJD_set MJD_riseNext MJD_setNext];
1 20 sunvecSort=sort(sunvec);
21
1 22 if(sunvecSort(1)==MJD_setPrev)
0.01 1 23 sort1= (datemjd>(sunvecSort(1)+((buffer/60)/24))) & (datemjd<(sunvecSort(2)-((buffer/60)/24))) ; %sundown
1 24 sort2= (datemjd>(sunvecSort(2)-((buffer/60)/24))) & (datemjd<(sunvecSort(3)+((buffer/60)/24))) ; %sunup
1 25 sort3= (datemjd>(sunvecSort(3)+((buffer/60)/24))) & (datemjd<(sunvecSort(4)-((buffer/60)/24))) ; %sundown
0.01 1 26 sort4= (datemjd>(sunvecSort(4)-((buffer/60)/24))) & (datemjd<(sunvecSort(5)+((buffer/60)/24))) ; %sunup
1 27 sort5= (datemjd>(sunvecSort(5)+((buffer/60)/24))) & (datemjd<(sunvecSort(6)-((buffer/60)/24))) ; %sundown
0.01 1 28 sort6= datemjd>(sunvecSort(6)-((buffer/60)/24)) ; %sunup
1 29 sunup=sort2|sort4|sort6;
0.01 1 30 sundown=sort1|sort3|sort5;
31 else if(sunvecSort(1)==MJD_risePrev)
32 sort1= datemjd>(sunvecSort(1)-((buffer/60)/24)) & (datemjd<(sunvecSort(2)+((buffer/60)/24))) ; %sunup
33 sort2= datemjd>(sunvecSort(2)+((buffer/60)/24)) & (datemjd<(sunvecSort(3)-((buffer/60)/24))) ; %sundown
34 sort3= datemjd>(sunvecSort(3)-((buffer/60)/24)) & (datemjd<(sunvecSort(4)+((buffer/60)/24))) ; %sunup
35 sort4= datemjd>(sunvecSort(4)+((buffer/60)/24)) & (datemjd<(sunvecSort(5)-((buffer/60)/24))) ; %sundown
36 sort5= datemjd>(sunvecSort(5)-((buffer/60)/24)) & (datemjd<(sunvecSort(6)+((buffer/60)/24))) ; %sunup
37 sort6= datemjd>(sunvecSort(6)+((buffer/60)/24)) ; %sundown
38 sunup=sort1|sort3|sort5;
39 sundown=sort2|sort4|sort6;
40 end
41 end
42
43
1 44 sunupdown =sunup; %positive when the sun is up
Other subfunctions in this file are not included in this listing.