MsRows.h

Go to the documentation of this file.
00001 /*
00002  * MsRows.h
00003  *
00004  *  Created on: Feb 20, 2013
00005  *      Author: jjacobs
00006  */
00007 
00008 #if ! defined (MsVis_MsRows_H)
00009 #define MsVis_MsRows_H
00010 
00011 #include <msvis/MSVis/VisBuffer2.h>
00012 #include <vector>
00013 
00014 namespace casa {
00015 
00016 namespace vi{
00017 
00018     class VisBuffer2;
00019 }
00020 
00021 namespace ms {
00022 
00023 //class MsRowAttributes {
00024 //
00025 //public:
00026 //
00027 //    MsRowAttributes (Int row, VisBuffer2 * vb)
00028 //    : row_p (row), vb_p (vb)
00029 //    {}
00030 //
00031 //    Int antenna1 () const;
00032 //    Int antenna2 () const;
00033 //    Int array () const;
00034 //    Int dataDescriptionId () const;
00035 //    Int feed1 () const;
00036 //    Int feed2 () const;
00037 //    Int field () const;
00038 //    Int observation () const;
00039 //    Int processorId () const;
00040 //    Int scan () const;
00041 //    Int state () const;
00042 //
00043 //private:
00044 //};
00045 //
00046 //class MsRowCoordinates {
00047 //
00048 //public:
00049 //
00050 //    MsRowCoordinates (Int row, VisBuffer2 * vb)
00051 //    : row_p (row), vb_p (vb)
00052 //    {}
00053 //
00054 //    Double exposure () const;
00055 //    Int fieldId () const;
00056 //    Double interval () const;
00057 //    Double time () const {
00058 //        return vb_p->time() (row_p);
00059 //    }
00060 //    Double timeCentroid () const;
00061 //    const Vector<Double> & uvw () const;
00062 //
00063 //private:
00064 //
00065 //    Int row_p;
00066 //    vi::VisBuffer2 * vb_p;
00067 //
00068 //};
00069 //
00070 //class MsRowData {
00071 //
00072 //public:
00073 //
00074 //    MsRowData (Int row, VisBuffer2 * vb)
00075 //    : row_p (row), vb_p (vb)
00076 //    {}
00077 //
00078 //    const Complex & corrected (Int correlation, Int channel) const;
00079 //    const Complex & model (Int correlation, Int channel) const;
00080 //    const Complex & observed (Int correlation, Int channel) const
00081 //    {
00082 //       return vb_p->visCube () (correlation, channel, row_p);
00083 //    }
00084 //    const Float sigma () const;
00085 //    const Float weight () const;
00086 //    const Float weightSpectrum (Int correlation, Int channel) const;
00087 //
00088 //private:
00089 //
00090 //    Int row_p;
00091 //    const vi::VisBuffer2 * vb_p;
00092 //
00093 //};
00094 //
00095 //class MsRowFlagging {
00096 //
00097 //public:
00098 //
00099 //    MsRowFlagging (Int row, VisBuffer2 * vb)
00100 //    : row_p (row), vb_p (vb)
00101 //    {}
00102 //
00103 //    Bool isFlagged () const;
00104 //    Bool isFlagged (Int correlation, Int channel) const;
00105 //
00106 //    void setFlag (Bool isFlagged);
00107 //    void setFlag (Bool isFlagged, Int correlation, Int channel);
00108 //
00109 //private:
00110 //
00111 //    Int row_p;
00112 //    vi::VisBuffer2 * vb_p;
00113 //};
00114 //
00115 //class MsRow {
00116 //
00117 //public:
00118 //
00119 //    const MsRowAttributes & attributes () const;
00120 //    const MsRowCoordinates & coordinates () const;
00121 //    const MsRowData & data () const;
00122 //    const MsRowFlagging & flagging () const;
00123 //
00124 //protected:
00125 //
00126 //private:
00127 //
00128 //    int row_p;
00129 //};
00130 
00131 class MsRow {
00132 
00133 public:
00134 
00135     // Constructors
00136 
00137     // Constructor for read-only access.
00138     // Attempt to write will throw exception.
00139 
00140     MsRow (Int row, const vi::VisBuffer2 * vb);
00141 
00142     // Constructor for read/write access
00143 
00144     MsRow (Int row, vi::VisBuffer2 * vb);
00145 
00146     virtual ~MsRow () {}
00147 
00148     virtual void changeRow (Int row) { row_p = row;}
00149 
00150     virtual Int antenna1 () const = 0;
00151     virtual Int antenna2 () const = 0;
00152     virtual Int arrayId () const = 0;
00153     virtual Int correlationType () const = 0;
00154     virtual Int dataDescriptionId () const = 0;
00155     virtual Int feed1 () const = 0;
00156     virtual Int feed2 () const = 0;
00157     virtual Int fieldId () const = 0;
00158     virtual Int observationId () const = 0;
00159     virtual Int processorId () const = 0;
00160     virtual Int scanNumber () const = 0;
00161     virtual Int stateId () const = 0;
00162     virtual Double exposure () const = 0;
00163     virtual Double interval () const = 0;
00164     virtual Int rowId () const = 0;
00165     virtual Int spectralWindow () const = 0;
00166     virtual Double time () const = 0;
00167     virtual Double timeCentroid () const = 0;
00168 
00169     virtual void setAntenna1 (Int) = 0;
00170     virtual void setAntenna2 (Int) = 0;
00171     virtual void setArrayId (Int) = 0;
00172     virtual void setCorrelationType (Int) = 0;
00173     virtual void setDataDescriptionId (Int) = 0;
00174     virtual void setFeed1 (Int) = 0;
00175     virtual void setFeed2 (Int) = 0;
00176     virtual void setFieldId (Int) = 0;
00177     virtual void setObservationId (Int) = 0;
00178     virtual void setProcessorId (Int) = 0;
00179     virtual void setScanNumber (Int) = 0;
00180     virtual void setStateId (Int) = 0;
00181     virtual void setExposure (Double) = 0;
00182     virtual void setInterval (Double) = 0;
00183     virtual void setRowId (Int) = 0;
00184     virtual void setSigma (Int correlation, Float value) = 0;
00185     virtual void setSigma (const Vector<Float> &  value) = 0;
00186     virtual void setTime (Double) = 0;
00187     virtual void setTimeCentroid (Double) = 0;
00188     virtual void setWeight (Int correlation, Float value) = 0;
00189     virtual void setWeight (const Vector<Float> & value) = 0;
00190 
00191     virtual const Vector<Double> uvw () const = 0;
00192     virtual void setUvw (const Vector<Double> &) = 0;
00193 
00194     virtual const Complex & corrected (Int correlation, Int channel) const = 0;
00195     virtual const Matrix<Complex> & corrected () const = 0;
00196     virtual void setCorrected (Int correlation, Int channel, const Complex & value) = 0;
00197     virtual void setCorrected (const Matrix<Complex> & value) = 0;
00198 
00199     virtual const Complex & model (Int correlation, Int channel) const = 0;
00200     virtual const Matrix<Complex> & model () const = 0;
00201     virtual void setModel(Int correlation, Int channel, const Complex & value) = 0;
00202     virtual void setModel (const Matrix<Complex> & value) = 0;
00203 
00204     virtual const Complex & observed (Int correlation, Int channel) const = 0;
00205     virtual const Matrix<Complex> & observed () const = 0;
00206     virtual void setObserved (Int correlation, Int channel, const Complex & value) = 0;
00207     virtual void setObserved (const Matrix<Complex> & value) = 0;
00208 
00209     virtual const Float & singleDishData (Int correlation, Int channel) const = 0;
00210     virtual const Matrix<Float> singleDishData () const = 0;
00211     virtual void setSingleDishData (Int correlation, Int channel, const Float & value) = 0;
00212     virtual void setSingleDishData (const Matrix<Float> & value) = 0;
00213 
00214     virtual Float sigma (Int correlation) const = 0;
00215     virtual const Vector<Float> & sigma () const = 0;
00216     virtual Float weight (Int correlation) const = 0;
00217     virtual const Vector<Float> & weight () const = 0;
00218     virtual Float weightSpectrum (Int correlation, Int channel) const = 0;
00219     virtual const Matrix<Float> & weightSpectrum () const = 0;
00220     virtual Float sigmaSpectrum (Int correlation, Int channel) const = 0;
00221     virtual const Matrix<Float> & sigmaSpectrum () const = 0;
00222 
00223     virtual Bool isRowFlagged () const = 0;
00224     virtual const Matrix<Bool> & flags () const = 0;
00225     virtual void setFlags (const Matrix<Bool> &) = 0;
00226     virtual Bool isFlagged (Int correlation, Int channel) const = 0;
00227 
00228     virtual void setRowFlag (Bool isFlagged) = 0;
00229     virtual void setFlags (Bool isFlagged, Int correlation, Int channel) = 0;
00230 
00231 protected:
00232 
00233     Bool isWritable () const;
00234     uInt row () const;
00235     vi::VisBuffer2 * vb () const;
00236 
00237 private:
00238 
00239     MsRow (const MsRow & other); // no copying
00240 
00241     const Bool isWritable_p;
00242     Int row_p;
00243     vi::VisBuffer2 * vb_p; // [use]
00244 };
00245 
00246 class MsRows {
00247 
00248 public:
00249 
00250     typedef std::vector<MsRow *> Rows;
00251     typedef Rows::const_iterator const_iterator;
00252     typedef Rows::iterator iterator;
00253 
00254     MsRows (vi::VisBuffer2 * vb);
00255 
00256     MsRow & operator() (Int i);
00257     const MsRow & operator() (Int i) const;
00258 
00259     const_iterator begin () const;
00260     iterator begin ();
00261     const_iterator end () const;
00262     iterator end ();
00263     MsRow & row (Int row);
00264     const MsRow & row (Int row) const;
00265     size_t size () const;
00266 
00267 protected:
00268 
00269 private:
00270 
00271     Rows rows_p;
00272     vi::VisBuffer2 * visBuffer_p; // [use]
00273 };
00274 
00275 // MsRows rows;
00276 // Double t = rows(i).time();
00277 // Double t = vb.time()(i)
00278 
00279 } // end namespace ms
00280 
00281 } // end namespace casa
00282 
00283 #endif // ! defined (MsVis_MsRows_H)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1