Changeset 905 in Sophya


Ignore:
Timestamp:
Apr 13, 2000, 12:12:47 PM (25 years ago)
Author:
ansari
Message:

Sophie: adding the dipole here also

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/PMixer/tgsky.cc

    r856 r905  
    2929    cout << "   - TypSky = 1  Params= m,sig  , OOFNoise(sig) + m" << endl;
    3030    cout << "   - TypSky = 2  Params= K,a,b,m  K*cos(a*teta)*sin(b*phi)+m" << endl;   
     31    cout << "   - TypSky = 3  Params= theta,phi DIPOLE" << endl;   
    3132    exit(0);
    3233    }
     
    4041  int typ = atoi(arg[2]);
    4142  double m,s,a,b,K;
     43  double Theta,Phi;
     44  Theta = 0.;
     45  Phi   = 0.;
    4246  m = 0.;
    4347  s = 1.;
    4448  a = b = 1.;
    4549  K = 1.;
    46   if ((typ < 0) || (typ > 2)) typ = 0;
     50  if ((typ < 0) || (typ > 3)) typ = 0;
    4751  if (typ < 2)  {
    4852    sscanf(arg[3],"%lg,%lg",&m,&s);
     
    5155    else cout << "  ---> NoiseGenerator() " << endl;
    5256  }
    53   else {
     57  else if(typ==2) {
    5458    sscanf(arg[3],"%lg,%lg,%lg,%lg",&K,&a,&b,&m);
    5559    cout << "  TypSky= " << typ << " K= " << m << " a= " << a << " b="
    5660         << b << " m= " << m << endl;
    5761    cout << "    ---> K * cos(a*teta) * sin(b*teta) + m" << endl;
     62    }
     63  else if(typ==3) {
     64    sscanf(arg[3],"%lg,%lg",&Theta,&Phi);
     65    cout << "  TypSky= " << typ << " Theta= " << Theta << " phi= " << Phi ;
     66    cout << "    ---> DIPOLE " << endl;
    5867    }
    5968
     
    6675    }
    6776  }
    68   else {
     77  else if(typ==3)
     78    {
     79      UnitVector vd(Theta,Phi);
     80      UnitVector vc(Theta,Phi);
     81      for(int i=0; i<sph.NbPixels(); i++)
     82        {
     83          double Thetar,Phir;
     84          sph.PixThetaPhi(i,Thetar,Phir);     
     85          vc.SetThetaPhi(Thetar,  Phir);
     86          sph(i) += vd.Psc(vc);
     87        }
     88    }
     89  else{
    6990    NoiseGenerator * ng;
    7091    if (typ == 0) ng = new NoiseGenerator(s);
Note: See TracChangeset for help on using the changeset viewer.