d=addPtSrc(d,flux,alpha,dra,ddec) Takes a data structure d, all calibrated and ready for conv2uvf, and adds a point source of your choosing to it. flux is the flux at the center of the the sky frequency range. flux is in milliJanskys (mJy). alpha is the spectral index. if it's negative, use a negative value so Flux as a function of frequency is: f=flux * (freq/mean(freq)).^alpha requires at least 2 arguments. assumes unassigned values = 0. if you want to subtract a pt src, try negative flux. dra = ra, in arcsec, from the central pointing ddec = dec, in arcsec, from the central pointing tony, 30th Nov '05
0001 function d=addPtSrc(d,flux,alpha,dra,ddec) 0002 0003 % d=addPtSrc(d,flux,alpha,dra,ddec) 0004 % 0005 % Takes a data structure d, all calibrated and ready for 0006 % conv2uvf, and adds a point source of your choosing to it. 0007 % 0008 % flux is the flux at the center of the 0009 % the sky frequency range. 0010 % 0011 % flux is in milliJanskys (mJy). 0012 % 0013 % alpha is the spectral index. if it's negative, 0014 % use a negative value 0015 % 0016 % so Flux as a function of frequency is: 0017 % f=flux * (freq/mean(freq)).^alpha 0018 % 0019 % requires at least 2 arguments. 0020 % assumes unassigned values = 0. 0021 % if you want to subtract a pt src, try negative flux. 0022 % 0023 % dra = ra, in arcsec, from the central pointing 0024 % ddec = dec, in arcsec, from the central pointing 0025 % 0026 % tony, 30th Nov '05 0027 0028 if nargin < 3 0029 alpha=0; 0030 end 0031 0032 if nargin < 4 0033 dra=0; 0034 end 0035 0036 if nargin < 5 0037 ddec=0; 0038 end 0039 0040 m=sza2uv(d,'difmap'); 0041 0042 x=dra*pi/(180*3600); 0043 y=ddec*pi/(180*3600); 0044 0045 freqs=reshape(m.freq,[1 1 16]); 0046 0047 f=1e-3*flux*(freqs/nanmean(m.freq)).^alpha; 0048 0049 f=repmat(f,[size(d.vis,1) size(d.vis,2)]); 0050 0051 d.vis=d.vis + f.*(exp(j*2*pi*(x*m.u+y*m.v)));