Home > matutils > mosaic > timesync2pr.m

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 ^

 function [t,cal,info]=timesync2pr(pr,ra,dec,xoff,yoff,ld,noise,time)

 calculates lst time for 2 pair CMB mosaic observation

 pr    - pairs, ie [1 9 2 10] pairs (1,9),(2,10)
 ra    - RA of field center in hr angle, ie '9:00'
 dec   - Dec of field center, ie '30:00'
 xoff  - x offset for entire row in arcmin, ie [.... -3.3 3.3 ...]
 yoff  - y offset for entire row in arcmin, ie [... 0 0 ...]
 ld    - load cal time for begining and ending load opportunities
         example:
             {1,0;
              0,1;
              1,0;
              0,1}

         means field 1 do load cal at start, and field 9 do load cal
         at end.  same for fields 2 and 10.

 noise  - 2: bracketing noise, begining and end of integration
        - 1: one noise before integration
        - 0: no noise at all

 struct time:
   start - lst start time of observation 
   stop  - lst stop time of observation
   p2p   - slew time between pairs 
           example: pairs (1,9),(2,10), 
           p2p='00:00:14'
           means takes 14s to slew from 9 to 2.
   calt  - integration time on calibrator '00:03:00'
   p2cslew - slew time from field to calibrator in hour string 
   lt    - time for load cal in string
           '00:00:12'
   bp    - bandpass time
   point - pointing time

 Output:
   t: t(n) structure array corresponding to fields in pr(n)
      t.start - start time
      t.stop  - stop time
      t.rad   - angle of start time

   cal: similar as t except for the calibrator

   info: structure containing info

 Michael Loh

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [t,cal,info]=timesync2pr(pr,ra,dec,xoff,yoff,ld,noise,time)
0002 
0003 % function [t,cal,info]=timesync2pr(pr,ra,dec,xoff,yoff,ld,noise,time)
0004 %
0005 % calculates lst time for 2 pair CMB mosaic observation
0006 %
0007 % pr    - pairs, ie [1 9 2 10] pairs (1,9),(2,10)
0008 % ra    - RA of field center in hr angle, ie '9:00'
0009 % dec   - Dec of field center, ie '30:00'
0010 % xoff  - x offset for entire row in arcmin, ie [.... -3.3 3.3 ...]
0011 % yoff  - y offset for entire row in arcmin, ie [... 0 0 ...]
0012 % ld    - load cal time for begining and ending load opportunities
0013 %         example:
0014 %             {1,0;
0015 %              0,1;
0016 %              1,0;
0017 %              0,1}
0018 %
0019 %         means field 1 do load cal at start, and field 9 do load cal
0020 %         at end.  same for fields 2 and 10.
0021 %
0022 % noise  - 2: bracketing noise, begining and end of integration
0023 %        - 1: one noise before integration
0024 %        - 0: no noise at all
0025 %
0026 % struct time:
0027 %   start - lst start time of observation
0028 %   stop  - lst stop time of observation
0029 %   p2p   - slew time between pairs
0030 %           example: pairs (1,9),(2,10),
0031 %           p2p='00:00:14'
0032 %           means takes 14s to slew from 9 to 2.
0033 %   calt  - integration time on calibrator '00:03:00'
0034 %   p2cslew - slew time from field to calibrator in hour string
0035 %   lt    - time for load cal in string
0036 %           '00:00:12'
0037 %   bp    - bandpass time
0038 %   point - pointing time
0039 %
0040 % Output:
0041 %   t: t(n) structure array corresponding to fields in pr(n)
0042 %      t.start - start time
0043 %      t.stop  - stop time
0044 %      t.rad   - angle of start time
0045 %
0046 %   cal: similar as t except for the calibrator
0047 %
0048 %   info: structure containing info
0049 %
0050 % Michael Loh
0051 
0052 % convert to deg for fieldoff_to_radec
0053 ra=htor(ra)*180/pi;
0054 dec=dtor(dec)*180/pi;
0055 
0056 % keep as radians
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 % find angle difference in radians
0072 p1=(ram(9)-ram(1))*pi/180;
0073 p2=(ram(10)-ram(2))*pi/180;
0074 
0075 % convert lt to radians
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 % find integration time
0087 % 2 noise cal, 8s each
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 % total time wasted on calibrator, ie, time from end of last field to
0104 % start of first field
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 % total time between start of first field of first pair and first
0112 % field of second pair
0113 f1f2=p1+int(1)+p2p+ltr(2,2)+ltr(3,1)+sum(n);
0114 
0115 % total time between start of last field of pair two, to start of
0116 % first field of pair one
0117 f10f1=caltotal+int(2)+ltr(4,2)+ltr(1,1)+sum(n);
0118 
0119 % time from start of last field to start of calibrator
0120 p2cal=int(2)+p2cslew+ltr(4,2)+lt+sum(n);
0121 
0122 % start observing track one after cal + some fudge factor
0123 % assume 3:30 to slew from bp to cal
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   % slew to calibrator
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 % convert to deg
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