Home > pointing > rad_set_south.m

rad_set_south

PURPOSE ^

function rad_set_south(lststart,lstspace, lstfinish)

SYNOPSIS ^

function rad_set_south(lststart, lstspace, lstfinish, fluxLim, filename)

DESCRIPTION ^

 function rad_set_south(lststart,lstspace, lstfinish)

 Plot the range of elevations and az of a list of sources in rad_sources.cat
 visible starting at lststart and spaced at lstspace intervals (the
 time it takes to do one cross)

 Use lst>24 here-program will take care of it

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function rad_set_south(lststart, lstspace, lstfinish, fluxLim, filename)
0002 % function rad_set_south(lststart,lstspace, lstfinish)
0003 %
0004 % Plot the range of elevations and az of a list of sources in rad_sources.cat
0005 % visible starting at lststart and spaced at lstspace intervals (the
0006 % time it takes to do one cross)
0007 %
0008 % Use lst>24 here-program will take care of it
0009 
0010 clf
0011 lat=-26;       % Latitude of the site
0012 d2r=pi/180; r2d=180/pi;
0013 ellim=25;   % elevation limit below which we don't look
0014   
0015 % Initialize plot
0016 figure(2)
0017 clf
0018 polar(10,91)
0019 hold on
0020 view(-90,90)
0021 
0022 % Default lststart is 0
0023 if (~exist('lststart'))
0024   lststart=0;
0025 end
0026 
0027 % default is to run for 12 hours
0028 if (~exist('lstfinish'))
0029   lstfinish=lststart+12;
0030 end
0031 
0032 % Default lstspace is half hour
0033 if (~exist('lstspace'))
0034   lstspace=0.25;
0035 end
0036 
0037 % Read sources in-num is how many sources are in catalog
0038 [names,flux, ra ,dec]=textread(filename,'%s %f %s %s %*s\n','commentstyle','matlab');
0039 
0040 % add a + for positive declination
0041 for i=1:size(ra,1)
0042   if ~strcmp( dec{i}(1),'-')
0043     if ~strcmp( dec{i}(1), '+')
0044       dec{i}=['+',dec{i}];
0045     end
0046   end
0047 end
0048 
0049 ind = flux>fluxLim;
0050 names = names(ind);
0051 flux = flux(ind);
0052 ra = ra(ind);
0053 dec = dec(ind);
0054 
0055 
0056     
0057 num=length(ra);
0058 disp(sprintf('%1f sources read',num))
0059 
0060 
0061 % Convert to fractional degrees
0062 [ra,dec]=ast2fracdeg(ra,dec);
0063 % Convert input params in degrees and hours to radians
0064 lat=lat*d2r;
0065 dec=dec*d2r;
0066 
0067 lat
0068 ra
0069 dec
0070 
0071 % Loop through lst range
0072 for lstp=lststart:lstspace:lstfinish
0073 % keep lstp in normal range
0074   if lstp>24
0075     lst=lstp-24;
0076   else 
0077     lst=lstp;
0078   end
0079   
0080   % Hour angle is defined as lst minus ra, here given in degrees
0081   ha=lst*ones(num,1)-ra/15;
0082   ha=15*ha*d2r; 
0083 
0084   % Generate az, el for sources at this lst
0085   cat.name=names;
0086   cat.flux=flux;
0087   [cat.az,cat.el]=hdl2ae(ha,dec,lat);
0088   cat.az=cat.az*r2d; cat.el=cat.el*r2d;
0089 
0090   % Only interested in sources higher than 15 degrees
0091   ind=cat.el>ellim;
0092   cat=structcut(cat,ind);
0093   ind=cat.flux>fluxLim;
0094   cat=structcut(cat,ind);
0095   
0096   % If it's the first source, take the first object
0097   % Otherwise look for the object furthest from the already observed
0098   % sources
0099   if (lst==lststart)
0100     nextsource=1;
0101     obs.az=cat.az(1);
0102     obs.el=cat.el(1);
0103   else
0104     % Method=2 means next source is the one with the furthest nearest
0105     % neighbor (think about it)
0106     nextsource=neighbor(obs,cat);
0107     
0108     % Extend obs to hold the new point
0109     obs.az=[obs.az;cat.az(nextsource)];
0110     obs.el=[obs.el;cat.el(nextsource)];
0111   end
0112   
0113   %    disp(sprintf('%8s,',cat.name{nextsource}))
0114   disp(sprintf('{%8s, %2.2f, %2.2f},',cat.name{nextsource},lst, cat.flux(nextsource)))
0115   polar(d2r*cat.az(nextsource),90-cat.el(nextsource),'ob')
0116   
0117 end
0118 
0119 return
0120 
0121 
0122 function [nextsource]=furthest(obs,cat)
0123 % function [nextsource]=furthest(obs,cat)
0124 %
0125 % nextsource is the index of the source in cat(az,el) that maximizes the
0126 % sum of space angles to already observed sources in obs(az,el)
0127 
0128 % sumsa is the sum of the space angles to all observed sources
0129 sumsa=zeros(length(cat.az),1);
0130 for k=1:length(obs.az)
0131   % Space ANgle between kth already observed source and all cat
0132   % sources
0133   ob.az=obs.az(k)*ones(length(cat.az),1);
0134   ob.el=obs.el(k)*ones(length(cat.az),1);
0135   sa=spaceangle(ob.az,ob.el,cat.az,cat.el);
0136   sumsa=sumsa+sa;
0137 end
0138 
0139 [mx,nextsource]=max(sumsa);
0140 return
0141 
0142 function [nextsource]=neighbor(obs,cat)
0143 % function [nextsource]=neighbor(obs,cat)
0144 %
0145 % nextsource is the index of the source that has the largest value of
0146 % the distance to its nearest neighbor among points already observed
0147 nearest=zeros(length(cat.az),1);
0148 
0149 for k=1:length(cat.az)
0150   % Find space angle between every observed source and this option for
0151   % the next source and take nearest neighbor
0152   el=cat.el(k)*ones(length(obs.el),1);
0153   az=cat.az(k)*ones(length(obs.az),1);
0154   sa=spaceangle(az,el,obs.az,obs.el);
0155   nearest(k,1)=min(sa);
0156 end
0157 
0158 % Choose the source with the largest nearest neighbor distance
0159 [mx,nextsource]=max(nearest);
0160 
0161 return

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005