source: Sophya/trunk/Cosmo/RadioBeam/repicon.cc@ 3792

Last change on this file since 3792 was 3792, checked in by ansari, 15 years ago

Ajout du programme de calcul et sauvegarde reponse interfero, Reza 28/06/2010

File size: 4.9 KB
RevLine 
[3792]1#include "machdefs.h"
2#include "sopnamsp.h"
3#include <iostream>
4#include <string>
5#include <math.h>
6
7#include <typeinfo>
8
9#include "mdish.h"
10#include "specpk.h"
11#include "interfconfigs.h"
12
13#include "histinit.h"
14// #include "fiosinit.h"
15// #include "fitsioserver.h"
16
17#include "randr48.h"
18
19#include "timing.h"
20#include "ctimer.h"
21
22typedef DR48RandGen RandomGenerator ;
23
24// ---------------------------------------------------------------------
25// Test main program for computing interferometer response un (u,v) plane
26// R. Ansari - Avril-Juin 2010
27// ---------------------------------------------------------------------
28
29
30
31
32//-------------------------------------------------------------------------
33// ------------------ MAIN PROGRAM ------------------------------
34//-------------------------------------------------------------------------
35int main(int narg, const char* arg[])
36{
37 if (((narg>1)&&(strcmp(arg[1],"-h")==0))||(narg<3)) {
38 cout << " Usage: repicon configId OutPPFName [Lambda] "
39 << " configs: f4x4 , f8x8 , f20x20 Filled array of nxn dishes \n"
40 << " confA , confB, confC : semi-filled array of dishes \n"
41 << " f3cyl, f8cyl , f3cylp, f8cylp : filled array of non perfect/perfect of n cylinders " << endl;
42 return 1;
43 }
44 cout << " ==== repicon.cc program , (u,v) plane response ==== " << endl;
45 // make sure SOPHYA modules are initialized
46 SophyaInit();
47 // FitsIOServerInit();
48 InitTim();
49 //--- decoding command line arguments
50 string config = "f8x8" ;
51 if (narg>1) config = arg[1];
52 string outfile = "repicon.ppf";
53 if (narg>2) outfile = arg[2];
54 if (outfile==".") outfile = "repicon.ppf";
55 double LAMBDA=0.357 ; // 21 cm at z=0.7
56 if (narg>3) LAMBDA = atof(arg[2]);
57
58 //-- end command line arguments
59
60 int rc = 1;
61 try { // exception handling try bloc at top level
62
63 cout << " 2.c/ Creating MultiDish Filled Array " << endl;
64 double Ddish = 5.;
65 double Ddish2 = 7.5;
66 double Eta=0.95;
67 double cylW=12.; // Largeur des cylindres
68 double cylRL=0.5; // Longeur des elements de reception le long du cylindre
69 double etaW=0.95; // Efficacite de couverture en largeur
70 double etaRL=0.9; // Efficacite de couverture le long du cylindre
71 int cnt=0;
72
73 vector<Dish> vdishes;
74 cout << " repicon[1] : creating dish vector/ MultiDish for configuration: " << config << endl;
75
76 bool fgpoint=false;
77 if (config=="f4x4") {
78 vdishes=CreateFilledSqConfig(4,Ddish, Eta);
79 }
80 else if (config=="f8x8") {
81 vdishes=CreateFilledSqConfig(8,Ddish, Eta);
82 }
83 else if (config=="f20x20") {
84 vdishes=CreateFilledSqConfig(20,Ddish, Eta);
85 }
86 else if (config=="f3cyl") {
87 cylW=10.; cylRL=0.5;
88 vdishes=CreateFilledCylConfig(3, 128, cylW, cylRL, etaW, etaRL, true);
89 }
90 else if (config=="f3cylp") {
91 cylW=10.; cylRL=0.5;
92 vdishes=CreateFilledCylConfig(3, 128, cylW, cylRL, etaW, etaRL, false);
93 }
94 else if (config=="f8cyl") {
95 cylW=12.; cylRL=0.5;
96 vdishes=CreateFilledCylConfig(8, 192, cylW, cylRL, etaW, etaRL, true);
97 }
98 else if (config=="f8cylp") {
99 cylW=12.; cylRL=0.5;
100 vdishes=CreateFilledCylConfig(8, 192, cylW, cylRL, etaW, etaRL, false);
101 }
102 else if (config=="confA") {
103 fgpoint=true;
104 vdishes=CreateConfigA(Ddish, Eta);
105 }
106 else if (config=="confB") {
107 fgpoint=true;
108 vdishes=CreateConfigB(Ddish, Eta);
109 }
110 else if (config=="confC") {
111 fgpoint=true;
112 vdishes=CreateConfigC(Ddish, Eta);
113 }
114 else {
115 cout << " NON valid configuration option -> exit" << endl;
116 return 99;
117 }
118
119 double D = 100.;
120 double Dol = D/LAMBDA;
121
122 double LMAX = D;
123 bool fgnoauto = true;
124 int NRX=100;
125 int NRY=100;
126
127 MultiDish mdish(LAMBDA, LMAX, vdishes, fgnoauto);
128 mdish.SetRespHisNBins(NRX,NRY);
129 if (fgpoint)
130 mdish.SetThetaPhiRange(M_PI/6.,12, M_PI/6., 12);
131 cout << " repicon[2] : calling mdish.GetResponse() ..."<< endl;
132
133 Histo2D hrep = mdish.GetResponse();
134 PrtTim("Apres mdish.GetResponse()");
135
136 cout << " repicon[3] : saving Four2DRespTable for config " << config << " to PPF file " << outfile << endl;
137 Four2DRespTable mdresp(hrep, Dol, LAMBDA);
138 mdresp.writeToPPF(outfile);
139
140 rc = 0;
141 } // End of try bloc
142 catch (PThrowable & exc) { // catching SOPHYA exceptions
143 cerr << " repicon.cc: Catched Exception (PThrowable)" << (string)typeid(exc).name()
144 << "\n...exc.Msg= " << exc.Msg() << endl;
145 rc = 99;
146 }
147 catch (std::exception & e) { // catching standard C++ exceptions
148 cerr << " repicon.cc: Catched std::exception " << " - what()= " << e.what() << endl;
149 rc = 98;
150 }
151 catch (...) { // catching other exceptions
152 cerr << " repicon.cc: some other exception (...) was caught ! " << endl;
153 rc = 97;
154 }
155 PrtTim("End-repicon");
156 cout << " ==== End of repicon.cc program Rc= " << rc << endl;
157 return rc;
158}
159
160
Note: See TracBrowser for help on using the repository browser.