Changeset 3787 in Sophya for trunk/Cosmo
- Timestamp:
- Jun 25, 2010, 12:00:30 PM (15 years ago)
- Location:
- trunk/Cosmo/RadioBeam
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/RadioBeam/README
r3785 r3787 16 16 - plpkn.pic : spiapp script for plotting pknoise.cc program output 17 17 A.2/ power spectrum computation and foreground/radio source 18 - subtractradsrc.cmd : Explanation and commands to compute various power spectra and foreground subtraction 18 19 - calcpk.cc : power spectrum P(k) computation from 3D mass or temperature map 19 20 - calcpk2.cc : LSS deltaT/T P(k) computation from LSS+foreground cubes after cleaning 21 - applobe.cc : Antenna/array beam effect on 3D sky cube 20 22 - syncube.cc : Synchrotron 3D temperature cube from HASLAM 400 MHz map 21 23 - srcat2cube.cc : radio source 3D temperature cube from NVSS catalog … … 24 26 A.3/ List of other common files : 25 27 - specpk.h specpk.cc : 3D power spectrum computation classes 28 - lobe.h lobe.cc : 2D (k_alpha, k_delta) beam effect on 3D sky cubes 26 29 - mdish.h mdish.cc : Classes for representing Multi-Dish interferometer configurations 27 30 - radutil.h radutil.cc : utilitaire de conversion a 21 cm -
trunk/Cosmo/RadioBeam/calcpk.cc
r3783 r3787 19 19 20 20 #include "qhist.h" 21 #include "lobe.h" 22 21 23 #include "histinit.h" 22 24 #include "fftwserver.h" … … 33 35 { 34 36 if (narg<3) { 35 cout << " Usage: calcpk In3DMap OutPk [InRenormFactor] " << endl;37 cout << " Usage: calcpk In3DMap OutPk [InRenormFactor] [PixNoiseLevel] " << endl; 36 38 return 1; 37 39 } … … 41 43 string inppfname = arg[1]; 42 44 string outname = arg[2]; 43 r_4renfact=1.;45 double renfact=1.; 44 46 bool fgrenfact=false; 45 47 if (narg>3) { … … 47 49 fgrenfact=true; 48 50 } 51 double pixsignoise = 0.; 52 bool fgaddnoise=false; 53 if (narg>4) { 54 pixsignoise=atof(arg[3]); 55 fgaddnoise=true; 56 } 57 49 58 cout << "calcpk[1] : reading 3D map from file " << inppfname << endl; 50 59 TArray<r_4> inmap; … … 53 62 pin >> inmap; 54 63 } 55 if (fgrenfact) inmap *= renfact; 64 if (fgrenfact) { 65 cout << " Applying RenormFactor inmap = inmap*rfact, rfact=" << renfact << endl; 66 inmap *= renfact; 67 } 56 68 double mean, sigma; 57 69 MeanSigma(inmap, mean, sigma); … … 59 71 inmap.Show(); 60 72 cout << " Mean=" << mean << " Sigma=" << sigma << endl; 73 if (fgaddnoise) { 74 BeamEffect::AddNoise(inmap, pixsignoise); 75 } 76 61 77 tm.Split(" After read "); 62 78 -
trunk/Cosmo/RadioBeam/calcpk2.cc
r3784 r3787 7 7 R. Ansari , C. Magneville - Juin 2010 8 8 9 Usage: calcpk2 InMapLSS convFacLSS InMapSync convFacSync OutPk9 Usage: calcpk2 InMapLSS convFacLSS InMapSync convFacSync InMapRadioSource convFacRsc OutPk [PixNoiseLevel] 10 10 --------------------------------------------------------------- */ 11 11 … … 22 22 23 23 #include "qhist.h" 24 #include "lobe.h" 25 #include "cubedef.h" 26 24 27 #include "histinit.h" 25 28 #include "fftwserver.h" … … 30 33 typedef ThSDR48RandGen RandomGenerator ; 31 34 //--- Declaration des fonctions 32 TArray<r_4> CleanForeground(TArray<r_4>& maplss, TArray<r_4>& mapsync, TArray<r_8>& synctemp, TArray<r_8>& specidx); 35 TArray<r_4> CleanForeground(TArray<r_4>& maplss, TArray<r_4>& mapsync, double freq0, double dfreq, 36 TArray<r_8>& synctemp, TArray<r_8>& specidx); 33 37 34 38 //------------------------------------------------------------------------- … … 39 43 { 40 44 if (narg<6) { 41 cout << " Usage: calcpk2 InMapLSS convFacLSS InMapSync convFacSync OutPk" << endl;45 cout << " Usage: calcpk2 InMapLSS convFacLSS InMapSync convFacSync OutPk [PixNoiseLevel] " << endl; 42 46 return 1; 43 47 } … … 50 54 r_4 rfacsync = atof(arg[4]); 51 55 string outname = arg[5]; 56 57 double pixsignoise = 0.; 58 bool fgaddnoise=false; 59 if (narg>6) { 60 pixsignoise=atof(arg[6]); 61 fgaddnoise=true; 62 } 63 64 52 65 TArray<r_4> inmaplss, inmapsync; 53 66 const char * tits[2]={"LSS", "Sync"}; … … 68 81 cout << " ... Mean=" << mean << " Sigma=" << sigma << endl; 69 82 } 83 84 if (fgaddnoise) { 85 cout << " calcpk2: adding noise to LSS input cube ... " << endl; 86 BeamEffect::AddNoise(inmaplss, pixsignoise); 87 } 88 70 89 tm.Split(" After read "); 71 90 TArray<r_8> synctemp, specidx; 72 91 cout << "calcpk2[3] : calling CleanForeground(...) " << endl; 73 TArray<r_4> inmap = CleanForeground(inmaplss, inmapsync, synctemp, specidx); 92 double freq0 = Freq0MHz; 93 double dfreq = FreqSizeMHz/(double)NFreq; 94 TArray<r_4> inmap = CleanForeground(inmaplss, inmapsync, freq0, dfreq, synctemp, specidx); 74 95 double mean, sigma; 75 96 MeanSigma(inmap, mean, sigma); … … 117 138 118 139 /* --Fonction-- */ 119 TArray<r_4> CleanForeground(TArray<r_4>& maplss, TArray<r_4>& mapsync, TArray<r_8>& synctemp, TArray<r_8>& specidx) 140 TArray<r_4> CleanForeground(TArray<r_4>& maplss, TArray<r_4>& mapsync, double freq0, double dfreq, 141 TArray<r_8>& synctemp, TArray<r_8>& specidx) 142 // Inputs : maplss, mapsyc, freq0, dfreq 143 // Outputs : synctemp, specidx (reconstructed foreground temperature and spectral index 144 // Return_Array : foreground subtracted LSS signal 120 145 { 121 146 bool smo; … … 131 156 Vector vlnf(maplss.SizeZ()); 132 157 int nprt = 0; 133 double freq0=840.; //Frequence premier index en k (MHz)134 double dfreq=1.;// largeur en frequence de chaque plan (Mhz)158 // double freq0 : Frequence premier index en k (MHz) 159 // double dfreq : // largeur en frequence de chaque plan (Mhz) 135 160 for(sa_size_t i=0; i<maplss.SizeX(); i++) 136 161 for(sa_size_t j=0; j<maplss.SizeY(); j++) { -
trunk/Cosmo/RadioBeam/cubedef.h
r3785 r3787 6 6 7 7 // Definition tailles et bornes du cube angles (X,Y), frequence (Z) 8 static sa_size_t NTheta=256;9 static sa_size_t NPhi=256;10 static sa_size_t NFreq = 128;11 8 12 static double Theta0Degre = 60.; // -> Delta = +30 deg 13 static double Phi0Degre = 120.; // -> alpha = 8h00 14 static double ThetaSizeDegre = 60.; // Taille de la carte en degre selon alpha (axe X) 15 static double PhiSizeDegre = 60.; // Taille de la carte en degre selon delta (axe Y) 9 static sa_size_t NTheta=360; 10 static sa_size_t NPhi=360; 11 static sa_size_t NFreq = 200; 12 13 static double Theta0Degre = 75.; // -> Delta = +30 deg 14 static double Phi0Degre = 135.; // -> alpha = 9h00 15 static double ThetaSizeDegre = 30.; // Taille de la carte en degre selon alpha (axe X) 16 static double PhiSizeDegre = 30.; // Taille de la carte en degre selon delta (axe Y) 16 17 17 18 static double Freq0MHz = 840.; // premiere frequence 18 static double FreqSizeMHz = 1 28.; // Taille de la carte en MHz (axe Z)19 static double FreqSizeMHz = 100.; // Taille de la carte en MHz (axe Z) 19 20 20 21 … … 31 32 static double sigPLidxSrc = 0.15; // Sigma de la variation (gaussienne) de l'index 32 33 34 /* 35 static sa_size_t NTheta=256; 36 static sa_size_t NPhi=256; 37 static sa_size_t NFreq = 128; 38 39 static double Theta0Degre = 60.; // -> Delta = +30 deg 40 static double Phi0Degre = 120.; // -> alpha = 8h00 41 static double ThetaSizeDegre = 60.; // Taille de la carte en degre selon alpha (axe X) 42 static double PhiSizeDegre = 60.; // Taille de la carte en degre selon delta (axe Y) 43 static double Freq0MHz = 840.; // premiere frequence 44 static double FreqSizeMHz = 100.; // Taille de la carte en MHz (axe Z) 45 */ 46 33 47 #endif -
trunk/Cosmo/RadioBeam/makefile
r3785 r3787 6 6 include $(SOPHYABASE)/include/sophyamake.inc 7 7 8 all : pknoise calcpk calcpk2 syncube srcat2cube tjyk 8 all : pknoise calcpk calcpk2 syncube srcat2cube tjyk applobe 9 9 10 10 clean : 11 11 rm Objs/* 12 13 PKGOLIST = Objs/lobe.o Objs/specpk.o Objs/mdish.o Objs/qhist.o Objs/radutil.o 14 PKGHLIST = lobe.h specpk.h mdish.h qhist.h radutil.h cubedef.h 12 15 13 16 ### les executables … … 30 33 echo 'makefile : tjyk made' 31 34 35 applobe : Objs/applobe 36 echo 'makefile : applobe made' 37 32 38 ### programme pknoise 33 Objs/pknoise : Objs/pknoise.o Objs/specpk.o Objs/mdish.o Objs/qhist.o34 $(CXXLINK) -o Objs/pknoise Objs/pknoise.o Objs/specpk.o Objs/mdish.o Objs/qhist.o$(SOPHYAEXTSLBLIST)39 Objs/pknoise : Objs/pknoise.o $(PKGOLIST) 40 $(CXXLINK) -o Objs/pknoise Objs/pknoise.o $(PKGOLIST) $(SOPHYAEXTSLBLIST) 35 41 36 Objs/pknoise.o : pknoise.cc specpk.h mdish.h qhist.h42 Objs/pknoise.o : pknoise.cc $(PKGHLIST) 37 43 $(CXXCOMPILE) -o Objs/pknoise.o pknoise.cc 38 44 39 45 ### programme calcpk 40 Objs/calcpk : Objs/calcpk.o Objs/specpk.o Objs/mdish.o Objs/qhist.o41 $(CXXLINK) -o Objs/calcpk Objs/calcpk.o Objs/specpk.o Objs/mdish.o Objs/qhist.o$(SOPHYAEXTSLBLIST)46 Objs/calcpk : Objs/calcpk.o $(PKGOLIST) 47 $(CXXLINK) -o Objs/calcpk Objs/calcpk.o $(PKGOLIST) $(SOPHYAEXTSLBLIST) 42 48 43 Objs/calcpk.o : calcpk.cc specpk.h mdish.h qhist.h49 Objs/calcpk.o : calcpk.cc $(PKGHLIST) 44 50 $(CXXCOMPILE) -o Objs/calcpk.o calcpk.cc 45 51 46 52 ### programme calcpk2 47 Objs/calcpk2 : Objs/calcpk2.o Objs/specpk.o Objs/mdish.o Objs/qhist.o48 $(CXXLINK) -o Objs/calcpk2 Objs/calcpk2.o Objs/specpk.o Objs/mdish.o Objs/qhist.o$(SOPHYAEXTSLBLIST)53 Objs/calcpk2 : Objs/calcpk2.o $(PKGOLIST) 54 $(CXXLINK) -o Objs/calcpk2 Objs/calcpk2.o $(PKGOLIST) $(SOPHYAEXTSLBLIST) 49 55 50 Objs/calcpk2.o : calcpk2.cc specpk.h mdish.h qhist.h56 Objs/calcpk2.o : calcpk2.cc $(PKGHLIST) 51 57 $(CXXCOMPILE) -o Objs/calcpk2.o calcpk2.cc 52 58 53 59 ### programme syncube 54 Objs/syncube : Objs/syncube.o 55 $(CXXLINK) -o Objs/syncube Objs/syncube.o $( SOPHYAEXTSLBLIST)60 Objs/syncube : Objs/syncube.o $(PKGOLIST) 61 $(CXXLINK) -o Objs/syncube Objs/syncube.o $(PKGOLIST) $(SOPHYAEXTSLBLIST) 56 62 57 63 Objs/syncube.o : syncube.cc … … 59 65 60 66 ### programme srcat2cube 61 Objs/srcat2cube : Objs/srcat2cube.o 62 $(CXXLINK) -o Objs/srcat2cube Objs/srcat2cube.o Objs/radutil.o$(SOPHYAEXTSLBLIST)67 Objs/srcat2cube : Objs/srcat2cube.o $(PKGOLIST) 68 $(CXXLINK) -o Objs/srcat2cube Objs/srcat2cube.o $(PKGOLIST) $(SOPHYAEXTSLBLIST) 63 69 64 Objs/srcat2cube.o : srcat2cube.cc radutil.h70 Objs/srcat2cube.o : srcat2cube.cc $(PKGHLIST) 65 71 $(CXXCOMPILE) -o Objs/srcat2cube.o srcat2cube.cc 66 72 67 73 ### programme tjyk 68 Objs/tjyk : Objs/tjyk.o Objs/radutil.o69 $(CXXLINK) -o Objs/tjyk Objs/tjyk.o Objs/radutil.o$(SOPHYAEXTSLBLIST)74 Objs/tjyk : Objs/tjyk.o $(PKGOLIST) 75 $(CXXLINK) -o Objs/tjyk Objs/tjyk.o $(PKGOLIST) $(SOPHYAEXTSLBLIST) 70 76 71 Objs/tjyk.o : tjyk.cc radutil.h77 Objs/tjyk.o : tjyk.cc $(PKGHLIST) 72 78 $(CXXCOMPILE) -o Objs/tjyk.o tjyk.cc 79 80 ### programme applobe 81 Objs/applobe : Objs/applobe.o $(PKGOLIST) 82 $(CXXLINK) -o Objs/applobe Objs/applobe.o $(PKGOLIST) $(SOPHYAEXTSLBLIST) 83 84 Objs/applobe.o : applobe.cc $(PKGHLIST) 85 $(CXXCOMPILE) -o Objs/applobe.o applobe.cc 86 73 87 74 88 ### les classes / fonctions … … 79 93 $(CXXCOMPILE) -o Objs/mdish.o mdish.cc 80 94 95 Objs/lobe.o : lobe.cc lobe.h mdish.h qhist.h 96 $(CXXCOMPILE) -o Objs/lobe.o lobe.cc 97 81 98 Objs/qhist.o : qhist.cc qhist.h 82 99 $(CXXCOMPILE) -o Objs/qhist.o qhist.cc -
trunk/Cosmo/RadioBeam/mdish.cc
r3783 r3787 12 12 : typ_(typ), dx_((dx>1.e-3)?dx:1.), dy_((dy>1.e-3)?dy:1.) 13 13 { 14 setLambdaRef(); 15 setLambda(); 14 16 } 15 17 … … 17 19 double Four2DResponse::Value(double kx, double ky) 18 20 { 21 kx *= lambda_ratio_; 22 ky *= lambda_ratio_; 19 23 double wk,wkx,wky; 20 24 switch (typ_) … … 62 66 double Four2DRespTable::Value(double kx, double ky) 63 67 { 68 kx *= lambda_ratio_; 69 ky *= lambda_ratio_; 64 70 int_4 i,j; 65 71 if ( (kx<=hrep_.XMin())||(kx>=hrep_.XMax()) || -
trunk/Cosmo/RadioBeam/mdish.h
r3783 r3787 34 34 { typ_ = a.typ_; dx_=a.dx_; dy_=a.dy_; return (*this); } 35 35 36 inline void setLambdaRef(double lambda=1.) 37 { lambdaref_ = lambda; } 38 inline void setLambda(double lambda=1.) 39 { lambda_ = lambda; lambda_ratio_ = lambdaref_/lambda_; } 40 36 41 // Return the 2D response for wave vector (kx,ky) 37 42 virtual double Value(double kx, double ky); … … 45 50 int typ_; 46 51 double dx_, dy_; 52 double lambdaref_, lambda_; 53 double lambda_ratio_; // lambdaref_/lambda_; 54 47 55 }; 48 56 -
trunk/Cosmo/RadioBeam/specpk.cc
r3783 r3787 151 151 // fourAmp represent 3-D fourier transform of a real input array. 152 152 // The second half of the array along Y and Z contain negative frequencies 153 double kxx, kyy, kzz ;153 double kxx, kyy, kzz, rep, amp; 154 154 // sa_size_t is large integer type 155 155 for(sa_size_t kz=0; kz<fourAmp.SizeZ(); kz++) { … … 158 158 kyy = (ky>fourAmp.SizeY()/2) ? -(double)(fourAmp.SizeY()-ky)*dky_ : (double)ky*dky_; 159 159 for(sa_size_t kx=0; kx<fourAmp.SizeX(); kx++) { 160 doublekxx=(double)kx*dkx_;161 doublerep = resp(kxx, kyy);160 kxx=(double)kx*dkx_; 161 rep = resp(kxx, kyy); 162 162 if (crmask&&(kz==0)) mask(ky,kx)=((rep<1.e-8)?9.e9:(1./rep)); 163 163 if (rep<1.e-8) fourAmp(kx, ky, kz) = complex<TF>(9.e9,0.); 164 164 else { 165 doubleamp = 1./sqrt(rep)/sqrt(2.);165 amp = 1./sqrt(rep)/sqrt(2.); 166 166 fourAmp(kx, ky, kz) = complex<TF>(rg_.Gaussian(amp), rg_.Gaussian(amp)); 167 167 } -
trunk/Cosmo/RadioBeam/syncube.cc
r3785 r3787 115 115 double mean, sigma; 116 116 MeanSigma(omap, mean, sigma); 117 cout << "syncube[2] omap : Mean=" << mean << " Sigma=" << sigma << " Jy -Sizes:" << endl;117 cout << "syncube[2] omap : Mean=" << mean << " Sigma=" << sigma << " Sizes:" << endl; 118 118 omap.Show(); 119 119 -
trunk/Cosmo/RadioBeam/tjyk.cc
r3785 r3787 6 6 int main(int narg, char* arg[]) 7 7 { 8 if (narg<2) { 9 cout << " Usage: tjyk redshift [resol_arcmin] " << endl; 10 return 1; 11 } 8 12 9 13 H21Conversions conv;
Note:
See TracChangeset
for help on using the changeset viewer.