Changeset 3983 in Sophya for trunk/Cosmo/SimLSS/cmvgsm2cube.cc


Ignore:
Timestamp:
May 4, 2011, 7:13:16 PM (14 years ago)
Author:
cmv
Message:

amelioration des reconstructions et fits du GSM, cmv 4/5/2011

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/SimLSS/cmvgsm2cube.cc

    r3790 r3983  
    1111#include "skymap.h"
    1212
    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
    1516
    1617void usage(void)
     
    1920<<"cmvgsm2cube [options] liste_des_spheres_healpix"<<endl
    2021<<" -o outname.ppf : ppf cube output file name (def=cmvgsm2cube.ppf)"<<endl
    21 <<" -p nphi,dphi,phi0 : phi0 -> phi0+nphi*dphi (degres)"<<endl
    22 <<" -t ntheta,dtheta,theta0 : theta0 -> theta0+ntheta*dtheta (degres)"<<endl
     22<<" -p nphi,dphi,phi0 : phi0 -> phi0 + nphi*dphi (degres)"<<endl
     23<<" -t ntheta,dtheta,theta0 : theta0 -> theta0 + ntheta*dtheta (degres)"<<endl
    2324<<endl;
    2425}
     
    6667 cout<<"Number of spheres "<<sphname.size()<<endl;
    6768
    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.;
    70100 for(unsigned int is=0;is<sphname.size();is++) {
    71 
    72101   cout<<"... "<<sphname[is]<<endl;
    73102   PInPersist pis(sphname[is]);
    74103   SphereHEALPix<r_4> sph;
    75104   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     }
    86114   }
    87    }
    88 
    89115 }
    90116 
    91117 POutPersist pos(ppfrn);
    92118 pos<<PPFNameTag("cube")<<Cube;
     119 pos<<PPFNameTag("theta")<<Theta;
     120 pos<<PPFNameTag("phi")<<Phi;
     121 pos<<PPFNameTag("freq")<<Freq;
    93122
    94123 return 0;
     
    100129print cube
    101130
     131n/plot phi.val*180./M_PI%n ! ! "cpts"
     132n/plot theta.val*180./M_PI%n ! ! "cpts"
     133disp freq
     134
    102135objaoper cube sliceyz 0
    103136objaoper cube sliceyz 128
Note: See TracChangeset for help on using the changeset viewer.