<div dir="ltr">Hi Eric,<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 26, 2013 at 11:52 PM, Eric Greisen <span dir="ltr"><<a href="mailto:egreisen@nrao.edu" target="_blank">egreisen@nrao.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Adam Deller wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Eric,<br>
<br>
I have a data reduction problem that I thought you might be interested in.  There is a faint pulsar target separated by 3" from a very bright source.  The observation is VLBA plus phased EVLA, and the phased EVLA synthesized beam is < 3".  So the bright source is in the primary beam for the VLBA, and in the (messy) sidelobes for the EVLA.<br>


<br>
No problem - we'll just peel the bright source, right?  Only thing is, I have a dataset where pulsar gating was using to boost S/N on the target.  The flip side is, in this dataset, S/N is correspondingly reduced on the bright source.  The correlator is blanked for 96% of the time due to the gating, so the S/N change is a factor of 5.  So if I just run a peel on the gated dataset, the S/N on the bright source is not good.<br>


<br>
However, I also have an ungated dataset (so full S/N on the bright source, reduced S/N on the faint target).  So what I'd like to do is *derive* the peeling corrections on the ungated dataset, but *apply* them (and peel out the bright source) on the gated dataset.<br>


<br>
Since the difference between gated and ungated is simply a constant amplitude scaling factor as far as the bright source is concerned, and I know this factor because I know the width of the pulsar gate, this should be easy enough in principle.  Take my model for the bright source, run a peel on the ungated dataset, divide the flux in the bright source model by 1/0.04 = 25, and run peel again on the gated dataset using this model *and the solutions already derived from the ungated dataset*.  That last bit is the bit that is missing, I think.  Is there an easy way to provide PEEL with precooked solution tables?  Or if not, might it be easy to make this an option?<br>


</blockquote>
<br></div>
Peeling in AIPS is done with a procedure which could easily be modified.<br>
<br>
However, what it does is find the self-cal for the peeled source and then restore that source to the data set.  I gather you just want it gone.<br>
<br>
I do not understand the "scaling".  The source in X Jy independent of whether it is observed 1 msec out of 100 or 100 msec out of 100.<br>
<br></blockquote><div><br></div><div>Yes, this is a bit of a sore point.  When doing pulsar binning it would indeed make more sense to have the amplitude scale in the way you suggest. However, it is also possible to weight and sum multiple pulsar bins to get optimum S/N for a pulsar with a complicated profile.  At that point, the concept of the amplitude scale gets a bit wriggly, because of the weighting.  Anyway, long story short, a decision was made that effectively scales down the amplitude of pulsar-binned DiFX data by a factor equal to the reciprocal of the bin duty cycle.  It is easy enough to fix - in this case, I would just have to scale the gated dataset by a factor of 25, and everything would back in the units you expect.<br>

</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The PEELER script takes an image as input and that could certainly come from the full time data set.  If you did it by hand, then one could put together something that also used an SN table developed from the one data set but used in the other.<br>


<br>
I attach the PEELER script which is where we would start...  Take a look.<br></blockquote><div><br></div><div>Ahah - CLINV! That was the missing piece of the puzzle for me.  I didn't know there was a task to invert a CL table.  Perfect.  OK, based on that script I am pretty sure I can put together what I need.  Scale the gated dataset x25, CALIB on the ungated dataset, copy the SN table to the gated dataset, SPLAT/UVSUB/CLINV/SPLAT.  Should be a piece of cake.<br>

</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
BTW - I think you were interested in the task that corrects for pointing and phase stopping positions being offset.  That is called CLVLB and is available in the 31DEC13 AIPS.  Enno and I did not have the happeist results with ot in his test data set.  He got what he claimed were better results with a handling of the geometry that I think is not right  (and he sort of agrees).  The task has both methods plus debug print options.<br>

</blockquote><div><br></div><div>OK thanks, I'll check it out.<br><br>Cheers,<br>Adam<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers<span class="HOEnZb"><font color="#888888"><br>
<br>
Eric<br>
<br>
</font></span><br>$ PEELR.001<br>
$---------------------------------------------------------------<br>
$! RUN file to define procs to calibrate interfering sources<br>
$# Run POPS UV CALIBRATION<br>
$---------------------------------------------------------------<br>
$;  Copyright (C) 2006, 2008<br>
$;  Associated Universities, Inc. Washington DC, USA.<br>
$;<br>
$;  This program is free software; you can redistribute it/or<br>
$;  and/or modify it under the terms of the GNU General Public<br>
$;  License as published by the Free Software Foundation; either<br>
$;  version 2 of the License, or (at your option) any later<br>
$;  version.<br>
$;<br>
$;  This program is distributed in the hope that it will be<br>
$;  useful, but WITHOUT ANY WARRANTY; without even the implied<br>
$;  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
$;  PURPOSE.  See the GNU General Public License for more<br>
$;  details.<br>
$;<br>
$;  You should have received a copy of the GNU General Public<br>
$;  License along with this program; if not, write to the Free<br>
$;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,<br>
$;  MA 02139, USA.<br>
$;<br>
$;  Correspondence concerning AIPS should be addressed as<br>
$;  follows:<br>
$;         Internet email: <a href="mailto:aipsmail@nrao.edu">aipsmail@nrao.edu</a>.<br>
$;         Postal address: AIPS Project Office<br>
$;                         National Radio Astronomy Observatory<br>
$;                         520 Edgemont Road<br>
$;                         Charlottesville, VA 22903-2475 USA<br>
$---------------------------------------------------------------<br>
PROC PEELDEF<br>
STRING*6  CLSCLS, PCLSTEMP<br>
ARRAY     PPARM(100)<br>
SCALAR    PMAX, CLSNUM<br>
FINISH<br>
PROC SETCLASS (CLSCLS, CLSNUM)<br>
pclstemp=char(clsnum)<br>
substr(clscls,7-leng(pclstemp),6)=pclstemp<br>
RETURN; FINISH<br>
PROC CHKIT<br>
chkname<br>
if (error <= 0) then;<br>
   print inna, incl, inse, 'found'; ii=ii+1; end<br>
return; finish<br>
$<br>
PROC PEELR<br>
$                                            defaults<br>
if (ngauss < 1) then; ngauss=1; end<br>
if (outname = ' ') then; outnam=innam; end<br>
if (outcl = ' ') then; outcl='peelr'; end<br>
if (outd=0) then; outd=indi; end<br>
vnum=33-getpopsn; vput peelr; ii = 0; indi=0<br>
$                                            check files<br>
inna=outna; incl='peelus'; inse=getpopsn; chkit<br>
incl='pee001'; for jj=1:ngauss;setclass(incl,jj);chkit; end<br>
incl='peelw0'; chkit; incl='peelw1'; chkit;<br>
incl='peelw2'; chkit; incl=outcl; inse=outse<br>
if (outse>0) then; chkit; end<br>
if (ii > 0) then;<br>
   print 'quitting - delete the listed files<br>
   vget peelr; return; end<br>
$                                            number of facets<br>
dowa 1; pmax=10<br>
for ii=1:100;<br>
   if ((pparm(ii)<=0) & (pmax>=ii)) then; pmax=ii-1; end; end<br>
$                                            initial subtraction<br>
default uvsub; vget peelr; task 'uvsub'<br>
  nmaps = ngaus*nfield; factor=1; outs=1; outcl='PEELUS'; go<br>
intyp=' '<br>
$                                            loop<br>
for ii=1:pmax;<br>
$                                            copy facets<br>
  default subim; vget peelr; task 'subim';<br>
  blc=0; trc=0; xinc=1; yinc=1<br>
  inna=in2n; incl=in2cl; inse=in2se; indi=in2d;<br>
  outc='PEE001'; outs=1<br>
  for jj=1:ngauss; kk=pparm(ii)+(jj-1)*nfield; setclass(incl,kk)<br>
     setclass(outcl,jj); go; end<br>
$                                            add back<br>
  default uvsub; vget peelr; task 'uvsub'; nmaps=ngauss;<br>
  inna=outna; incl='peelus'; inse=1; indi=outdi<br>
  in2n=outna; in2cl='pee001'; in2s=1; in2d=outd<br>
  outcl='peelw0'; outs=1; factor=-1; go; inty='uv'; zap<br>
$                                            calibrate<br>
  default calib; vget peelr; task 'calib';<br>
  inna=outna; incl='peelw0'; inse=1; indi=outdi<br>
  in2n=outna; in2c='pee001'; in2s=1; in2d=outd<br>
  minamp=10; minphs=10;<br>
  if (aparm(7)=0) then; aparm(7)=2; end<br>
  if (aparm(9)=0) then; aparm(9)=1; end<br>
  if (solmod <> 'p') then; solmod='a&p'; end<br>
  outcl='peelw1'; outse=1; nmaps=ngauss; go<br>
$                                            skip imagr for now<br>
$                                            subtract model<br>
  default uvsub; vget peelr; task 'uvsub'<br>
  inna=outna; incl='peelw1'; inse=1; indi=outdi<br>
  in2n=outna; in2cl='pee001'; in2s=1; in2d=outd<br>
  outcl='peelw2'; outs=1; factor=1; nmaps=ngauss; go<br>
  inty='uv'; zap; incl='pee001';  inty='ma';<br>
  for jj=1:ngauss; setclass(incl,jj); zap; end<br>
$                                            invert SN table<br>
  default clinv; vget peelr; task 'clinv'<br>
  inna=outna; incl='peelw0'; inse=1; indi=outdi; outver=1<br>
  outcl='peelw2'; outs=1; inext='sn'; invers=1; opty=' '<br>
  go; inty='uv'; zap<br>
$                                            apply inverted SN<br>
  default split; vget peelr; task 'split'; aparm=0; echan=0<br>
  inna=outna; incl='peelw2'; inse=1; indi=outdi; bchan=0<br>
  outcl='peelus'; outse=1; docalib=1; gainuse=1; douvc=-1;<br>
  go; inty='uv'; zap<br>
  end<br>
$                                            final restoration<br>
default uvsub; vget peelr; task 'uvsub'<br>
inna=outna; incl='peelus'; inse=1; indi=outdi<br>
nmaps = ngaus*nfield; factor=-1; go; zap<br>
$<br>
dowa=-1; vget peelr<br>
return; finish<br>
<br></blockquote></div><br><br clear="all"><br>-- <br>!=============================================================!<br>Dr. Adam Deller                            Ph  +31 521595780<br>Veni Fellow, Astronomy Group       Fax +31 521595101<br>

ASTRON, Oude Hoogeveensedijk 4<br>7991 PD Dwingeloo,
The Netherlands<br>!=============================================================!
</div></div>