[3756] | 1 | // Classes to compute Multi-Dish or CRT-like radio interferometer response
|
---|
| 2 | // R. Ansari - Avril-Mai 2010
|
---|
| 3 |
|
---|
| 4 | #ifndef MDISH_SEEN
|
---|
| 5 | #define MDISH_SEEN
|
---|
| 6 |
|
---|
| 7 | #include "machdefs.h" // SOPHYA .h
|
---|
| 8 | #include "sopnamsp.h" // SOPHYA .h
|
---|
| 9 | #include <math.h>
|
---|
| 10 | #include <iostream>
|
---|
| 11 | #include <vector>
|
---|
| 12 | #include <string>
|
---|
| 13 |
|
---|
| 14 | #include "genericfunc.h" // SOPHYA .h
|
---|
| 15 | #include "array.h" // SOPHYA .h
|
---|
| 16 | #include "histats.h" // SOPHYA .h
|
---|
| 17 |
|
---|
| 18 | #define DeuxPI 2.*M_PI
|
---|
| 19 |
|
---|
| 20 | // -- Four2DResponse : Reponse instrumentale ds le plan k_x,k_y (angles theta,phi)
|
---|
| 21 | // typ=1 : Reponse gaussienne parabole diametre D exp[ - 0.5 (lambda k_g / D )^2 ]
|
---|
| 22 | // typ=2 : Reponse parabole diametre D Triangle <= kmax= 2 pi D / lambda
|
---|
| 23 | // typ=3 : Reponse rectangle Dx x Dy Triangle (|kx|,|k_y|) <= (2 pi Dx / lambda, 2 pi Dx / lambda)
|
---|
| 24 | class Four2DResponse {
|
---|
| 25 | public:
|
---|
| 26 | // On donne dx=D/lambda=Dx/lambda , dy=Dy/lambda
|
---|
| 27 | Four2DResponse(int typ, double dx, double dy);
|
---|
| 28 |
|
---|
| 29 | Four2DResponse(Four2DResponse const& a)
|
---|
| 30 | { typ_ = a.typ_; dx_=a.dx_; dy_=a.dy_; }
|
---|
| 31 | Four2DResponse& operator=(Four2DResponse const& a)
|
---|
| 32 | { typ_ = a.typ_; dx_=a.dx_; dy_=a.dy_; return (*this); }
|
---|
| 33 |
|
---|
| 34 | // Return the 2D response for wave vector (kx,ky)
|
---|
| 35 | virtual double Value(double kx, double ky);
|
---|
| 36 | inline double operator()(double kx, double ky)
|
---|
| 37 | { return Value(kx, ky); }
|
---|
| 38 | virtual Histo2D GetResponse(int nx=256, int ny=256);
|
---|
| 39 | inline double D() { return dx_; } ;
|
---|
| 40 | inline double Dx() { return dx_; } ;
|
---|
| 41 | inline double Dy() { return dy_; } ;
|
---|
| 42 |
|
---|
| 43 | int typ_;
|
---|
| 44 | double dx_, dy_;
|
---|
| 45 | };
|
---|
| 46 |
|
---|
| 47 | // -- Four2DRespTable : Reponse tabulee instrumentale ds le plan k_x,k_y (angles theta,phi)
|
---|
| 48 | class Four2DRespTable : public Four2DResponse {
|
---|
| 49 | public:
|
---|
| 50 | // On donne dx=D/lambda=Dx/lambda , dy=Dy/lambda
|
---|
| 51 | Four2DRespTable(Histo2D const & hrep, double d);
|
---|
| 52 | // Return the 2D response for wave vector (kx,ky)
|
---|
| 53 | virtual double Value(double kx, double ky);
|
---|
| 54 | Histo2D hrep_;
|
---|
| 55 | };
|
---|
| 56 |
|
---|
| 57 | // Classe toute simple pour representer un element de reception de type dish
|
---|
| 58 | class Dish {
|
---|
| 59 | public:
|
---|
| 60 | // Circular dish
|
---|
| 61 | Dish(int id, double x, double y, double diam)
|
---|
| 62 | : id_(id), X(x), Y(y), D(diam), Dx(0.), Dy(0.), fgcirc_(true) { }
|
---|
| 63 | // Receiver with rectangular type answer in kx,ky plane
|
---|
| 64 | Dish(int id, double x, double y, double dx, double dy)
|
---|
| 65 | : id_(id), X(x), Y(y), D(0.), Dx(dx), Dy(dy), fgcirc_(false) { }
|
---|
| 66 | Dish(Dish const& a)
|
---|
| 67 | : id_(a.id_), X(a.X), Y(a.Y), D(a.D), Dx(a.Dx), Dy(a.Dy), fgcirc_(a.fgcirc_) { }
|
---|
| 68 | inline bool isCircular() { return fgcirc_; }
|
---|
| 69 | inline int ReflectorId() { return id_; }
|
---|
| 70 |
|
---|
| 71 | int id_; // numero de reflecteur
|
---|
| 72 | double D,X,Y;
|
---|
| 73 | double Dx, Dy;
|
---|
| 74 | bool fgcirc_; // false -> rectangular dish
|
---|
| 75 | };
|
---|
| 76 |
|
---|
| 77 | // -----------------------------------
|
---|
| 78 | // -- Classe ressemblant a un histo 2D
|
---|
| 79 | class QHis2D {
|
---|
| 80 | public:
|
---|
| 81 | QHis2D();
|
---|
| 82 | QHis2D(r_8 xMin,r_8 xMax,int_4 nxBin,r_8 yMin,r_8 yMax,int_4 nyBin);
|
---|
| 83 | void Define(r_8 xMin,r_8 xMax,int_4 nxBin,r_8 yMin,r_8 yMax,int_4 nyBin);
|
---|
| 84 | double Add(r_8 x, r_8 y, r_8 w, bool fgfh);
|
---|
| 85 | inline double WBinX() { return dxb; }
|
---|
| 86 | inline double WBinY() { return dyb; }
|
---|
| 87 | Histo2D Convert();
|
---|
| 88 |
|
---|
| 89 | r_8 xmin,xmax,ymin,ymax;
|
---|
| 90 | r_8 dxb,dyb;
|
---|
| 91 | sa_size_t nx,ny;
|
---|
| 92 | TArray<r_8> aw;
|
---|
| 93 | double sumw0;
|
---|
| 94 | };
|
---|
| 95 |
|
---|
| 96 | // -------------------------------------------------------------------
|
---|
| 97 | // -- Pour calculer la reponse ds le plan kx,ky d'un system MultiDish
|
---|
| 98 | class MultiDish {
|
---|
| 99 | public:
|
---|
| 100 | MultiDish(double lambda, double dmax, vector<Dish>& dishes, bool fgnoauto=false);
|
---|
| 101 |
|
---|
| 102 | inline void SetThetaPhiRange(double thetamax=0., int ntet=1, double phimax=0., int nphi=1)
|
---|
| 103 | { thetamax_=thetamax; ntet_=ntet; phimax_=phimax; nphi_=nphi; }
|
---|
| 104 |
|
---|
| 105 | inline void SetRespHisNBins(int nx=128, int ny=128)
|
---|
| 106 | { nx_=nx; ny_=ny; }
|
---|
| 107 | Histo2D GetResponse();
|
---|
| 108 |
|
---|
| 109 | double CumulResp(Four2DResponse& rd, double theta=0., double phi=0.);
|
---|
| 110 | inline size_t NbDishes() { return dishes_.size(); }
|
---|
| 111 |
|
---|
| 112 | double AddToHisto(double kx0, double ky0, double x, double y, double w, bool fgfh);
|
---|
| 113 |
|
---|
| 114 | double lambda_, dmax_;
|
---|
| 115 | vector<Dish> dishes_;
|
---|
| 116 | bool fgnoauto_;
|
---|
| 117 | double thetamax_, phimax_;
|
---|
| 118 | int ntet_,nphi_;
|
---|
| 119 | int nx_, ny_;
|
---|
| 120 | // Histo2D h2w_, h2cnt_;
|
---|
| 121 | QHis2D h2w_;
|
---|
| 122 | int mcnt_;
|
---|
| 123 | };
|
---|
| 124 |
|
---|
| 125 |
|
---|
| 126 | #endif
|
---|