Source
xxxxxxxxxx
DDMapper * DDFunc::getMapper ( String &descr,const Vector<String> &expr0,Bool throw_excp )
//# DDMapper.cc: this defines DDMapper
//# Copyright (C) 2000,2001,2002
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id$
using namespace casacore;
namespace casa { //# NAMESPACE CASA - BEGIN
DDFunc::DDFunc( FuncSignature fsig,const String &corrstr )
: DDMapper(),icorr(-1),func(fsig)
{
corrtype = Stokes::type( corrstr );
valid = false;
}
Bool DDFunc::reset ( const Vector<Int> &corr )
{
icorr = findCorrType( corrtype,corr );
if( icorr<0 )
return valid=false;
corrmask = (1<<icorr);
return valid=true;
}
Float DDFunc::map ( const Cube<Complex> &vis,uInt ich,uInt irow ) const
{
return (*func)( vis(icorr,ich,irow) );
}
Float DDFunc::real ( const Complex &val)
{
return val.real();
}
Float DDFunc::imag ( const Complex &val)
{
return val.imag();
}
DDSumFunc::DDSumFunc( FuncSignature fsig,const String &corr1,const String &corr2 )
: DDFunc(fsig,corr1),icorr2(-1)
{
corrtype2 = Stokes::type( corr2 );
valid = false;
}
Bool DDSumFunc::reset ( const Vector<Int> &corr )
{
// case of "I" - look up XX+YY or RR+LL
if( corrtype == Stokes::I )
{
icorr = findCorrType( Stokes::XX,corr );
icorr2 = findCorrType( Stokes::YY,corr );
// no XX+YY? try RR+LL
if( icorr<0 || icorr2<0 )
{
icorr = findCorrType( Stokes::RR,corr );
icorr2 = findCorrType( Stokes::LL,corr );
}
// give up if not found
if( icorr<0 || icorr2<0 )
return valid=false;
corrmask = (1<<icorr)|(1<<icorr2);
return valid=true;
}