Changeset 568 in Sophya


Ignore:
Timestamp:
Nov 10, 1999, 3:17:10 PM (26 years ago)
Author:
ansari
Message:

ajout doc GLM

Location:
trunk/SophyaLib/Samba
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Samba/bruit.cc

    r517 r568  
    1717//  Le code des classes   NoiseGenerator  RWalkNoise
    1818
    19 
    20 /* --Methode-- */
     19//++
     20// Class        NoiseGenerator
     21//
     22// include      bruit.h math.h fmath.h nbrandom.h
     23//
     24//--
     25//++
     26//
     27// Links        Childs
     28//
     29//    RWalkNoise OOFNoise EXPNoise MemNoise  SumNoise
     30//     
     31//--
     32//++
     33// Titre        Constructors
     34//--
     35
     36/* --Methode-- */
     37//++
    2138NoiseGenerator::NoiseGenerator(float sigma)
     39//
     40//--
    2241{
    2342if (sigma < 0.)  sigma = 1.;
     
    2746}
    2847
    29 /* --Methode-- */
     48//++
     49// Titre        Destructor
     50//--
     51/* --Methode-- */
     52//++
    3053NoiseGenerator::~NoiseGenerator()
     54//
     55//--
    3156{
    3257    //printf("-- NoiseGenerator::~NoiseGenerator() (Destructeur) --- \n");
    3358}
    3459
    35 /* --Methode-- */
     60
     61//++
     62//
     63// inline  unsigned long int  NoiseGenerator::NCoups()
     64//--
     65//++
     66// Titre        Public Methods
     67//--
     68
     69/* --Methode-- */
     70//++
    3671float NoiseGenerator::Noise()
     72//
     73//--
    3774{
    3875mNCoups++;
    3976return(NorRand()*mSigma);
    4077}
    41 
    42 /* --Methode-- */
     78//++
     79// Class        RWalkNoise
     80//
     81// include      bruit.h math.h fmath.h nbrandom.h
     82//
     83//--
     84//++
     85//
     86// Links        Parents
     87//
     88//    NoiseGenerator
     89//     
     90//--
     91//++
     92// Titre        Constructor
     93//--
     94
     95/* --Methode-- */
     96//++
    4397RWalkNoise::RWalkNoise(float sigma)
    4498    : NoiseGenerator(sigma)
     99//
     100//--
    45101{
    46102mState = 0.;
     
    49105
    50106
    51 /* --Methode-- */
     107//++
     108// Titre        Destructor
     109//--
     110/* --Methode-- */
     111//++
    52112RWalkNoise::~RWalkNoise()
     113//
     114//--
    53115{
    54116//printf("--  RWalkNoise::~RWalkNoise (Destructeur) ---\n");
     
    56118}
    57119
    58 /* --Methode-- */
     120//++
     121// Titre        Public Methods
     122//--
     123/* --Methode-- */
     124//++
    59125float RWalkNoise::Noise()
     126//
     127//--
    60128{
    61129mState += NoiseGenerator::Noise();
     
    63131}
    64132
    65 
    66 /* --Methode-- */
     133//++
     134// Class        OOFNoise
     135//
     136// include      bruit.h math.h fmath.h nbrandom.h
     137//
     138//--
     139//++
     140//
     141// Links        Parents
     142//
     143//    NoiseGenerator
     144//     
     145//--
     146//++
     147// Titre        Constructor
     148//--
     149
     150/* --Methode-- */
     151//++
    67152OOFNoise::OOFNoise(float sigma, int typacf, int mem, float tau)
    68153    : NoiseGenerator(sigma)
     154//
     155//--
    69156{
    70157if (typacf != ACF_Exp)   typacf = ACF_Exp;
     
    89176
    90177
    91 /* --Methode-- */
     178//++
     179// Titre        Destructor
     180//--
     181/* --Methode-- */
     182//++
    92183OOFNoise::~OOFNoise()
     184//
     185//--
    93186{
    94187delete[] mState;
     
    98191
    99192
    100 /* --Methode-- */
     193//++
     194// Titre        Public Methods
     195//--
     196/* --Methode-- */
     197//++
    101198float OOFNoise::Noise()
     199//
     200//--
    102201{
    103202int i;
     
    112211
    113212/* --Methode-- */
     213//++
    114214void OOFNoise::Print()
     215//
     216//--
    115217{
    116218int i,j;
     
    122224return;
    123225}
    124 
    125 /* --Methode-- */
     226//++
     227// Class        EXPNoise
     228//
     229// include      bruit.h math.h fmath.h nbrandom.h
     230//
     231//--
     232//++
     233//
     234// Links        Parents
     235//
     236//    NoiseGenerator
     237//     
     238//--
     239//++
     240// Titre        Constructor
     241//--
     242
     243/* --Methode-- */
     244//++
    126245EXPNoise::EXPNoise(float sigma, int typacf, int mem, float tau)
    127246    : NoiseGenerator(sigma)
     247//
     248//--
    128249{
    129250if (typacf != ACF_Exp)   typacf = ACF_Exp;
     
    146267
    147268
    148 /* --Methode-- */
     269//++
     270// Titre        Destructor
     271//--
     272/* --Methode-- */
     273//++
    149274EXPNoise::~EXPNoise()
     275//
     276//--
    150277{
    151278delete[] mState;
     
    155282
    156283
    157 /* --Methode-- */
     284//++
     285// Titre        Public Methods
     286//--
     287/* --Methode-- */
     288//++
    158289float EXPNoise::Noise()
     290//
     291//--
    159292{
    160293int i;
     
    169302
    170303/* --Methode-- */
     304//++
    171305void EXPNoise::Print()
     306//
     307//--
    172308{
    173309int i,j;
     
    180316return;
    181317}
    182 /* --Methode-- */
     318
     319//++
     320// Class        MemNoise
     321//
     322// include      bruit.h math.h fmath.h nbrandom.h
     323//
     324//--
     325//++
     326//
     327// Links        Parents
     328//
     329//    NoiseGenerator
     330//     
     331//--
     332//++
     333// Titre        Constructor
     334//--
     335
     336
     337
     338/* --Methode-- */
     339//++
    183340MemNoise::MemNoise(float sigma, int mem, float tau, int ava)
    184341    : NoiseGenerator(sqrtf(fabsf(tau))*sigma)
     342//
     343//--
    185344{
    186345/* on tire les instants des impulsions successives selon une
     
    223382
    224383
    225 /* --Methode-- */
     384//++
     385// Titre        Destructor
     386//--
     387/* --Methode-- */
     388//++
    226389MemNoise::~MemNoise()
     390//
     391//--
    227392{
    228393delete[] mStPos;
     
    233398}
    234399
    235 /* --Methode-- */
     400//++
     401// Titre        Public Methods
     402//--
     403/* --Methode-- */
     404//++
    236405float MemNoise::Noise()
     406//
     407//--
    237408{
    238409return(Avance(0));
     
    240411
    241412/* --Methode-- */
     413//++
    242414float MemNoise::Avance(long Asauter)
     415//
     416//--
    243417{
    244418int i,j;
     
    421595}
    422596/* --Methode-- */
    423 
     597//++
    424598int MemNoise::Print()
     599//
     600//--
    425601{
    426602int i,j,rc=0;
     
    436612
    437613
     614//++
     615// Class        SumNoise
     616//    Generateur de bruit blanc + 1/f avec fknee
     617//
     618// include      bruit.h math.h fmath.h nbrandom.h
     619//
     620//--
     621//++
     622//
     623// Links        Parents
     624//
     625//    NoiseGenerator
     626//     
     627//--
     628//++
     629// Titre        Constructor
     630//--
    438631// Generateur de bruit blanc + 1/f avec fknee
    439632
    440633
    441634/* --Methode-- */
     635//++
    442636SumNoise::SumNoise(float fknee, float sig)
    443637    : NoiseGenerator(sig)
     638//
     639//--
    444640{
    445641// Reza 27/01/98 :
     
    449645
    450646
    451 /* --Methode-- */
     647//++
     648// Titre        Destructor
     649//--
     650/* --Methode-- */
     651//++
    452652SumNoise::~SumNoise()
     653//
     654//--
    453655{
    454656delete mn;
    455657}
    456658
    457 /* --Methode-- */
     659//++
     660// Titre        Public Methods
     661//--
     662/* --Methode-- */
     663//++
    458664float SumNoise::Noise()
     665//
     666//--
    459667{
    460668return(NoiseGenerator::Noise() + mn->Noise());
  • trunk/SophyaLib/Samba/circle.cc

    r470 r568  
    11#include <math.h>
    22#include "circle.h"
    3 
     3//++
     4// Class        Circle
     5//
     6// include      circle.h math.h
     7//--
     8//++
     9//
     10// Links        Parents
     11//
     12//    Geometry
     13//   
     14//--
     15//++
     16// Titre        Constructors
     17//--
     18//++
    419Circle::Circle()
     20//
     21//--
    522{
    623  UnitVector temp;
    724  SetCircle(temp,M_PI/2.);
    825}
    9 
     26//++
    1027Circle::Circle(double theta, double phi, double aperture)
     28//
     29//--
    1130{
    1231  UnitVector temp(theta,phi);
    1332  SetCircle(temp,aperture);
    1433}
    15 
     34//++
    1635Circle::Circle(double x, double y, double z, double aperture)
     36//
     37//--
    1738{
    1839  UnitVector temp(x,y,z);
    1940  SetCircle(temp,aperture);
    2041}
    21 
     42//++
    2243Circle::Circle(const Vector3d& v, double aperture)
     44//
     45//--
    2346{
    2447  UnitVector temp=v;
    2548  SetCircle(temp,aperture);
    2649}
    27 
     50//++
    2851Circle::Circle(const Circle& c)
     52//
     53//    copy constructor
     54//--
    2955{
    3056  UnitVector temp=c.Omega();
    3157  SetCircle(temp,c._angouv);
    3258}
    33 
     59//++
     60// Titre        Public Methods
     61//--
     62//++
    3463void Circle::SetCircle(const UnitVector& temp, double aperture)
     64//
     65//--
    3566{
    3667  _spinunitaxis=temp;
     
    4374  _z=_spinunitaxis.Z();
    4475}
    45 
     76//++
    4677void Circle::SetSpinAxis(double theta, double phi)
     78//
     79//--
    4780{
    4881  UnitVector temp(theta,phi);
    4982  SetCircle(temp,_angouv);
    5083}
    51 
     84//++
    5285void Circle::SetSpinAxis(const Vector3d& u)
     86//
     87//--
    5388{
    5489  UnitVector temp=u;
    5590  SetCircle(temp,_angouv);
    5691}
    57 
     92//++
    5893void Circle::SetSpinAxis(double x, double y, double z)
     94//
     95//--
    5996{
    6097  UnitVector temp(x,y,z);
    6198  SetCircle(temp,_angouv);
    6299}
    63 
     100//++
    64101void Circle::SetApertureAngle(double aperture)
     102//
     103//--
    65104{
    66105  SetCircle(_spinunitaxis,aperture);
    67106}
    68 
     107//++
    69108void Circle::SetApertureAngle(const Circle& c)
     109//
     110//--
    70111{
    71112  SetCircle(_spinunitaxis,c._angouv);
    72113}
    73 
     114//++
    74115bool Circle::Intersection(const Circle& c, double* psi) const
     116//
     117//    psi contains  4 values of the intersection  angles.
     118//    -1 if  circles do not intersect
     119//    psi[0]=psi(i,j,0)
     120//    psi[1]=psi(i,j,1)
     121//    psi[2]=psi(j,i,0)
     122//    psi[3]=psi(j,i,1)
     123//--
    75124{
    76125  double alphak=_angouv;
     
    119168    }
    120169}
    121 
     170//++
    122171UnitVector Circle::ConvToSphere(double psi) const
     172//
     173//    Return UnitVector corresponding to a given position donnee on the circle
     174//--
    123175{
    124176  psi=mod(psi,pi2);
     
    137189  return UnitVector(xout,yout,zout);
    138190}
    139 
     191//++
    140192UnitVector Circle::TanOnCircle(double psi) const
     193//
     194//    Return UnitVector corresponding to the tangent to the circle
     195//    at given position on the circle.
     196//--
    141197{
    142198  psi=mod(psi,pi2);
     
    153209  return UnitVector(xout,yout,zout);
    154210}
    155 
     211//++
    156212UnitVector Circle::EPhi(double psi) const
     213//
     214//    Return the  vector  tangent to the sphere in the plane (xy)
     215//    at a given position on the circle.
     216//--
    157217{
    158218  psi=mod(psi,pi2);
    159219  return ConvToSphere(psi).EPhi();
    160220}
    161 
     221//++
    162222UnitVector Circle::ETheta(double psi) const
     223//
     224//    Return the other tangent  vector( orthogonal to EPhi)--
     225//    see previous method
     226//--
    163227{
    164228  psi=mod(psi,pi2);
    165229  return ConvToSphere(psi).ETheta();
    166230}
    167 
     231//++
    168232double Circle::SepAngleTanEPhi02PI(double psi) const
     233//
     234//    Return separation angle in [0,2Pi] at a given position on the
     235//    circle and EPhi
     236//--
    169237{
    170238  psi=mod(psi,pi2);
     
    175243  return angle;
    176244}
     245//++
     246void Circle::Print(ostream& os) const
     247//
     248//--
     249{
     250  os << "1 - Circle - Axe de Spin Unitaire : " << _spinunitaxis << endl;
     251  os << "1 - Circle - Axe de Spin : " << _spinaxis << endl;
     252  os << "2 - Circle - Angle d'ouverture : " << _angouv << endl;
     253  os << "3 - Circle - Theta,Phi : " << _theta << "," << _phi << endl;
     254  os << "4 - Circle - x,y,z : " << _x << "," << _y << "," << _z << endl;
     255}
     256//++
     257//
     258// inline double Theta() const
     259// inline double Phi() const
     260// inline double ApertureAngle() const
     261// inline Vector3d Omega() const
     262//--
     263//++
     264// Titre        Operators
     265//--
    177266
    178267Circle& Circle::operator=(const Circle& c)
     
    185274  return *this;
    186275}
    187 
     276//++
    188277bool Circle::operator==(const Circle& c) const
     278//
     279//--
    189280{
    190281  bool flag;
     
    193284  return flag;
    194285}
    195 
     286//++
    196287bool Circle::operator!=(const Circle& c) const
     288//
     289//--
    197290{
    198291  return (bool)(1-(this->operator==(c)));
    199292}
    200 
    201 void Circle::Print(ostream& os) const
    202 {
    203   os << "1 - Circle - Axe de Spin Unitaire : " << _spinunitaxis << endl;
    204   os << "1 - Circle - Axe de Spin : " << _spinaxis << endl;
    205   os << "2 - Circle - Angle d'ouverture : " << _angouv << endl;
    206   os << "3 - Circle - Theta,Phi : " << _theta << "," << _phi << endl;
    207   os << "4 - Circle - x,y,z : " << _x << "," << _y << "," << _z << endl;
    208 }
  • trunk/SophyaLib/Samba/circle.h

    r470 r568  
    3030  // psi contient les 4 valeurs des angles d intersection. -1 si les cercles ne se coupent pas
    3131  // voir la numerotation dans le .cc
     32  /*   psi contains  4 values of the intersection  angles.
     33    -1 if  circles do not intersect
     34    psi[0]=psi(i,j,0)
     35    psi[1]=psi(i,j,1)
     36    psi[2]=psi(j,i,0)
     37    psi[3]=psi(j,i,1)
     38  */
    3239  bool Intersection(const Circle&, double* psi) const;
    3340
    3441  // donne le UnitVector correspondant a une position donnee sur le cercle
     42  /*!    Return UnitVector corresponding to a given position donnee on the circle
     43   */
    3544  UnitVector ConvToSphere(double psi) const;
    3645
    3746  // donne le UnitVector correspondant la tangente au cercle en une position donnee sur le cercle
     47  /*!    Return UnitVector corresponding to the tangent to the circle */
     48//    at given position on the circle.
    3849  UnitVector TanOnCircle(double psi) const;
    3950
    4051  // donne le vecteur tangent dans le plan (xy) a la sphere en une position donnee sur le cercle
     52  /*!    Return the  vector  tangent to the sphere in the plane (xy)
     53    at a given position on the circle.
     54  */
    4155  UnitVector EPhi(double psi) const;
    4256
    4357  // donne l autre vecteur tangent (orthogonal a EPhi)
     58  /*!    Return the other tangent  vector( orthogonal to EPhi)--
     59    see previous method
     60  */
    4461  UnitVector ETheta(double psi) const;
    4562
    4663   // donne l angle de separation dans [0,2Pi] en une position donnee sur le cercle et EPhi
     64  /*!   Return separation angle in [0,2Pi] at a given position on the
     65    circle and EPhi
     66  */
    4767  double SepAngleTanEPhi02PI(double psi) const;
    4868
  • trunk/SophyaLib/Samba/lambuilder.cc

    r518 r568  
    22#include "lambuilder.h"
    33#include <iostream.h>
     4//++
     5// Class        Lambda2Builder
     6//
     7//    (see separate documentation)
     8//--
    49
    510double Lambda2Builder::bignorm = 1.e268; // = 1e-20*1.d288
  • trunk/SophyaLib/Samba/localmap.cc

    r518 r568  
    4040//    pixel(nx/2, ny/2)
    4141//
    42 //    la carte est consideree comme un tableau a deux indices i et j, i etant
    43 //    indice de colonne et j indice de ligne. La carte est supposee resider
    44 //    dans un plan tangent, dont le point de tangence est repere (x0,y0) dans
    45 //    la carte et (theta0, phi0) sur la sphere celeste. L'extension de la
    46 //    carte est definie par les valeurs de deux angles couverts respectivement
    47 //    par la totalite des pixels en x de la carte et la totalite des pixels
    48 //    en y. (SetSize()).
    49 //    On considere un "plan de reference" : plan tangent a la sphere celeste
    50 //    aux angles theta=Pi/2 et phi=0. Dans ce plan L'origine des coordonnees
    51 //    est le point de tangence. L'axe Ox est la tangente parallele a
    52 //    l'equateur, dirige vers les phi croissants, l'axe Oy est parallele
    53 //    au meridien, dirige vers le pole nord.
    54 //    De maniere interne a la classe une carte est definie dans ce plan de
    55 //    reference et transportee  jusqu'au point (theta0, phi0) de sorte que
    56 //    les axes restent paralleles aux meridiens et paralleles. L'utilisateur
    57 //    peut definir sa carte selon un repere en rotation par rapport au repere
    58 //    de reference (par l'angle entre le parallele et l'axe Ox souhaite --
    59 //    methode SetOrigin(...))
     42//    A local map is a 2 dimensional array, with i as column index and j
     43//    as row index. The map is supposed to lie on a plan tangent to the
     44//    celestial sphere in a point whose coordinates are (x0,y0) on the local
     45//    map and (theta0, phi0) on the sphere. The range of the map is defined
     46//    by two values of angles covered respectively by all the pixels in
     47//    x direction and all the pixels in y direction (SetSize()).
     48//
     49//    A "reference plane" is considered : this plane is tangent to the
     50//    celestial sphere in a point with angles theta=Pi/2 and phi=0. This
     51//    point is the origine of coordinates is of the reference plane. The
     52//    x-axis is the tangent parallel to the equatorial line and oriented
     53//    toward the increasing phi's ; the y-axis is parallel to the meridian
     54//    line and oriented toward the north pole.
     55//   
     56//    Internally, a map is first defined within this reference plane and
     57//    tranported until the point (theta0, phi0) in such a way that both
     58//    axes are kept parallel to meridian and parallel lines of the sphere.
     59//    The user can define its own map with axes rotated with respect to
     60//    reference axes (this rotation is characterized by angle between
     61//    the local parallel line and the wanted x-axis-- see method
     62//    SetOrigin(...))
     63//   
     64//
    6065
    6166//
     
    7075//++
    7176//
    72 // Links        Descendants
     77// Links        Childs
    7378//
    7479//     
    7580//--
    7681//++
    77 // Titre        Constructeurs
     82// Titre        Constructors
    7883//--
    7984//++
     
    8186LocalMap<T>::LocalMap()
    8287//
    83 // Constructeur par defaut
     88//    
    8489//--
    8590{
     
    9196LocalMap<T>::LocalMap(int nx, int ny) : nSzX_(nx), nSzY_(ny)
    9297//
    93 // Constructeur
     98//    
    9499//--
    95100{
     
    104109LocalMap<T>::LocalMap(const LocalMap<T>& lm)
    105110//
    106 // Constructeur de recopie
     111//    copy constructor
    107112//--
    108113{
     
    130135
    131136//++
     137// Titre        Destructor
     138//--
     139//++
    132140template<class T>
    133141LocalMap<T>::~LocalMap()
    134142//
    135 // Destructeur
    136143//--
    137144{
     
    139146}
    140147
    141 //++
    142 template<class T>
    143 void LocalMap<T>::InitNul()
    144 //
    145 // Initialise à zéro certaines variables internes
    146 //--
    147 {
    148   originFlag_= false;
    149   extensFlag_= false;
    150   cos_angle_= 1.0;
    151   sin_angle_= 0.0;
    152   pixels_.Reset();
    153 }
     148
     149
     150//++
     151// Titre        Public Methods
     152//--
    154153
    155154//++
     
    157156void LocalMap<T>::ReSize(int nx, int ny)
    158157//
    159 // Redimensionne l'espace de stokage des pixels
     158//    Resize storage area for pixels
    160159//--
    161160{
     
    169168
    170169//++
    171 // Titre        Methodes
    172 //--
    173 
    174 
    175 //++
    176170template<class T>
    177171int LocalMap<T>::NbPixels() const
    178172//
    179 //    Retourne le nombre de pixels du découpage
     173//    Return number of pixels
    180174//--
    181175{
     
    187181T& LocalMap<T>::PixVal(int k)
    188182//
    189 //    Retourne la valeur du contenu du pixel d'indice k
     183//    Return value of pixel with index k
    190184//--
    191185{
     
    205199T const& LocalMap<T>::PixVal(int k) const
    206200//
    207 //    Retourne la valeur du contenu du pixel d'indice k
     201//   const version of previous method
    208202//--
    209203{
     
    220214//++
    221215template<class T>
    222 bool LocalMap<T>::ContainsSph(double theta, double phi) const
    223 //--
    224 {
    225   return(true);  // $CHECK$  A MODIFIER - Reza 26/10/99
    226 }
    227 
    228 //++
    229 template<class T>
    230216int LocalMap<T>::PixIndexSph(double theta,double phi) const
    231217//
    232 //    Retourne l'indice du pixel vers lequel pointe une direction définie par
    233 //    ses coordonnées sphériques
     218//    Return index of the pixel with spherical coordinates (theta,phi)
    234219//--
    235220{
     
    275260void LocalMap<T>::PixThetaPhi(int k,double& theta,double& phi) const
    276261//
    277 //    Retourne les coordonnées (theta,phi) du milieu du pixel d'indice k
     262//    Return (theta, phi) coordinates of pixel with index k
    278263//--
    279264{
     
    302287double LocalMap<T>::PixSolAngle(int k) const
    303288//
    304 // Pixel Solid angle  (steradians)
    305 // All the pixels have not necessarly the same size in (theta, phi)
    306 // because of the projection scheme which is not yet fixed.   
     289//    Pixel Solid angle  (steradians)
     290//    All the pixels have not necessarly the same size in (theta, phi)
     291//    because of the projection scheme which is not yet fixed.   
    307292//--
    308293{
     
    339324void LocalMap<T>::SetOrigin(double theta0,double phi0,double angle)
    340325//
    341 // Fixe la repere de reference ( angles en degres)
     326//    set the referential of the map (angles in degrees)
     327//    (default x0=siz_x/2,  y0=siz_y/2)
    342328//--
    343329{
     
    357343void LocalMap<T>::SetOrigin(double theta0,double phi0,int x0,int y0,double angle)
    358344//
    359 // Fixe le repere de reference (angles en degres) 
     345//    set the referential of the map (angles in degrees)
    360346//--
    361347{
     
    375361void LocalMap<T>::SetSize(double angleX,double angleY)
    376362//
    377 // Fixe l'extension de la carte (angles en degres)
     363//    angle range of tthe map (angles in degrees)
    378364//--
    379365{
     
    393379void LocalMap<T>::Project(SphericalMap<T>& sphere) const
    394380//
    395 // Projection to spherical map   
     381//    Projection to a spherical map   
    396382//--
    397383{
     
    404390    }
    405391}
     392// Titre        Private Methods
     393//++
     394template<class T>
     395void LocalMap<T>::InitNul()
     396//
     397//    set some attributes to zero
     398//--
     399{
     400  originFlag_= false;
     401  extensFlag_= false;
     402  cos_angle_= 1.0;
     403  sin_angle_= 0.0;
     404  pixels_.Reset();
     405}
    406406
    407407//++
     
    409409void LocalMap<T>::Getij(int k,int& i,int& j) const
    410410//
     411//    Return 2 indices corresponding to the pixel number k
    411412//--
    412413{
     
    420421void  LocalMap<T>::ReferenceToUser(double& theta,double& phi) const
    421422//
    422 // --     
     423//    Transform a pair of coordinates (theta, phi) given in
     424//    reference coordinates into map coordinates
     425//--     
    423426{
    424427  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     
    457460void  LocalMap<T>::UserToReference(double& theta,double& phi) const
    458461//
    459 // --     
     462//    Transform a pair of coordinates (theta, phi) given in
     463//    map coordinates into reference coordinates
     464//--     
    460465{
    461466  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     
    498503void LocalMap<T>::PixProjToAngle(double x,double y,double& theta,double& phi) const
    499504//
    500 // (x,y) representent les coordonnees en unites de pixels d'un point DANS LE PLAN DE REFERENCE.
    501 // On recupere (theta,phi) par rapport au repere "absolu" theta=pi/2 et phi=0.
     505// 
     506//    Given coordinates in pixel units in the REFERENCE PLANE, return
     507//    (theta, phi) in "absolute" referential theta=pi/2 ,phi=0.   
    502508//--
    503509{
     
    511517void LocalMap<T>::AngleProjToPix(double theta,double phi,double& x,double& y) const
    512518//
    513 // (theta,phi) par rapport au repere "absolu" theta=pi/2,phi=0. On recupere
    514 // (i,j)  DANS LE PLAN DE REFERENCE.
     519//    Given coordinates  (theta, phi) in "absolute" referential
     520//    theta=pi/2 ,phi=0  return pixel indices  (i,j) in the REFERENCE PLANE.
    515521//--
    516522{
     
    542548  os << endl;
    543549}
     550//++
     551// Titre        class FIO_LocalMap
     552//    Delegated objects for persitance management
     553//--
    544554
    545555//*******************************************************************
     
    548558//*******************************************************************
    549559
     560//++
    550561template <class T>
    551562FIO_LocalMap<T>::FIO_LocalMap()
     563//
     564//--
    552565{
    553566  dobj= new LocalMap<T>;
    554567  ownobj= true;
    555568}
    556 
     569//++
    557570template <class T>
    558571FIO_LocalMap<T>::FIO_LocalMap(string const& filename)
     572//
     573//--
    559574{
    560575  dobj= new LocalMap<T>;
     
    563578}
    564579
     580//++
    565581template <class T>
    566582FIO_LocalMap<T>::FIO_LocalMap(const LocalMap<T>& obj)
     583//
     584//--
    567585{
    568586  dobj= new LocalMap<T>(obj);
     
    577595}
    578596
     597//++
    579598template <class T>
    580599FIO_LocalMap<T>::~FIO_LocalMap()
     600//
     601//--
    581602{
    582603  if (ownobj && dobj) delete dobj;
    583604}
    584 
     605//++
    585606template <class T>
    586607AnyDataObj* FIO_LocalMap<T>::DataObj()
     608//
     609//--
    587610{
    588611  return(dobj);
    589612}
    590613
     614//++
    591615template <class T>
    592616void FIO_LocalMap<T>::ReadSelf(PInPersist& is)
    593 {
    594   cout << " FIO_LocalMap:: ReadSelf " << endl;
     617//
     618//--
     619{
    595620
    596621  if(dobj == NULL)
     
    598623      dobj= new LocalMap<T>;
    599624    }
    600 
    601 // Let's Read the SphereCoordSys object  -- ATTENTIOn - $CHECK$
    602   SphereCoordSys* cs = dynamic_cast<SphereCoordSys*>(is.ReadObject());
    603   dobj->SetCoordSys(cs);
    604625
    605626  // Pour savoir s'il y avait un DVList Info associe
     
    652673}
    653674
     675//++
    654676template <class T>
    655677void FIO_LocalMap<T>::WriteSelf(POutPersist& os) const
    656 {
    657   cout << " FIO_LocalMap:: WriteSelf " << endl;
    658 
     678//
     679//--
     680{
    659681  if(dobj == NULL)
    660682    {
    661       cout << " WriteSelf:: dobj= null " << endl;
     683      cout << " FIO_LocalMap::WriteSelf:: dobj= null " << endl;
    662684      return;
    663685    }
    664686
    665 // Let's write the SphereCoordSys object
    666   dobj->GetCoordSys()->Write(os);
    667  
    668687  char strg[256];
    669688  int nSzX= dobj->Size_x();
  • trunk/SophyaLib/Samba/localmap.h

    r518 r568  
    1010#include "ppersist.h"
    1111
    12 // A local map of a region of the sky, in cartesian coordinates.
    13 // It has an origin in (theta0, phi0), mapped to pixel(x0, y0)
    14 //   (x0, y0 might be outside of this local map)
    15 // default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2)
     12//! A local map of a region of the sky, in cartesian coordinates.
     13/*! A local map has an origin in (theta0, phi0), mapped to pixel(x0, y0)
     14   (x0, y0 might be outside of this local map)
     15 default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2)
     16    A local map is a 2 dimensional array, with i as column index and j
     17    as row index. The map is supposed to lie on a plan tangent to the
     18    celestial sphere in a point whose coordinates are (x0,y0) on the local
     19   map and (theta0, phi0) on the sphere. The range of the map is defined
     20    by two values of angles covered respectively by all the pixels in
     21    x direction and all the pixels in y direction (SetSize()).
     22
     23    A "reference plane" is considered : this plane is tangent to the
     24    celestial sphere in a point with angles theta=Pi/2 and phi=0. This
     25    point is the origine of coordinates is of the reference plane. The
     26    x-axis is the tangent parallel to the equatorial line and oriented
     27    toward the increasing phi's ; the y-axis is parallel to the meridian
     28    line and oriented toward the north pole.
     29   
     30    Internally, a map is first defined within this reference plane and
     31    tranported until the point (theta0, phi0) in such a way that both
     32    axes are kept parallel to meridian and parallel lines of the sphere.
     33    The user can define its own map with axes rotated with respect to
     34    reference axes (this rotation is characterized by angle between
     35    the local parallel line and the wanted x-axis-- see method
     36    SetOrigin(...))
     37*/
    1638//
    1739//    la carte est consideree comme un tableau a deux indices i et j, i etant
     
    5779
    5880/* return/set the number of pixels */
     81/*!    Return number of pixels */
    5982virtual int NbPixels() const;
    6083inline void setNbPixels(int n) {nPix_= n;}
    6184 
    6285/* return the value of pixel number k */
     86/*!    Return value of pixel with index k */
    6387virtual T& PixVal(int k);
     88/*!   const version of previous method */
    6489virtual T const& PixVal(int k) const;
    6590
     
    6792virtual bool ContainsSph(double theta, double phi) const;
    6893/* return the index of pixel at (theta,phi) */
     94/*!    Return index of the pixel with spherical coordinates (theta,phi) */
    6995virtual int PixIndexSph(double theta,double phi) const;
    7096   
    7197/* return the spherical coordinates of center of pixel number k */
     98/*!    Return (theta, phi) coordinates of pixel with index k */
    7299virtual void PixThetaPhi(int k,double& theta,double& phi) const;
    73100
    74101/* return the Pixel Solid angle  (steradians) */
     102/*!    Pixel Solid angle  (steradians)
     103
     104    All the pixels have not necessarly the same size in (theta, phi)
     105    because of the projection scheme which is not yet fixed.
     106*/ 
    75107virtual double PixSolAngle(int k) const;
    76108
    77109// ---------- Specific methods ------------------------------
    78110
     111/*!    Resize storage area for pixels */
    79112void ReSize(int nx, int ny);
    80113
     
    82115 
    83116/* Origin (with angle between x axis and phi axis, in degrees)  x0,y0  the default: middle of map*/
     117/*!    set the referential of the map (angles in degrees)
     118
     119    (default x0=siz_x/2,  y0=siz_y/2)
     120*/
    84121virtual void SetOrigin(double theta=90.,double phi=0.,double angle=0.);
     122/*!    set the referential of the map (angles in degrees) */
    85123virtual void SetOrigin(double theta,double phi,int x0,int y0,double angle=0.);
    86124
    87125/* Pixel size (degres) */
     126/*!    angle range of tthe map (angles in degrees) */
    88127virtual void SetSize(double angleX,double angleY);
    89128
     
    91130inline bool LocalMap_isDone() const {return(originFlag_ && extensFlag_);};
    92131
    93 /* Projection to/from spherical map */
     132/*! Projection to a spherical map */
    94133virtual void Project(SphericalMap<T>& sphere) const;
    95134 
     
    120159
    121160void InitNul();
     161/*!    Return 2 indices corresponding to the pixel number k */
    122162void Getij(int k,int& i,int& j) const;
     163/*!    Transform a pair of coordinates (theta, phi) given in
     164    reference coordinates into map coordinates
     165*/
    123166void ReferenceToUser(double& theta,double& phi) const;
     167/*!    Transform a pair of coordinates (theta, phi) given in
     168   map coordinates into reference coordinates
     169*/
    124170void UserToReference(double& theta,double& phi) const;
     171/*!   Given coordinates in pixel units in the REFERENCE PLANE, return
     172    (theta, phi) in "absolute" referential theta=pi/2 ,phi=0.   
     173*/
    125174void PixProjToAngle(double x,double y,double& theta,double& phi) const;
     175/*!    Given coordinates  (theta, phi) in "absolute" referential
     176    theta=pi/2 ,phi=0  return pixel indices  (i,j) in the REFERENCE PLANE.
     177*/
    126178void AngleProjToPix(double theta,double phi,double& x,double& y) const;
    127179
     
    148200
    149201// ------------- Classe pour la gestion de persistance --
     202//!    Delegated objects for persitance management
    150203template <class T>
    151204class FIO_LocalMap : public PPersist 
     
    161214virtual AnyDataObj* DataObj();
    162215inline operator LocalMap<T>() { return(*dobj); }
    163 inline LocalMap<T> getObj() { return(*dobj); }
     216//inline LocalMap<T> getObj() { return(*dobj); }
    164217
    165218protected :
  • trunk/SophyaLib/Samba/longlat.cc

    r262 r568  
    11#include "longlat.h"
    2 
     2//++
     3// Class        LongLat
     4//
     5// include      longlat.h
     6//
     7//    translation from  coordinates (longitude, latitude)
     8//    to theta,phi
     9//
     10//    longitude=phi
     11//
     12//    latitude=Pi/2-theta
     13//
     14//--
     15//++
     16// Titre        Constructors
     17//--
     18//++
    319LongLat::LongLat()
     20//
     21//--
    422{
    523  _lon=0.;
    624  _lat=0.;
    725}
    8 
     26//++
    927LongLat::LongLat(double longitude, double latitude)
     28//
     29//--
    1030{
    1131  _lon=mod(longitude,pi2);
     
    1333  else _lat=mod(latitude+pi_over_2,M_PI)-pi_over_2; // dans [-Pi/2,Pi/2]
    1434}
    15 
     35//++
    1636LongLat::LongLat(double x, double y, double z)
     37//
     38//--
    1739{
    1840  double norm=sqrt(x*x+y*y+z*z);
     
    3254  _lat=pi_over_2-theta;
    3355}
    34 
     56//++
     57// Titre        Public Methods
     58//--
     59//++
    3560void LongLat::Set(double longitude, double latitude)
     61//
     62//--
    3663{
    3764  _lon=mod(longitude,pi2);
     
    3966  else _lat=mod(latitude+pi_over_2,M_PI)-pi_over_2; // dans [-Pi/2,Pi/2]
    4067}
    41 
     68//++
    4269void LongLat::Print(ostream& os) const
     70//
     71//--
    4372{
    4473  os << "LongLat : longitude = " << _lon << " phi   = " << this->Phi() << endl;
    4574  os << "LongLat : latitude    = " << _lat << " theta = " << this->Theta() << endl;
    4675}
     76//++
     77//
     78//  double Longitude() const
     79//  double Phi() const
     80//  double Latitude()
     81//  double Theta() const
     82//--
  • trunk/SophyaLib/Samba/mlobe.cc

    r470 r568  
    44#include "timing.h"
    55// #include "nbrandom.h"
    6 
    7 /* --Methode-- */
     6//++
     7// Class        MainLobe
     8//
     9// include      mlobe.h sphericalmap.h unitvector.h math.h
     10//
     11//    Class for computation of main lobe.
     12//
     13//     The lobe values are computed in pixels laying on "nc" slices
     14//     with hexagonal  pavement around theta=0 , phi=0. The lobe is
     15//     gaussian with sigma="sig". The slices are built every
     16//     "dels"*sigma.
     17//
     18//--
     19//++
     20// Titre        Constructor
     21//--
     22/* --Methode-- */
     23//++
    824MainLobe::MainLobe(float sig, float dels, int nc)
     25//
     26//--
    927{
    1028if (sig < 1.e-9)  sig = M_PI/100.;   // Sigma du lobe gaussien (radians)
     
    5876
    5977
    60 /* --Methode-- */
     78//++
     79// Titre        Constructor
     80//--
     81/* --Methode-- */
     82//++
    6183MainLobe::~MainLobe()
     84//
     85//--
    6286{
    6387delete mT0;
     
    7094delete mVal;
    7195}
    72 
    73 /* --Methode-- */
     96//++
     97// Titre        Public Methods
     98//--
     99//++
     100//
     101// inline int      NPix()
     102//    Return the total number of pixels of the lobe           
     103// inline float    Sigma()             
     104// inline double   Integral()           
     105//--
     106/* --Methode-- */
     107//++
    74108void MainLobe::SetDirection(float teta, float phi)
     109//
     110//    orientate  the lobe  toward the direction  (theta, phi)
     111//--
    75112{
    76113int k;
     
    124161
    125162/* --Methode-- */
     163//++
    126164double MainLobe::Value(int kpx, float& teta, float& phi)
     165//
     166//    return the value of the lobe as also the (theta, phi) of the
     167//    pixel "kpx" 
     168//--
    127169{
    128170if ( (kpx < 0) || (kpx >= mNpix) ) { teta = phi = 0.; return(0.); }
     
    133175
    134176/* --Methode-- */
     177//++
    135178double MainLobe::Convol(SphericalMap<double>& sph)
     179//
     180//    return the value of the lobe convolved with the sky (sphere) "sph"
     181//--
    136182{
    137183double ret=0.;
     
    146192}
    147193
    148 /* --Methode-- */
     194//++
     195//
     196// inline void     Print() 
     197//--
     198
     199//++
     200// Titre        Operators
     201//--
     202
     203/* --Methode-- */
     204//++
    149205ostream& operator << (ostream& s, MainLobe const& lob)
     206//
     207//--
    150208{
    151209s << "MainLobe_Info() : Sigma= " << lob.mSigma << " Dels= " << lob.mDels << " NC= "
  • trunk/SophyaLib/Samba/pixelmap.h

    r525 r568  
    88#include <iostream.h>
    99
    10 // General map of pixels on part of sphere or whole sphere
    11 // Class hierarchy :
    12 //   PixelMap
    13 //      SphericalMap
    14 //         SphereThetaPhi
    15 //         SphereGorski
    16 //         SphereIco
    17 //      LocalMap
    18 
     10//! General map of pixels on part of sphere or whole sphere
     11/*! Class hierarchy :
     12\verbatim
     13   PixelMap
     14     SphericalMap
     15         SphereThetaPhi
     16         SphereGorski
     17         SphereIco
     18      LocalMap
     19\endverbatim
     20*/
    1921template<class T>
    2022class PixelMap 
     
    3335inline SphereCoordSys* GetCoordSys() const { return(cs_); }
    3436
    35 // Number of pixels
     37/*! Number of pixels */
    3638virtual int NbPixels() const=0;
    3739   
    38 // Value of pixel number k
     40/*! Value of pixel number k */
    3941virtual T& PixVal(int k)=0;
    4042virtual T const& PixVal(int k) const=0;
     
    4446virtual bool Contains(const SpherePosition& spos) const;
    4547
    46 // Index of pixel at (theta,phi)
     48/*! Index of pixel at (theta,phi) */
    4749virtual int PixIndexSph(double theta, double phi) const=0;
    4850// Index of pixel at a sky-position
    4951virtual int PixIndex(const SpherePosition& spos);
    5052
    51 
    52 // Value of pixel number at (theta,phi)
     53/*! Value of pixel number at (theta,phi) */
    5354virtual T& PixValSph(double theta, double phi)
    5455                           {return PixVal(PixIndexSph(theta,phi));}
     
    5657                           {return PixVal(PixIndexSph(theta,phi));}
    5758
    58 // Spherical coordinates of center of pixel number k
     59/*! Spherical coordinates of center of pixel number k */
    5960virtual void PixThetaPhi(int k, double& theta, double& phi) const=0;
    6061
    61 // provides a integer characterizing the pixelization refinement
    62 // (depending of the type of the map)             
     62/*! provides a integer characterizing the pixelization refinement
     63 (depending of the type of the map)
     64*/             
    6365virtual int SizeIndex() const=0;
    6466virtual char* TypeOfMap() const =0;
    6567
    66 // Pixel  (steradians)
     68/*! Pixel  (steradians) */
    6769virtual double PixSolAngle(int k) const =0;
    6870
    69 // Overloading of () to access pixel number k.
     71/*! Overloading of () to access pixel number k. */
    7072inline T& operator()(int k) {return(PixVal(k));}
    7173inline T const& operator()(int k) const {return(PixVal(k));}
Note: See TracChangeset for help on using the changeset viewer.