source: Sophya/trunk/Cosmo/RadioBeam/applobe.cc@ 3787

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

Ajout classes / programmes de calcul d'effet de lobe sur les radio-sources, Reza 25/06/2010

File size: 3.7 KB
Line 
1/* ------------------------ Projet BAORadio --------------------
2 Programme de convolution avec le lobe d'un cube 3D (angles,freq)
3 R. Ansari , C. Magneville - Juin 2010
4
5 Usage: applobe In3DPPFName Out3DPPFName
6--------------------------------------------------------------- */
7
8#include "sopnamsp.h"
9#include "machdefs.h"
10#include <math.h>
11#include <iostream>
12#include <typeinfo>
13
14#include "array.h"
15#include "histats.h"
16
17#include "swfitsdtable.h"
18#include "fitshdtable.h"
19
20#include "randr48.h"
21#include "vector3d.h"
22
23// #include "xastropack.h" -- Pour faire les conversions de coordonnees celestes
24
25#include "radutil.h"
26#include "lobe.h"
27
28// Pour l'initialisation des modules
29#include "tarrinit.h"
30#include "histinit.h"
31#include "fiosinit.h"
32
33#include "timing.h"
34#include "ctimer.h"
35
36#include "cubedef.h"
37
38//----------------------------------------------------------------------------
39//----------------------------------------------------------------------------
40int main(int narg, char* arg[])
41{
42 // Sophya modules initialization
43 TArrayInitiator _inia;
44 HiStatsInitiator _inih;
45 FitsIOServerInitiator _inif;
46 //------- AU LIEU DE ------> SophyaInit();
47
48 InitTim(); // Initializing the CPU timer
49 Timer tm("applobe");
50
51 if (narg < 3) {
52 cout << "Usage: applobe In3DPPFName Out3DPPFName \n" << endl;
53 return 1;
54 }
55
56 // decodage arguments
57 string outname = arg[2];
58 string inname = arg[1];
59 int rc = 91;
60
61 cout << " ====== applobe : Input NVSS catalog name= " << inname << " OutName=" << outname;
62 bool fginmap=true;
63 try {
64 TArray<r_4> incube;
65 cout << "applobe[1]: reading input 3D map (cube) from file " << inname << endl;
66 {
67 PInPersist pin(inname);
68 pin >> incube;
69 }
70 cout << incube;
71
72 double dxdeg = ThetaSizeDegre/(double)NTheta;
73 double dydeg = PhiSizeDegre/(double)NPhi;
74 double dx = DegreeToRadian(dxdeg);
75 double dy = DegreeToRadian(dydeg);
76 double dfreq = FreqSizeMHz/(double)NFreq;
77
78 cout << " X,Y map size in degrees , X/Phi=" << PhiSizeDegre << " Y/Theta=" << ThetaSizeDegre
79 << " \n dx=" << dxdeg << " dy=" << dydeg << " degres ( dx_rad=" << dx << " dy_rad=" << dy << ")"
80 << " FreqSize=" << FreqSizeMHz << " dfreq=dz= " << dfreq << " MHz" << endl;
81
82 double mean, sigma;
83 MeanSigma(incube, mean, sigma);
84 cout << " InCube 3D- : Mean=" << mean << " Sigma=" << sigma << endl;
85
86 cout << "applobe[2]: creating Four2DResponse and BeamEffect objects..." << endl;
87 // Dish de 64 m de diametre
88 double Diametre = 64.;
89 H21Conversions conv;
90 conv.setFrequency(Freq0MHz);
91 double lambda = conv.getLambda();
92 Four2DResponse fresp(2, Diametre/lambda, Diametre/lambda);
93 BeamEffect beam(fresp);
94
95 cout << "applobe[3]: calling ApplyLobe3D() ... " << endl;
96 beam.ApplyLobe3D(incube, dx, dy, Freq0MHz, dfreq);
97
98 cout << "applobe[4]: calling ReSample(incube, 0.25, 0.25, 1.) ... " << endl;
99 TArray< r_4 > outcube = beam.ReSample(incube, 0.25, 0.25, 1.);
100
101 cout << outcube;
102 MeanSigma(outcube, mean, sigma);
103 cout << " OutCube 3D- : Mean=" << mean << " Sigma=" << sigma << endl;
104
105 // On sauve le cube de sortie
106 {
107 cout << " applobe[5]: Saving output cube to -> " << outname << endl;
108 POutPersist poc(outname);
109 poc << outcube;
110 }
111
112 rc = 0;
113 }
114 catch (PThrowable& exc) {
115 cerr << " applobe.cc catched SOPHYA Exception " << exc.Msg() << endl;
116 rc = 77;
117 }
118 catch (std::exception& sex) {
119 cerr << "\n applobe.cc std::exception :"
120 << (string)typeid(sex).name() << "\n msg= "
121 << sex.what() << endl;
122 }
123 catch (...) {
124 cerr << " applobe.cc catched unknown (...) exception " << endl;
125 rc = 78;
126 }
127
128 cout << ">>>> applobe[9] ------- FIN ----------- Rc=" << rc << endl;
129 return rc;
130}
131
132
Note: See TracBrowser for help on using the repository browser.