Changeset 3165 in Sophya for trunk/Cosmo


Ignore:
Timestamp:
Feb 1, 2007, 3:15:16 PM (19 years ago)
Author:
ansari
Message:

petites ameliorations + reglage parametres -> version +/- utilisable , Reza 01/02/2007

Location:
trunk/Cosmo/RadioBeam
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/RadioBeam/brsrc.h

    r3160 r3165  
    2727  // Generation d'une liste de source aleatoirement reparties en freq,angX,angY
    2828  // @ lambda ~ 0.5 m et D = 50 m , limite de diffraction ~ pi/300
    29   BRSourceGen(int ns, double maxangXrad=M_PI/3., double maxangYrad=M_PI/500.,
     29  BRSourceGen(int ns, double maxangXrad=M_PI/3., double maxangYrad=M_PI/60.,
    3030              double minfreq=0.05, double minamp=0.3, double maxamp=1.5);
    3131
  • trunk/Cosmo/RadioBeam/recbeam.pic

    r3164 r3165  
    1 ### Script piapp pour faire tourner le programme de simulation
     1### Script piapp pour afficher les resultats du programme
    22### de reconstruction de beam par la technique de double FFT
    33###  Reza , Sep 2006
    4 #  Le code (2 classes) se trouve dans mbeamcyl.h mbeamcyl.cc
    5 #  et une classe auxiliaire brsrc.h brsrc.cc
    6 #  Classe  MultiBeamCyl et la classe utilitaire BRSourceGen
    7 # --------------------
     4# ------------------------------------------
     5
     6
    87# 0/ Verification, modif des parametres
    9 #  Modifier si besoin le code dans trecbeam.cc qui instancie
    10 #  les classes (MultiBeamCyl en particulier) avec le parametres
    11 #  necessaires (nb de recepteurs, nb d'echantillons ...)
    12 #  Avant de faire la simulation et la reconstruction de beam
    13 
     8#  Modifier si besoin le code dans treccyl.cc et faire ensuite make
     9csh> make
     10# Le programme se trouve dans Objs/treccyl
    1411# 1/ Faire tourner le programme - reconstruction plan X-freq (en dehors de piapp)
    1512Objs/treccyl X onecyl.ppf
     
    3532
    3633# 3/ Faire tourner le programme - reconstruction cube X-Y-freq (en dehors de piapp)
    37 Objs/treccyl XY ncyl.ppf
     34Objs/treccyl XY12 n12cyl.ppf
     35OU
     36Objs/treccyl XY5 n5cyl.ppf
    3837
    3938# 4/ Affichage resultats
    4039delobjs *
    41 openppf ncyl.ppf
     40openppf n12cyl.ppf
     41OU
     42openppf n5cyl.ppf
     43
    4244listobjs
    4345
     46## Pour afficher les plans reconstruits (angX-freq) sur les cylindres 0 , 3 avec les sources
     47## ATTENTION, si on change les parametres, la conversion angle->num pixel doit etre adapte
    4448disp recsrcplane0 'lut=sqrt,0.,0.1 invy grey32 win'
    4549plot2dw ntsrc sin(angrad)*freq*0.25*256+128 freqred*512*2 amp 1 'nsta same red marker=circle,7'
     
    4751plot2dw ntsrc sin(angrad)*freq*0.25*256+128 freqred*512*2 amp 1 'nsta same red marker=circle,7'
    4852
     53## Pour afficher trois plans (angX-angY) avec les sources, autour des trois frequences des sources
    4954zone 1 3
    50 disp recXYf0 'zoomx2 grey32 lut=sqrt,0.,1'
    51 plot2dw ntsrc sin(angrad)*freq*0.25*256+128 sin(angyrad)*freq*0.25*21+10  amp fabs(freqred-0.1)<0.01 'nsta same red marker=circle,7'
    52 disp recXYf1 'zoomx2 grey32 lut=sqrt,0.,1'
    53 disp recXYf2 'zoomx2 grey32 lut=sqrt,0.,1'
     55disp recXYf0 'zoomx2 invy grey32 lut=sqrt,0.,1.5'
     56plot2dw ntsrc sin(angrad)*freq*0.25*256+128 600.*angyrad/M_PI+10  amp fabs(freqred-0.1)<0.01 'nsta same red marker=circle,7'
     57disp recXYf1 'zoomx2 invy grey32 lut=sqrt,0.,1.5'
     58plot2dw ntsrc sin(angrad)*freq*0.25*256+128 600.*angyrad/M_PI+10  amp fabs(freqred-0.27)<0.01 'nsta same red marker=circle,7'
     59disp recXYf2 'zoomx2 invy grey32 lut=sqrt,0.,1.5'
     60plot2dw ntsrc sin(angrad)*freq*0.25*256+128 600.*angyrad/M_PI+10  amp fabs(freqred-0.38)<0.01 'nsta same red marker=circle,7'
    5461
    55 
    56 
     62## On peut aussi extraire une coupe angX-angY de la boite 3D reconstruit
    5763objaoper recsrcbox slicexy 101
    5864set cobj /home/slicexy_101
  • trunk/Cosmo/RadioBeam/treccyl.cc

    r3164 r3165  
    2121#include "mbeamcyl.h"
    2222
     23/*
     24   Projet BAORadio / HSHS
     25   Programme de simulation pour reconstruction de lobe radio.
     26   programme principal de test
     27
     28   R. Ansari - LAL      Jan 2007
     29
     30*/
    2331
    2432// Declaration des fonctions de ce fichier
    2533static int test1cyl(string& ppfname);
    26 static int testmulticyl(string& ppfname);
     34static int testmulticyl(string& ppfname, int ncyl=5);
    2735
    2836//-----------------------------------------------------------
     
    3341static double freq0 = 2.;  // frequence de base
    3442static double da = 0.25;     // pas des antennes le long du cylindre
     43// ATTENTION : les parametres suivants sont relies a MR/da
     44static double maxangX = M_PI/3.; // angle max en X ( +/- )
     45static double maxangY = M_PI/60.; // angle max en Y ( +/- )
     46static int nsrcmax = 50;  // Nb total de sources - en un plan
     47
    3548static double snoise = 1.0;  // sigma du bruit
    3649static double tjit = 0.05;   // sigma du jitter en temps
     
    5669string ppfname = "treccyl.ppf";
    5770int act = 1;
     71int ncyl = 5;
    5872if (narg < 3) {
    5973  cout << "Usage: treccyl act ppfname [PrtLev=0] \n"
    60        << "  act= X ou XY  , ppfname=  treccyl.ppf par defaut" << endl;
     74       << " -act= X ou XY5 ou XY12  (5 ou 12 cylindres) \n"
     75       << " -ppfname=  treccyl.ppf par defaut" << endl;
    6176  return 1;
    6277}
    63 if (strcmp(arg[1],"XY") == 0) act = 2;
     78if (strcmp(arg[1],"XY5") == 0) { act = 2;  ncyl = 5; }
     79else if (strcmp(arg[1],"XY12") == 0) { act = 2;  ncyl = 12; }
    6480if (narg > 2)  ppfname = arg[2];
    6581if (narg > 3)  prtlevel = atoi(arg[3]);
    6682
    6783int rc = 0;
     84cout << ">>>> treccyl : " << arg[1] << " PPFName=" << ppfname << endl;
    6885try {
    69   if (act == 2) rc = testmulticyl(ppfname);
     86  if (act == 2) rc = testmulticyl(ppfname, ncyl);
    7087  else rc = test1cyl(ppfname);
    71   cout << "treccy/Info - FIN  " << endl;
    7288}
    7389  catch (PThrowable& exc) {
     
    85101  }
    86102
    87  return rc;
     103cout << ">>>> treccyl ------- FIN ----------- Rc=" << rc << endl;
     104return rc;
    88105}
    89106
     
    95112  // BRSourceGen sg;
    96113  int nsrc = 60;
    97   BRSourceGen sg(nsrc);
     114  BRSourceGen sg(nsrcmax, maxangX, 0.);
    98115  //  sg.WritePPF(string("brsrc1.ppf"));
    99116
     
    119136  cout << "treccy/test1cyl:  signal vectors OK " << endl;
    120137  PrtTim("test1cyl:[1] ");
     138 
     139  cout << "--- treccy/test1cyl: Saving to PPF file " << ppfname << endl;
    121140
    122141  POutPersist po(ppfname);
     
    145164
    146165//--- Fonction de test : reconstruction cube AngX-AngY-Frequence (multi-cylindre)
    147 int testmulticyl(string& ppfname)
     166int testmulticyl(string& ppfname, int ncyl)
    148167{
     168
     169  if ((ncyl != 5) && (ncyl != 12)) ncyl = 5;
    149170
    150171  // BRSourceGen sg;
     
    156177 
    157178 
    158   cout << "treccy/testmulticyl: BRSourceGen sg([frq=0.1,0.27,0.38], " << nsf << ")" << endl;
    159   BRSourceGen sg(frq, nsf, M_PI/3, M_PI/60);
    160   /*
     179  cout << "testmulticyl: BRSourceGen sg([frq=0.1,0.27,0.38], " << nsf
     180       << "," << maxangX << "," << maxangY << ")" << endl;
     181  BRSourceGen sg(frq, nsf, maxangX, maxangY);
     182 
    161183  int is;
    162   for(is=0; is<nsf; is++)     sg.angY(is) = 0.;
    163   for(is=nsf; is<2*nsf; is++)     sg.angY(is) = M_PI/30.;
    164   for(is=2*nsf; is<3*nsf; is++)     sg.angY(is) = -M_PI/30.;
    165   */
     184  double fay[6] = {-0.7,-0.5,0.,0.,0.5,0.7};
     185  for(is=0; is<3*nsf; is++) {
     186    int ism = is%nsf;
     187    sg.angX(is) = maxangX*(ism-2.5)/3.;
     188    sg.angY(is) = maxangY*fay[ism];
     189  }
    166190  // sg.WritePPF(string("brsrcm.ppf"));
    167191  // BRSourceGen  sg(string("brsrcm.ppf"));
    168   cout << "=== testmulticyl: BRSourceGen NbSrc= " << sg.NbSources()
    169        << " NbRecep=" << MR << " NSamples=" << NE << endl;
     192  cout << "=== testmulticyl: NbSrc= " << sg.NbSources()
     193       << " NbRecep=" << MR << " NSamples=" << NE << " NCyl=" << ncyl << endl;
    170194  if (prtlevel > 1)  sg.Print(cout);
    171195 
     
    179203  mcyl.SetGains(gmean, gsig, nantgz);
    180204
    181   /*
    182   for(int kkc=0; kkc<12; kkc++)
    183     mcyl.AddCylinder(5.*kkc);
    184   */
    185  
    186   mcyl.AddCylinder(0.);
    187   mcyl.AddCylinder(5.);
    188   mcyl.AddCylinder(15.);
    189   mcyl.AddCylinder(35.);
    190   mcyl.AddCylinder(65.);
    191  
     205  if (ncyl == 12) {
     206    cout << " --- testmulticyl/ NCyl= " << ncyl << " posY=0 ... " << (ncyl-1)*5.
     207         << " (EqualSpacing)" << endl;
     208    for(int kkc=0; kkc<12; kkc++) {
     209      cout << "..." << kkc << " - mcyl.AddCylinder(posY= " << 5.*kkc << " )" << endl;
     210      mcyl.AddCylinder(5.*kkc);
     211    }
     212  }
     213  else {
     214    cout << " --- testmulticyl/ NCyl= " << ncyl << " posY=0 ... 55 (IrregularSpacing)" << endl;
     215    double posyc[5] = {0.,5.,15.,35.,55.};
     216    for(int kkc=0; kkc<5; kkc++) {
     217      cout << "..." << kkc << " - mcyl.AddCylinder(posY= " << posyc[kkc] << " )" << endl;
     218      mcyl.AddCylinder(posyc[kkc]);
     219    }
     220  }
     221
    192222  mcyl.SetSources(sg);
    193223 
     
    195225
    196226  //  mcyl.ReconstructCylinderPlaneS(true);
    197   mcyl.ReconstructSourceBox(10, M_PI/600.);
    198 
     227  mcyl.ReconstructSourceBox(10, maxangY/10.);
     228
     229  cout << "--- treccy/testmulticyl: Saving to PPF file " << ppfname << endl;
    199230  POutPersist po(ppfname);
    200231
Note: See TracChangeset for help on using the changeset viewer.