PolnCalibrator.h

00001 //-*-C++-*-
00002 /***************************************************************************
00003  *
00004  *   Copyright (C) 2003 by Willem van Straten
00005  *   Licensed under the Academic Free License version 2.1
00006  *
00007  ***************************************************************************/
00008 
00009 /* $Source: /cvsroot/psrchive/psrchive/More/Polarimetry/Pulsar/PolnCalibrator.h,v $
00010    $Revision: 1.53 $
00011    $Date: 2009/03/01 18:04:42 $
00012    $Author: straten $ */
00013 
00014 #ifndef __Pulsar_PolnCalibrator_H
00015 #define __Pulsar_PolnCalibrator_H
00016 
00017 #include "Pulsar/Calibrator.h"
00018 #include "MEAL/LeastSquares.h"
00019 #include "MEAL/Complex2.h"
00020 
00021 #include "ReferenceVector.h"
00022 #include "Jones.h"
00023 
00024 namespace Pulsar {
00025 
00026   class Integration;
00027   class PolnCalibratorExtension;
00028   class FeedExtension;
00029   class Receiver;
00030 
00032 
00037   class PolnCalibrator : public Calibrator {
00038 
00039   public:
00040 
00042     PolnCalibrator (const Archive* archive = 0);
00043 
00045     PolnCalibrator (const PolnCalibrator& calibrator);
00046 
00048     virtual ~PolnCalibrator ();
00049 
00050     // ///////////////////////////////////////////////////////////////////
00051     //
00052     // useful for calibrating
00053     //
00054 
00056     virtual void set_response_nchan (unsigned nchan);
00058     virtual unsigned get_response_nchan () const;
00059 
00061     virtual Jones<float> get_response (unsigned ichan) const;
00062 
00064     bool has_Receiver () const;
00065 
00067     const Receiver* get_Receiver () const;
00068 
00069     // ///////////////////////////////////////////////////////////////////
00070     //
00071     // useful for unloading
00072     //
00073 
00075     bool get_transformation_valid (unsigned ch) const;
00076 
00078     void set_transformation_invalid (unsigned ch);
00079 
00081     const MEAL::Complex2* get_transformation (unsigned ichan) const;
00082 
00084     MEAL::Complex2* get_transformation (unsigned ichan);
00085 
00087     bool has_covariance () const;
00088 
00090     void get_covariance (unsigned ichan, std::vector<double>&) const;
00091 
00093     virtual bool has_solver () const;
00094 
00096     virtual const MEAL::LeastSquares* get_solver (unsigned ichan) const;
00097     MEAL::LeastSquares* get_solver (unsigned ichan);
00098 
00099     // ///////////////////////////////////////////////////////////////////
00100     //
00101     // Pulsar::Calibrator implementation
00102     //
00103     // ///////////////////////////////////////////////////////////////////
00104 
00106     virtual void calibrate (Archive* archive);
00107 
00109     virtual const Type* get_type () const;
00110 
00112     virtual unsigned get_nchan () const;
00113 
00115     CalibratorExtension* new_Extension () const;
00116 
00118     Calibrator::Info* get_Info () const;
00119 
00121     class Info;
00122 
00123   protected:
00124 
00126     Reference::Vector<MEAL::Complex2> transformation;
00127 
00129     std::vector< std::vector<double> > covariance;
00130 
00132     void setup_transformation () const;
00133 
00135     void calibration_setup (Archive* arch);
00136 
00138     std::vector< Jones<float> > response;
00139 
00141     Reference::To<const PolnCalibratorExtension> poln_extension;
00142 
00144     Reference::To<const Receiver> receiver;
00145 
00147     Reference::To<const FeedExtension> feed;
00148 
00150     bool built;
00151 
00153     unsigned observation_nchan;
00154 
00156     virtual void calculate_transformation ();
00157 
00159     virtual bool get_valid (unsigned ichan) const;
00160 
00162     virtual unsigned get_maximum_nchan ();
00163 
00164   private:
00165 
00167     void build (unsigned nchan = 0);
00168     
00170     mutable Reference::Vector<MEAL::LeastSquares> tmp_solver;
00171 
00172   };
00173 
00175   MEAL::Complex2*
00176   new_transformation (const PolnCalibratorExtension*, unsigned ichan);
00177 
00179   MEAL::Complex2* new_transformation( const Calibrator::Type* type );
00180 
00181 
00182   class PolnCalibrator::Info : public Calibrator::Info
00183   {
00184 
00185   public:
00186 
00188     static PolnCalibrator::Info* create (const PolnCalibrator* calibrator);
00189     
00191     Info (const PolnCalibrator* calibrator);
00192     
00194     std::string get_title () const;
00195 
00197     unsigned get_nchan () const;
00198 
00200     unsigned get_nclass () const;
00201     
00203     std::string get_name (unsigned iclass) const;
00204     
00206     unsigned get_nparam (unsigned iclass) const;
00207     
00209     Estimate<float> get_param (unsigned ichan, unsigned iclass,
00210                                unsigned iparam) const;
00211     
00213     int get_colour_index (unsigned iclass, unsigned iparam) const;
00214     
00216     int get_graph_marker (unsigned iclass, unsigned iparam) const;
00217     
00218   protected:
00219     
00221     Reference::To<const PolnCalibrator> calibrator;
00222 
00224     unsigned nparam;
00225     
00226   };
00227 
00228 }
00229 
00230 #endif
00231 

Generated using doxygen 1.4.7