Changeset 437 for trunk/src


Ignore:
Timestamp:
02/14/05 20:09:27 (20 years ago)
Author:
kil064
Message:

make it work for nPol=1,2 or 4

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDPol.cc

    r429 r437  
    138138void SDStokesEngine::getArray (uInt rownr, Array<Float>& output)
    139139{
    140     IPosition inputShape = findInputShape (output.shape());
    141     Array<Float> input(inputShape); 
     140    Array<Float> input;
    142141    roColumn().get(rownr, input);
    143142//
     
    152151
    153152
    154 void SDStokesEngine::setShape (uInt rownr, const IPosition& outputShape)   
    155 {   
    156     BaseMappedArrayEngine<Float,Float>::setShape (rownr, findInputShape(outputShape));
    157 }
    158  
    159 void SDStokesEngine::setShapeColumn (const IPosition& outputShape)
    160 {
    161     BaseMappedArrayEngine<Float,Float>::setShapeColumn (findInputShape(outputShape));
    162 }
    163      
     153
    164154   
    165155IPosition SDStokesEngine::shape (uInt rownr)
     
    183173
    184174   const uInt nDim = input.ndim();
    185    DebugAssert(nDim==4,AipsError);
    186    DebugAssert(array.ndim()==4,AipsError);
     175   AlwaysAssert(nDim==4,AipsError);
     176   AlwaysAssert(output.ndim()==4,AipsError);
     177//
    187178   const IPosition inputShape = input.shape();
    188179   const uInt polAxis = asap::PolAxis;
    189180   const uInt nPol = inputShape(polAxis);
    190    DebugAssert(nPol==1 || nPol==2 || nPol==3, AipsError);
     181   AlwaysAssert(nPol==1 || nPol==2 || nPol==3, AipsError);
    191182
    192183// The silly Array slice operator does not give me back
     
    247238
    248239
    249 
    250 IPosition SDStokesEngine::findInputShape (const IPosition& outputShape) const
    251 //
    252 // Don't know how to handle the degeneracy that both
    253 // XX    -> I
    254 // XX,YY -> I
    255 //
    256 {
    257    uInt axis = asap::PolAxis;
    258    uInt nPol = outputShape(axis);
    259    IPosition inputShape = outputShape;
    260    if (nPol==1) {
    261       inputShape(axis) = 2;            // XX YY -> I
    262    } else if (nPol==4) {
    263       inputShape(axis) = 4;            // XX YY R(XY) I(XY) -> I Q U V
    264    }
    265    return inputShape;
    266 }
    267240
    268241IPosition SDStokesEngine::findOutputShape (const IPosition& inputShape) const
  • trunk/src/SDPol.h

    r429 r437  
    116116    static void registerClass();
    117117
     118    // Non writable
     119    virtual casa::Bool isWritable () const {return casa::False;}
     120
    118121private:
    119122    // Copy constructor is only used by clone().
     
    147150                     const casa::Array<casa::Float>& target);
    148151
    149     // Set shapes
    150     virtual void setShape (casa::uInt rownr, const casa::IPosition& outputShape);
    151     virtual void setShapeColumn (const casa::IPosition& outputShape);
     152    // Get shape
    152153    virtual casa::IPosition shape (casa::uInt rownr);
    153154
    154     // Convert input/output shapes
    155     casa::IPosition findInputShape (const casa::IPosition& outputShape) const;
     155    // Convert input to output (virtual) shape
    156156    casa::IPosition findOutputShape (const casa::IPosition& inputShape) const;
    157 
    158157
    159158
Note: See TracChangeset for help on using the changeset viewer.