// Pour boucher les trous d'une sphere HEALPIX en la clusterisant // dans une sphere plus petite puis en la re-extrapolant. // cmv 13/6/01 // extrapsph -r 2 sph143k05.fits sph143k05_e.fits // sphout.fits sphoutw.fits sphred.fits sphredw.fits #include "sopnamsp.h" #include "machdefs.h" #include #include #include #include #include #include "skymapinit.h" #include "skymap.h" #include "fitsspherehealpix.h" /*! \ingroup PrgMap \file extrapsph.cc \brief \b extrapsph: Fill holes in a sphere of datas by reducing it size and re-extrapolating. \verbatim csh> extrapsph -h extrapsph [-r reduc_factor] sphin.fits sphinw.fits sphout.fits [sphout_w.fits sphred.fits sphred_w.fits] -r reduc : reduction factor for clustering (must be 2^n, def=2) sphin.fits : input sphere sphin_w.fits : input sphere filling weight sphout.fits : output sphere sphout_w.fits : output sphere filling weight sphred.fits : output reducted sphere sphred_w.fits : output reducted sphere filling weight \endverbatim */ void usage(); void usage() { cout<<"extrapsph [-r reduc_factor] sphin.fits sphinw.fits"<=narg) {usage(); exit(1);} char * fsphin = arg[optind]; char * fsphinw = arg[optind+1]; char * fsphout = arg[optind+2]; char * fsphoutw = NULL; char * fsphred = NULL; char * fsphredw = NULL; if(optind+3 sphin; {FitsInFile sfits(fsphin); sfits >> sphin;} int nlat = sphin.SizeIndex(); int nlatr = nlat/red; cout<<"Opening Input Sphere :"< sphinw; {FitsInFile sfits(fsphinw); sfits >> sphinw;} cout<<"Opening Input Weight Sphere :"< 0.) {sphred(ir) /= sphredw(ir); n++;} cout<<" Reducted Sphere: Number of pixels filled "<0.) continue; double theta,phi; sphin.PixThetaPhi(i,theta,phi); int_4 ir = sphred.PixIndexSph(theta,phi); if(sphredw(ir)<=0.) continue; sphin(i) = sphred(ir); // On passe en negatif les pixels qui ont ete extrapoles sphinw(i) = -sphredw(ir); n++; } cout<<" Output Sphere: Number of pixels filled "<