timesync2pr
PURPOSE 
function [t,cal,info]=timesync2pr(pr,ra,dec,xoff,yoff,ld,noise,time)
SYNOPSIS 
function [t,cal,info]=timesync2pr(pr,ra,dec,xoff,yoff,ld,noise,time)
DESCRIPTION 
CROSS-REFERENCE INFORMATION 
This function calls:
- fieldoff_to_radec [ra,dec]=fieldoff_to_radec(x,y,racen,deccen)
- dtor function rad=dtor(hours)
- htor function rad=htor(hours)
- r2ra function str=r2ra(rad)
This function is called by:
- survey_sched function int=survey_sched(row,pair,field,start,stop)
SUBFUNCTIONS 
SOURCE CODE 
0001 function [t,cal,info]=timesync2pr(pr,ra,dec,xoff,yoff,ld,noise,time)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 ra=htor(ra)*180/pi;
0054 dec=dtor(dec)*180/pi;
0055
0056
0057 bp=htor(time.bp);
0058 point=htor(time.point);
0059 start=htor(time.start);
0060 start=start+bp+point;
0061 stop=htor(time.stop);
0062 p2p=htor(time.p2p);
0063 calt=htor(time.calt);
0064 p2cslew=htor(time.p2cslew);
0065 lt=htor(time.lt);
0066
0067
0068
0069 [ram,decm]=fieldoff_to_radec(xoff/60, yoff/60 , ra, dec);
0070
0071
0072 p1=(ram(9)-ram(1))*pi/180;
0073 p2=(ram(10)-ram(2))*pi/180;
0074
0075
0076 if (size(ld)==[4 2])
0077 ltr=lt*ld;
0078 else
0079 disp('invalid lt input')
0080 t1=[];
0081 t2=[];
0082 int=[];
0083 return;
0084 end
0085
0086
0087
0088 nt=htor('00:00:09');
0089 if (noise==2)
0090 n(1)=nt;
0091 n(2)=nt;
0092 elseif (noise==1)
0093 n(1)=nt;
0094 n(2)=0;
0095 else
0096 n(1)=0;
0097 n(2)=0;
0098 end
0099
0100 int(1)=p1-(ltr(1,2)+ltr(2,1)+p2p+n(1));
0101 int(2)=p2-(ltr(3,2)+ltr(4,1)+p2p+n(1));
0102
0103
0104
0105 if (ltr==0)
0106 caltotal=2*p2cslew+calt+sum(n);
0107 else
0108 caltotal=2*p2cslew+calt+2*lt+sum(n);
0109 end
0110
0111
0112
0113 f1f2=p1+int(1)+p2p+ltr(2,2)+ltr(3,1)+sum(n);
0114
0115
0116
0117 f10f1=caltotal+int(2)+ltr(4,2)+ltr(1,1)+sum(n);
0118
0119
0120 p2cal=int(2)+p2cslew+ltr(4,2)+lt+sum(n);
0121
0122
0123
0124 fudge='00:03:30';
0125 fudge=htor(fudge);
0126
0127 cal.start{1}=r2ra(start+fudge);
0128 cal.stop{1}=r2ra(start+fudge+calt);
0129
0130 t(1).rad(1)=htor(cal.stop{1})+p2cslew+lt+ltr(1,1)+sum(n);
0131 t(1).start{1}=r2ra(t(1).rad(1));
0132 t(1).stop{1}=r2ra(t(1).rad(1)+int(1));
0133
0134 t(3).rad(1)=t(1).rad(1)+f1f2;
0135 t(3).start{1}=r2ra(t(3).rad(1));
0136 t(3).stop{1}=r2ra(t(3).rad(1)+int(2));
0137
0138 i=1;
0139 while(1)
0140 t(2).rad(i)=t(1).rad(i)+p1;
0141 t(2).start{i}=r2ra(t(2).rad(i));
0142 t(2).stop{i}=r2ra(t(2).rad(i)+int(1));
0143 if (t(2).rad(i)+int(1)>stop)
0144 t(3).rad(i)=[];
0145 t(3).start(i)=[];
0146 t(3).stop(i)=[];
0147 cal.start{i+1}=r2ra(t(2).rad(i)+p2cal);
0148 cal.stop{i+1}=r2ra(t(2).rad(i)+p2cal+calt);
0149 break;
0150 end
0151
0152 t(4).rad(i)=t(3).rad(i)+p2;
0153 t(4).start{i}=r2ra(t(4).rad(i));
0154 t(4).stop{i}=r2ra(t(4).rad(i)+int(2));
0155 cal.start{i+1}=r2ra(t(4).rad(i)+p2cal);
0156 cal.stop{i+1}=r2ra(t(4).rad(i)+p2cal+calt);
0157 if (t(4).rad(i)>stop)
0158 break;
0159 end
0160
0161 i=i+1;
0162 rad=t(4).rad(i-1)+f10f1;
0163 if (rad>stop)
0164 break;
0165 end
0166 t(1).rad(i)=t(4).rad(i-1)+f10f1;
0167 t(1).start{i}=r2ra(t(1).rad(i));
0168 t(1).stop{i}=r2ra(t(1).rad(i)+int(1));
0169
0170 t(3).rad(i)=t(1).rad(i)+f1f2;
0171 t(3).start{i}=r2ra(t(3).rad(i));
0172 t(3).stop{i}=r2ra(t(3).rad(i)+int(2));
0173 end
0174
0175
0176 foo=htor('00:12:00');
0177
0178 info.int1=getminstr(int(1));
0179 info.int2=getminstr(int(2));
0180 info.npr1=length(t(1).start);
0181 info.npr2=length(t(3).start);
0182 info.tpr1=r2ra(p1);
0183 info.tpr2=r2ra(p2);
0184 info.eff=(2*int(1)*info.npr1+2*int(2)*info.npr2)/...
0185 (htor(cal.stop{length(cal.stop)})-start);
0186
0187 info.eff=(2*int(1)*info.npr1+2*int(2)*info.npr2)/htor('06:00:00');
0188
0189
0190
0191 function str=getminstr(rad)
0192
0193
0194 rad=rad*180/pi;
0195
0196 deg2hr=24/360;
0197 hr2min=60;
0198
0199 hr=rad*deg2hr-floor(rad*deg2hr);
0200 min=(hr*hr2min);
0201
0202 str=strcat(num2str(min),'m');
Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005