Changeset 469 for trunk/src/SDPol.h


Ignore:
Timestamp:
02/18/05 11:11:01 (19 years ago)
Author:
kil064
Message:

new functions for the SDWriter to handle Stokes output
for SDFITS / MS. This is bit of a mess...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDPol.h

    r459 r469  
    155155                                                 const casa::Array<casa::Float>& U);
    156156
    157 // Rotate phase of Complex correlation C3+iC4 by phase (degrees)
     157 // Rotate phase of Complex correlation C3+iC4 by phase (degrees)
    158158  static void rotateXYPhase (casa::Array<casa::Float>& C3,
    159159                             casa::Array<casa::Float>& C4,
     
    163163// already be setup to access the Array at the current cursor location
    164164// (beam, IF, Pol; see SDMemTable).   The desired Stokes
    165 // is specfied in the string from "I", "Q", "U", "V"
     165// is specified in the string from "I", "Q", "U", "V"
    166166  static casa::Array<casa::Float> getStokesSlice (casa::Array<casa::Float>& input, const casa::IPosition& start,
    167167                                                  const casa::IPosition& end, const casa::String& stokes);
     
    173173
    174174
    175 // Compute value for STokes parameters by combining the raw correlation values
    176 // The output shape may change from the input shape according to
    177 // XX or YY          -> I
    178 // XX,YY             -> I
    179 // XX,YY,R(XY),I(XY) -> I,Q,U,V
    180 // Bool for mask
    181 // Float for TSys
     175// Compute value for auxilliary spectra when converting to Stokes parameters.
     176// This combines the raw correlation values, according to what was combined
     177// to actually convert to Stokes parameters.   The output shape may change from
     178// the input shape according to
     179// XX or YY          -> I             (1 -> 1)
     180// XX,YY             -> I             (2 -> 1)
     181// XX,YY,R(XY),I(XY) -> I,Q,U,V       (4 -> 4)
     182//
     183// It is meant for tSys (FLoat) and masks (Bool or uChar)
     184// The input array must be of shape [nBeam,nIF,nPol,nChan]
    182185  template <class T>
    183186  static casa::Array<T> stokesData (casa::Array<T>& rawData, casa::Bool doLinear);
    184  
     187
     188// Find the number of STokes parameters given the input number
     189// of raw polarizations
     190   static casa::uInt numberStokes (casa::uInt nPol) {casa::uInt nOut = nPol; if (nPol==2) nOut = 1; return nOut;};
    185191
    186192// Find the Stokes type for the given polarization axis (0,1,2,3)
    187 // You can ask for STokes or raw correltions (linear or circular)
     193// You can ask for STokes or raw correlations (linear or circular)
    188194   static casa::Stokes::StokesTypes convertStokes(casa::Int val, casa::Bool toStokes,
    189195                                                  casa::Bool linear);
     196
     197
     198// These two functions are explicitly for the SDWriter
     199//
     200// Compute value for auxilliary spectra (Tsys and flags) when converting to Stokes parameters.
     201// This combines the raw correlation values, according to what was combined
     202// to actually convert to Stokes parameters.   The output shape may change from
     203// the input shape according to
     204// XX or YY          -> I             (1 -> 1)
     205// XX,YY             -> I             (2 -> 1)
     206// XX,YY,R(XY),I(XY) -> I,Q,U,V       (4 -> 4)
     207//
     208// The input array must be of shape [nChan,nPol]  (flags)
     209// The input array must be of shape [nPol]        (tSys)
     210//
     211  static casa::Array<casa::uChar> computeStokesFlagsForWriter (casa::Array<casa::uChar>& rawData, casa::Bool doLinear)
     212                                                         {return computeStokesDataForWriter(rawData,doLinear);};
     213  static casa::Array<casa::Float> computeStokesTSysForWriter (casa::Array<casa::Float>& rawData, casa::Bool doLinear)
     214                                                         {return computeStokesDataForWriter(rawData,doLinear);};
     215
     216// This function is explcitrly for SDWriter. It extracts the Beam and IF slice (specified in start
     217// and end - must be length 1 in beam and IF) and flips the pol and channel axes.
     218  static casa::Array<casa::Float> extractStokesForWriter (casa::Array<casa::Float>& in, const casa::IPosition& start,
     219                                                          const casa::IPosition& end);
    190220
    191221private:
     
    197227                                            const casa::Array<casa::Bool>& in2)
    198228                                            {return in1&&in2;}
     229  static casa::Array<casa::uChar> andArrays (const casa::Array<casa::uChar>& in1,
     230                                            const casa::Array<casa::uChar>& in2);
     231 
     232  template <class T>
     233  static casa::Array<T> computeStokesDataForWriter (casa::Array<T>& rawData, casa::Bool doLinear);
    199234};
    200235
Note: See TracChangeset for help on using the changeset viewer.