0001 function rad_set(lststart, lstspace, lstfinish, fluxLim, filename)
0002
0003
0004
0005
0006
0007
0008
0009
0010 clf
0011 lat=37;
0012 d2r=pi/180; r2d=180/pi;
0013 ellim=25;
0014
0015
0016 figure(2)
0017 clf
0018 polar(10,91)
0019 hold on
0020 view(-90,90)
0021
0022
0023 if (~exist('lststart'))
0024 lststart=0;
0025 end
0026
0027
0028 if (~exist('lstfinish'))
0029 lstfinish=lststart+12;
0030 end
0031
0032
0033 if (~exist('lstspace'))
0034 lstspace=0.25;
0035 end
0036
0037
0038 [names,flux, ra ,dec]=textread(filename,'%s %f %s %s %*s\n','commentstyle','matlab');
0039
0040
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
0062 [ra,dec]=ast2fracdeg(ra,dec);
0063
0064 lat=lat*d2r;
0065 dec=dec*d2r;
0066
0067
0068 for lstp=lststart:lstspace:lstfinish
0069
0070 if lstp>24
0071 lst=lstp-24;
0072 else
0073 lst=lstp;
0074 end
0075
0076
0077 ha=lst*ones(num,1)-ra/15;
0078 ha=15*ha*d2r;
0079
0080
0081 cat.name=names;
0082 cat.flux=flux;
0083 [cat.az,cat.el]=hdl2ae(ha,dec,lat);
0084 cat.az=cat.az*r2d; cat.el=cat.el*r2d;
0085
0086
0087 ind=cat.el>ellim;
0088 cat=structcut(cat,ind);
0089 ind=cat.flux>fluxLim;
0090 cat=structcut(cat,ind);
0091
0092
0093
0094
0095 if (lst==lststart)
0096 nextsource=1;
0097 obs.az=cat.az(1);
0098 obs.el=cat.el(1);
0099 else
0100
0101
0102 nextsource=neighbor(obs,cat);
0103
0104
0105 obs.az=[obs.az;cat.az(nextsource)];
0106 obs.el=[obs.el;cat.el(nextsource)];
0107 end
0108
0109
0110 disp(sprintf('{%8s, %2.2f, %2.2f},',cat.name{nextsource},lst, cat.flux(nextsource)))
0111 polar(d2r*cat.az(nextsource),90-cat.el(nextsource),'ob')
0112
0113 end
0114
0115 return
0116
0117
0118 function [nextsource]=furthest(obs,cat)
0119
0120
0121
0122
0123
0124
0125 sumsa=zeros(length(cat.az),1);
0126 for k=1:length(obs.az)
0127
0128
0129 ob.az=obs.az(k)*ones(length(cat.az),1);
0130 ob.el=obs.el(k)*ones(length(cat.az),1);
0131 sa=spaceangle(ob.az,ob.el,cat.az,cat.el);
0132 sumsa=sumsa+sa;
0133 end
0134
0135 [mx,nextsource]=max(sumsa);
0136 return
0137
0138 function [nextsource]=neighbor(obs,cat)
0139
0140
0141
0142
0143 nearest=zeros(length(cat.az),1);
0144
0145 for k=1:length(cat.az)
0146
0147
0148 el=cat.el(k)*ones(length(obs.el),1);
0149 az=cat.az(k)*ones(length(obs.az),1);
0150 sa=spaceangle(az,el,obs.az,obs.el);
0151 nearest(k,1)=min(sa);
0152 end
0153
0154
0155 [mx,nextsource]=max(nearest);
0156
0157 return