IPosition PolnRIndex(4,0,0,0,0), PolnLIndex(4,0,0,3,0);
IPosition tndx(4,0,0,0,0);
for(tndx(3)=0;tndx(3)<apertureShape(3);tndx(3)++) // The freq. axis
for(tndx(2)=0;tndx(2)<apertureShape(2);tndx(2)++) // The Poln. axis
for(tndx(1)=0;tndx(1)<apertureShape(1);tndx(1)++) // The spatial
for(tndx(0)=0;tndx(0)<apertureShape(0);tndx(0)++) // axis.
PolnRIndex(0)=PolnLIndex(0)=tndx(0);
PolnRIndex(1)=PolnLIndex(1)=tndx(1);
val = ap.aperture->getAt(tndx);
Rval = ap.aperture->getAt(PolnRIndex);
//Lval = ap.aperture->getAt(PolnLIndex);
phase = arg(Rval); Rval=Complex(cos(phase),sin(phase));
//phase = arg(Lval); Lval=Complex(cos(phase),sin(phase));
// if (tndx(2)==0) ap.aperture->putAt(val*conj(Rval),tndx);
// else if (tndx(2)==1) ap.aperture->putAt(val*conj(Lval),tndx);
// else if (tndx(2)==2) ap.aperture->putAt(val*conj(Rval),tndx);