Changeset 3983 in Sophya for trunk/Cosmo/SimLSS/cmvgsm2cube.cc
- Timestamp:
- May 4, 2011, 7:13:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/cmvgsm2cube.cc
r3790 r3983 11 11 #include "skymap.h" 12 12 13 // set fname = ( `cat gsm820948.list | awk '{print $3}' | sed 's/data/ppf/'` ) 14 // cmvgsm2cube -o gsm820948_cube.ppf -p 360,0.1666667,160. -t 360,0.1666667,30. $fname 13 // set rname = gsm820948 14 // set fname = ( `cat ${rname}.list | awk '{print $3}' | sed 's/data/ppf/'` ) 15 // cmvgsm2cube -o ${rname}_cube.ppf -p 360,0.1666667,160. -t 360,0.1666667,30. $fname 15 16 16 17 void usage(void) … … 19 20 <<"cmvgsm2cube [options] liste_des_spheres_healpix"<<endl 20 21 <<" -o outname.ppf : ppf cube output file name (def=cmvgsm2cube.ppf)"<<endl 21 <<" -p nphi,dphi,phi0 : phi0 -> phi0 +nphi*dphi (degres)"<<endl22 <<" -t ntheta,dtheta,theta0 : theta0 -> theta0 +ntheta*dtheta (degres)"<<endl22 <<" -p nphi,dphi,phi0 : phi0 -> phi0 + nphi*dphi (degres)"<<endl 23 <<" -t ntheta,dtheta,theta0 : theta0 -> theta0 + ntheta*dtheta (degres)"<<endl 23 24 <<endl; 24 25 } … … 66 67 cout<<"Number of spheres "<<sphname.size()<<endl; 67 68 68 TArray<r_4> Cube(sphname.size(),nphi,ntheta); 69 Cube = 0.; 69 TVector<r_4> Theta(ntheta); 70 int nthgood = 0; 71 float thmin = 1.e30, thmax = -1.e30; 72 for(int it=0;it<ntheta;it++) { 73 Theta(it) = -9999.; 74 double t = theta0 + it*dtheta; t *= M_PI/180.; 75 if(t<0. || t>M_PI) continue; // [0,Pi] 76 Theta(it) = t; 77 nthgood += 1; 78 if(t<thmin) thmin = t; 79 if(t>thmax) thmax = t; 80 } 81 cout<<"Theta: ngood="<<nthgood<<" ["<<thmin*180/M_PI<<","<<thmax*180/M_PI 82 <<"] middle="<<0.5*(thmin+thmax)*180/M_PI<<endl; 83 84 TVector<r_4> Phi(nphi); 85 float phmin = 1.e30, phmax = -1.e30; 86 for(int ip=0;ip<nphi;ip++) { 87 double p = phi0 + ip*dphi; p *= M_PI/180.; 88 while(p<0.) p += 2.*M_PI; 89 while(p>=2.*M_PI) p -= 2.*M_PI; 90 Phi(ip) = p; 91 if(p<phmin) phmin = p; 92 if(p>phmax) phmax = p; 93 } 94 cout<<"Phi: ["<<phmin*180/M_PI<<","<<phmax*180/M_PI 95 <<"] middle="<<0.5*(phmin+phmax)*180/M_PI<<endl; 96 97 98 TVector<r_4> Freq(sphname.size()); Freq = -1.; 99 TArray<r_4> Cube(sphname.size(),nphi,ntheta); Cube = 0.; 70 100 for(unsigned int is=0;is<sphname.size();is++) { 71 72 101 cout<<"... "<<sphname[is]<<endl; 73 102 PInPersist pis(sphname[is]); 74 103 SphereHEALPix<r_4> sph; 75 104 pis>>PPFNameTag("sph")>>sph; 76 77 for(int it=0;it<ntheta;it++) { 78 double t = theta0 + it*dtheta; t *= M_PI/180.; 79 if(t<0. || t>M_PI) continue; 80 for(int ip=0;ip<nphi;ip++) { 81 double p = phi0 + ip*dphi; p *= M_PI/180.; 82 while(p<0.) p += 2.*M_PI; 83 while(p>=2.*M_PI) p -= 2.*M_PI; 84 int_4 ksph = sph.PixIndexSph(t,p); 85 Cube(is,ip,it) = sph(ksph); 105 Freq(is) = (r_4)sph.Info()["FMHz"]; 106 for(int it=0;it<Theta.Size();it++) { 107 double t = Theta(it); 108 if(t<0.) continue; 109 for(int ip=0;ip<Phi.Size();ip++) { 110 double p = Phi(ip); 111 int_4 ksph = sph.PixIndexSph(t,p); 112 Cube(is,ip,it) = sph(ksph); 113 } 86 114 } 87 }88 89 115 } 90 116 91 117 POutPersist pos(ppfrn); 92 118 pos<<PPFNameTag("cube")<<Cube; 119 pos<<PPFNameTag("theta")<<Theta; 120 pos<<PPFNameTag("phi")<<Phi; 121 pos<<PPFNameTag("freq")<<Freq; 93 122 94 123 return 0; … … 100 129 print cube 101 130 131 n/plot phi.val*180./M_PI%n ! ! "cpts" 132 n/plot theta.val*180./M_PI%n ! ! "cpts" 133 disp freq 134 102 135 objaoper cube sliceyz 0 103 136 objaoper cube sliceyz 128
Note:
See TracChangeset
for help on using the changeset viewer.