Changeset 1528 in Sophya for trunk/SophyaProg/PrgMap/extrapsph.cc
- Timestamp:
- Jun 14, 2001, 5:16:20 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/PrgMap/extrapsph.cc
r1526 r1528 1 1 // Pour boucher les trous d'une sphere HEALPIX en clusterisant dans une sphere 2 2 // plus petite cmv 13/6/01 3 // extrapsph -r 2 sph143k05.fits sph143k05_e.fits 4 // sphout.fits sphoutw.fits sphred.fits sphredw.fits 3 5 #include "machdefs.h" 4 6 #include <unistd.h> … … 17 19 <<" sphout.fits [sphout_w.fits" 18 20 <<" sphred.fits sphred_w.fits]"<<endl 19 <<" -r reduc : reduction factor for nlat in clustering must be 2^n (def=2)"<<endl20 <<" sphin.fits : input sphere"<<endl21 <<" sphin_w.fits : input sphere filling weight"<<endl22 <<" sphout.fits : output sphere"<<endl23 <<" sphout_w.fits 24 <<" sphred.fits : output reducted sphere"<<endl25 <<" sphred_w.fits 21 <<" -r reduc : reduction factor for clustering (must be 2^n, def=2)"<<endl 22 <<" sphin.fits : input sphere"<<endl 23 <<" sphin_w.fits : input sphere filling weight"<<endl 24 <<" sphout.fits : output sphere"<<endl 25 <<" sphout_w.fits : output sphere filling weight"<<endl 26 <<" sphred.fits : output reducted sphere"<<endl 27 <<" sphred_w.fits : output reducted sphere filling weight"<<endl; 26 28 } 27 29 … … 52 54 if(optind+5<narg) fsphredw = arg[optind+5]; 53 55 54 cout<<" Sphere Input: "<<fsphin<<endl55 <<" Weight Sphere Input: "<<fsphinw<<endl56 <<" Sphere Output: "<<fsphout<<endl57 <<" Weight Sphere Output: "<<fsphoutw<<endl58 <<" Reducted Sphere Output: "<<fsphred<<endl59 <<" Reducted Weight Sphere Output: "<<fsphredw<<endl56 cout<<"Input Sphere : "<<fsphin<<endl 57 <<"Input Weight Sphere : "<<fsphinw<<endl 58 <<"Output Sphere : "<<fsphout<<endl 59 <<"Output Weight Sphere : "<<fsphoutw<<endl 60 <<"Output Reducted Sphere : "<<fsphred<<endl 61 <<"Output Reducted Weight Sphere : "<<fsphredw<<endl 60 62 <<"Reduction : "<<red<<endl; 61 63 … … 65 67 int nlat = sphin.SizeIndex(); 66 68 int nlatr = nlat/red; 67 cout<<"Opening Sphere Input:"<<endl69 cout<<"Opening Input Sphere :"<<endl 68 70 <<" Type of map : "<<sphin.TypeOfMap()<<endl 69 71 <<" Number of pixels : "<<sphin.NbPixels()<<endl … … 72 74 SphereHEALPix<r_8> sphinw; 73 75 {FitsInFile sfits(fsphinw); sfits >> sphinw;} 74 cout<<"Opening Weight Sphere Input:"<<endl76 cout<<"Opening Input Weight Sphere :"<<endl 75 77 <<" Type of map : "<<sphinw.TypeOfMap()<<endl 76 78 <<" Number of pixels : "<<sphinw.NbPixels()<<endl … … 81 83 } 82 84 83 // Creation des spheres output84 cout<<"Creating Spheres for output"<<endl;85 SphereHEALPix<r_8> sphout(sphin,false);86 SphereHEALPix<r_8> sphoutw(sphinw,false);87 88 85 // Creation des spheres reduites 89 86 cout<<"Creating Reducted Spheres : nlatr = "<<nlatr<<endl; … … 92 89 SphereHEALPix<r_8> sphredw(nlatr); 93 90 sphredw.SetPixels(0.); 94 cout<<"Creating Reducted Sphere :"<<endl 95 <<" Number of pixels : "<<sphred.NbPixels()<<endl 91 cout<<" Number of pixels : "<<sphred.NbPixels()<<endl 96 92 <<" Nlat : "<<sphred.SizeIndex()<<endl; 97 93 98 94 // Filling reducted spheres 99 95 cout<<"...Filling Reducted Spheres"<<endl; 96 uint_4 n=0; 100 97 for(int_4 i=0;i<sphin.NbPixels();i++) { 101 98 if(sphinw(i)<=0.) continue; … … 105 102 sphred(ir) += sphin(i)*sphinw(i); 106 103 sphredw(ir) += sphinw(i); 104 n++; 107 105 } 106 cout<<" Input Sphere: Number of filled pixels "<<n<<endl; 108 107 cout<<"...Computing Reducted Spheres"<<endl; 109 uint_4n=0;108 n=0; 110 109 for(int_4 ir=0;ir<sphred.NbPixels();ir++) 111 110 if(sphredw(ir) > 0.) {sphred(ir) /= sphredw(ir); n++;} 112 cout<<" Number of filled pixels"<<n<<endl;111 cout<<" Reducted Sphere: Number of pixels filled "<<n<<endl; 113 112 114 113 // Filling hole for Output Spheres 115 114 cout<<"...Filling hole for Output Spheres"<<endl; 116 115 n=0; 117 for(int_4 i=0;i<sph out.NbPixels();i++) {118 if(sph outw(i)>0.) continue;116 for(int_4 i=0;i<sphin.NbPixels();i++) { 117 if(sphinw(i)>0.) continue; 119 118 double theta,phi; 120 sph out.PixThetaPhi(i,theta,phi);119 sphin.PixThetaPhi(i,theta,phi); 121 120 int_4 ir = sphred.PixIndexSph(theta,phi); 122 121 if(sphredw(ir)<=0.) continue; 123 sph out(i) = sphred(ir);124 sph outw(i) = -sphredw(ir);122 sphin(i) = sphred(ir); 123 sphinw(i) = -sphredw(ir); 125 124 n++; 126 125 } 127 cout<<" Number of filled pixels"<<n<<endl;126 cout<<" Output Sphere: Number of pixels filled "<<n<<endl; 128 127 129 128 // Ecriture des spheres … … 132 131 FitsOutFile sfits(fsphout); 133 132 cout<<"Writing Output Sphere Fits file"<<endl; 134 sfits<<sph out;133 sfits<<sphin; 135 134 } 136 135 if(fsphoutw) { … … 138 137 FitsOutFile sfits(fsphoutw); 139 138 cout<<"Writing Output Sphere Weight Fits file"<<endl; 140 sfits<<sph outw;139 sfits<<sphinw; 141 140 } 142 141 if(fsphred) {
Note:
See TracChangeset
for help on using the changeset viewer.