[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
|
---|
[3783] | 16 | #include "qhist.h"
|
---|
[3756] | 17 |
|
---|
[3783] | 18 | #ifndef DeuxPI
|
---|
[3756] | 19 | #define DeuxPI 2.*M_PI
|
---|
[3783] | 20 | #endif
|
---|
[3756] | 21 |
|
---|
| 22 | // -- Four2DResponse : Reponse instrumentale ds le plan k_x,k_y (angles theta,phi)
|
---|
| 23 | // typ=1 : Reponse gaussienne parabole diametre D exp[ - 0.5 (lambda k_g / D )^2 ]
|
---|
| 24 | // typ=2 : Reponse parabole diametre D Triangle <= kmax= 2 pi D / lambda
|
---|
| 25 | // typ=3 : Reponse rectangle Dx x Dy Triangle (|kx|,|k_y|) <= (2 pi Dx / lambda, 2 pi Dx / lambda)
|
---|
| 26 | class Four2DResponse {
|
---|
| 27 | public:
|
---|
| 28 | // On donne dx=D/lambda=Dx/lambda , dy=Dy/lambda
|
---|
| 29 | Four2DResponse(int typ, double dx, double dy);
|
---|
| 30 |
|
---|
| 31 | Four2DResponse(Four2DResponse const& a)
|
---|
| 32 | { typ_ = a.typ_; dx_=a.dx_; dy_=a.dy_; }
|
---|
| 33 | Four2DResponse& operator=(Four2DResponse const& a)
|
---|
| 34 | { typ_ = a.typ_; dx_=a.dx_; dy_=a.dy_; return (*this); }
|
---|
| 35 |
|
---|
| 36 | // Return the 2D response for wave vector (kx,ky)
|
---|
| 37 | virtual double Value(double kx, double ky);
|
---|
| 38 | inline double operator()(double kx, double ky)
|
---|
| 39 | { return Value(kx, ky); }
|
---|
| 40 | virtual Histo2D GetResponse(int nx=256, int ny=256);
|
---|
| 41 | inline double D() { return dx_; } ;
|
---|
| 42 | inline double Dx() { return dx_; } ;
|
---|
| 43 | inline double Dy() { return dy_; } ;
|
---|
| 44 |
|
---|
| 45 | int typ_;
|
---|
| 46 | double dx_, dy_;
|
---|
| 47 | };
|
---|
| 48 |
|
---|
| 49 | // -- Four2DRespTable : Reponse tabulee instrumentale ds le plan k_x,k_y (angles theta,phi)
|
---|
| 50 | class Four2DRespTable : public Four2DResponse {
|
---|
| 51 | public:
|
---|
| 52 | // On donne dx=D/lambda=Dx/lambda , dy=Dy/lambda
|
---|
| 53 | Four2DRespTable(Histo2D const & hrep, double d);
|
---|
| 54 | // Return the 2D response for wave vector (kx,ky)
|
---|
| 55 | virtual double Value(double kx, double ky);
|
---|
| 56 | Histo2D hrep_;
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | // Classe toute simple pour representer un element de reception de type dish
|
---|
| 60 | class Dish {
|
---|
| 61 | public:
|
---|
| 62 | // Circular dish
|
---|
| 63 | Dish(int id, double x, double y, double diam)
|
---|
[3769] | 64 | : id_(id), X(x), Y(y), D(diam), Dx(D), Dy(D), fgcirc_(true) { }
|
---|
[3756] | 65 | // Receiver with rectangular type answer in kx,ky plane
|
---|
| 66 | Dish(int id, double x, double y, double dx, double dy)
|
---|
[3769] | 67 | : id_(id), X(x), Y(y), D(sqrt(dx*dy)), Dx(dx), Dy(dy), fgcirc_(false) { }
|
---|
[3756] | 68 | Dish(Dish const& a)
|
---|
| 69 | : id_(a.id_), X(a.X), Y(a.Y), D(a.D), Dx(a.Dx), Dy(a.Dy), fgcirc_(a.fgcirc_) { }
|
---|
| 70 | inline bool isCircular() { return fgcirc_; }
|
---|
| 71 | inline int ReflectorId() { return id_; }
|
---|
[3769] | 72 | inline double Diameter() { return D; }
|
---|
| 73 | inline double DiameterX() { return Dx; }
|
---|
| 74 | inline double DiameterY() { return Dx; }
|
---|
[3756] | 75 |
|
---|
| 76 | int id_; // numero de reflecteur
|
---|
| 77 | double D,X,Y;
|
---|
| 78 | double Dx, Dy;
|
---|
| 79 | bool fgcirc_; // false -> rectangular dish
|
---|
| 80 | };
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | // -------------------------------------------------------------------
|
---|
| 84 | // -- Pour calculer la reponse ds le plan kx,ky d'un system MultiDish
|
---|
| 85 | class MultiDish {
|
---|
| 86 | public:
|
---|
| 87 | MultiDish(double lambda, double dmax, vector<Dish>& dishes, bool fgnoauto=false);
|
---|
| 88 |
|
---|
| 89 | inline void SetThetaPhiRange(double thetamax=0., int ntet=1, double phimax=0., int nphi=1)
|
---|
| 90 | { thetamax_=thetamax; ntet_=ntet; phimax_=phimax; nphi_=nphi; }
|
---|
| 91 |
|
---|
| 92 | inline void SetRespHisNBins(int nx=128, int ny=128)
|
---|
| 93 | { nx_=nx; ny_=ny; }
|
---|
| 94 | Histo2D GetResponse();
|
---|
| 95 |
|
---|
| 96 | double CumulResp(Four2DResponse& rd, double theta=0., double phi=0.);
|
---|
| 97 | inline size_t NbDishes() { return dishes_.size(); }
|
---|
[3769] | 98 | inline Dish& operator[](size_t k) { return dishes_[k]; }
|
---|
[3756] | 99 |
|
---|
[3769] | 100 | virtual Histo2D PosDist(int nx=30, int ny=30, double dmax=0.);
|
---|
| 101 |
|
---|
| 102 | protected:
|
---|
[3756] | 103 | double AddToHisto(double kx0, double ky0, double x, double y, double w, bool fgfh);
|
---|
| 104 |
|
---|
| 105 | double lambda_, dmax_;
|
---|
| 106 | vector<Dish> dishes_;
|
---|
| 107 | bool fgnoauto_;
|
---|
| 108 | double thetamax_, phimax_;
|
---|
| 109 | int ntet_,nphi_;
|
---|
| 110 | int nx_, ny_;
|
---|
| 111 | // Histo2D h2w_, h2cnt_;
|
---|
| 112 | QHis2D h2w_;
|
---|
| 113 | int mcnt_;
|
---|
| 114 | };
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | #endif
|
---|