#!/bin/csh


goto start

# --------------------------- B-array map --------------------------------#
rm -r ori.mp ori.bm
invert vis=oriB_RCP.vis,oriB_LCP.vis map=ori.mp beam=ori.bm \
	options=mfs,mosaic,double,systemp sup=0 cell=0.05 imsize=1601 \
    select='uvrange(250,1000)'
  # 1061884 visibilities; theoretical noise 1.032e-3
cgdisp in=ori.mp region='arcsec,box(-15,-15,15,15)' device=/xs
$<
rm -r ori.psf
mospsf beam=ori.bm out=ori.psf
set BOX = 'arcsec,box(-.3,-.3,.3,.3)'
implot in=ori.psf region=$BOX device=/xs
imfit in=ori.psf object=gaussian region=$BOX clip=0
  # 0.295 x 0.210 at -12.18
goto end

rm -r ori.sl
mossdi map=ori.mp beam=ori.bm out=ori.sl niters=1000
rm -r ori.cm
restor map=ori.mp beam=ori.bm model=ori.sl out=ori.cm fwhm=0.295,.210 pa=-12
cgdisp in=ori.cm region='arcsec,box(-10,-10,10,10)' device=/xs options=full
$<
getfluxes.csh ori.cm 
  # SrcI 293 pk, 367 integrated; BN 222 peak, 227 integrated
mv ori.cm oriB250.cm
goto end

# --------------------------- A-array map --------------------------------#
rm -r ori.mp ori.bm
invert vis=oriA.vis map=ori.mp beam=ori.bm \
	options=mfs,mosaic,double,systemp sup=0 cell=0.05 imsize=1601 \
    select='uvrange(250,1500)'
  # 1226646 visibilities; theoretical noise 1.62e-3
cgdisp in=ori.mp region='arcsec,box(-15,-15,15,15)' device=/xs
rm -r ori.psf
mospsf beam=ori.bm out=ori.psf
set BOX = 'arcsec,box(-.3,-.3,.3,.3)'
implot in=ori.psf region=$BOX device=/xs
imfit in=ori.psf object=gaussian region=$BOX clip=0
  # 0.156 x 0.124 at 12.04
goto end

rm -r ori.sl
mossdi map=ori.mp beam=ori.bm out=ori.sl niters=1000
rm -r ori.cm
restor map=ori.mp beam=ori.bm model=ori.sl out=ori.cm fwhm=0.156,.124 pa=12.04
cgdisp in=ori.cm region='arcsec,box(-10,-10,10,10)' device=/xs options=full
$<
getfluxes.csh ori.cm 
  # SrcI 162 pk, 301 integrated; BN 205 peak, 241 integrated
mv ori.cm oriA250.cm
goto end

end:
