Changeset 3688 in Sophya


Ignore:
Timestamp:
Nov 29, 2009, 12:13:54 AM (16 years ago)
Author:
ansari
Message:

Introduction de la classe FitsCubeWriter - Reza 28/11/2009

Location:
trunk/AddOn/TAcq
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/branap.cc

    r3687 r3688  
    1414  outpath_="./";
    1515  nmean_=nmean;
     16  nbloc_=1;
    1617  imin_=imax_=0;
    1718  istep_=1;
     19  freqmin_=freqmax_=0;
     20  nbinfreq_=1; 
    1821  paqsize_=16424;
    1922  nzones_=nzon;
    2023  npaqinzone_=npaqz;
     24  prtlevel_=0;
    2125}
    2226
     
    3034  int ka=1;
    3135  while (ka<(narg-1)) {
     36    cout << " *DBG ka=" << ka << " narg=" << narg << " arg[ka]=" << arg[ka] << endl;
    3237    if (strcmp(arg[ka],"-act")==0) {
    3338      action_=arg[ka+1];
     
    3641    else if (strcmp(arg[ka],"-out")==0) {
    3742      outpath_=arg[ka+1];
     43      size_t lenp=outpath_.size();
     44      if ((lenp>0)&&(outpath_[lenp-1]!='/'))  outpath_+='/';
    3845      ka+=2;
    3946    }
    4047    else if (strcmp(arg[ka],"-nmean")==0) {
    4148      nmean_=atoi(arg[ka+1]);
     49      ka+=2;
     50    }
     51    else if (strcmp(arg[ka],"-nbloc")==0) {
     52      nbloc_=atoi(arg[ka+1]);
     53      ka+=2;
     54    }
     55    else if (strcmp(arg[ka],"-freq")==0) {
     56      sscanf(arg[ka+1],"%d,%d,%d",&freqmin_,&freqmax_,&nbinfreq_); 
    4257      ka+=2;
    4358    }
     
    4964      ka+=2;
    5065    }
     66    else if (strcmp(arg[ka],"-prtlev")==0) {
     67      prtlevel_=atoi(arg[ka+1]);
     68      ka+=2;
     69    }
    5170    else if (strcmp(arg[ka],"-in")==0) {
    5271      if ((narg-ka)<4)  {
     
    5574      }
    5675      sscanf(arg[ka+1],"%d,%d,%d",&imin_,&imax_,&istep_);  ka+=2;
    57       while(ka<(narg-3)) {
     76      while(ka<(narg-1)) {
    5877        string inpath = arg[ka];
    59         if (inpath.size()<1)  inpath="./";
    60         if (inpath[inpath.size()-1]!='/')  inpath[inpath.size()-1]='/';
     78        size_t lenp=inpath.size();
     79        if (lenp<1)  inpath="./";
     80        if ((lenp>0)&&(inpath[lenp-1]!='/'))  inpath+='/';
    6181        vector<string> fiblist;
    6282        string sa1 = arg[ka+1];
     
    7191      okarg=true;
    7292    }
     93    else ka++;
    7394  }
     95
    7496  if (!okarg) {
    7597    cout << " BRAnaParam::DecodeArgs() / Argument error " << endl;
     
    84106  cout << " --- BRAnaParam : Reading/Processing BAORadio FITS files parameters " << endl;
    85107  cout << " Usage:  prgname [-act ACT] [-out OutPath] [-nmean NMean] [-zones NZones,nPaqinZone] \n"
     108       << "                 [-nbloc NBloc] [-freq NumFreqMin,NumFreqMax,NBinFreq] \n"
    86109       << "         -in Imin,Imax,Istep InPath FiberList [InPath2 FiberList2 InPath3 FiberList3 ...] \n" << endl;
    87110  if (fgshort) {
     
    89112    return 5;
    90113  }
    91   cout << " -act Action: Not YET used  \n"
     114  cout << " -act Action: cube3d or vis   \n"
    92115       << " -out OutPath: Output directory name \n"
    93116       << " -nmean NMean: Number of packet used for spectra/visibility computation \n"
     117       << " -nbloc NBloc: Number of MemMgr blocs in output file\n"
    94118       << " -zones NZones,NbPaqinZone : Number of Zones and number of paquets in one zone \n"
     119       << " -freq NumFreqMin,NumFreqMax,NBinFreq : Frequency zone and number of bins \n"
    95120       << " -in : input files/directory definition : \n"
    96121       << "       Imin,Imax,Istep: fits files signalII.fits Imin<=II<=Imax Istep=increment \n"
     
    117142  cout << " IMin= " << imin_ << " IMax= " << imax_ << " IStep= " << istep_ << endl;
    118143  cout << " OutPath= " << outpath_ << endl;
    119   cout << "  NMean=" << nmean_ << " PaqSize=" << paqsize_ << "  -  NZones=" << nzones_
    120        << " NPaqZone=" << npaqinzone_ << endl;
     144  cout << " Action=" << action_ << "  NMean=" << nmean_ << " NBloc=" << nbloc_ << endl;
     145  cout << " FreqMin= " << freqmin_ << " FreqMax= " << freqmax_ << " NBinFreq= " << nbinfreq_ << endl;
     146  cout << " PaqSize=" << paqsize_ << "  -  NZones=" << nzones_ << " NPaqZone=" << npaqinzone_
     147       << " PrtLevel=" << prtlevel_ << endl;
    121148  return os;
    122149}
  • trunk/AddOn/TAcq/branap.h

    r3687 r3688  
    2929  string outpath_;
    3030  uint_4 nmean_;
     31  uint_4 nbloc_;
    3132  uint_4 imin_, imax_, istep_;
     33  uint_4 freqmin_, freqmax_, nbinfreq_;
    3234  uint_4 paqsize_;
    3335  uint_4 nzones_, npaqinzone_;
     36  int prtlevel_;
    3437};
    3538
  • trunk/AddOn/TAcq/brfitsrd.h

    r3683 r3688  
    1717using namespace std;
    1818
     19//  ATTENTION cette definition (MAXANAFIB) se trouve dans plusieurs fichiers
    1920#ifndef MAXANAFIB
    2021#define MAXANAFIB  32
  • trunk/AddOn/TAcq/brproc.cc

    r3686 r3688  
    3232/* --Methode-- */
    3333BRVisibilityCalculator::BRVisibilityCalculator(RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean,
    34                        uint_4 freq1, uint_4 freq2, uint_4 nbfreq)
     34                                               uint_4 freq1, uint_4 freq2, uint_4 nbfreq)
    3535  : BRBaseProcessor(memgr), outpath_(outpath), nmean_(nmean), numfreq1_(freq1), numfreq2_(freq2), nbinfreq_(nbfreq)
    3636{
  • trunk/AddOn/TAcq/makefile

    r3687 r3688  
    5656##   --------------
    5757vismfib : $(EXE)vismfib
    58         echo '---mcrd made'
    59 
    60 $(EXE)vismfib : $(OBJ)vismfib.o  $(OBJ)branap.o $(OBJ)brparam.o $(OBJ)racqumem.o $(OBJ)brfitsrd.o $(OBJ)brproc.o $(OBJ)brbaseproc.o $(OBJ)racquproc.o $(OBJ)brpaqu.o \
     58        echo '---vismfib made'
     59
     60$(EXE)vismfib : $(OBJ)vismfib.o  $(OBJ)branap.o $(OBJ)brdiskw.o $(OBJ)brparam.o $(OBJ)racqumem.o $(OBJ)brfitsrd.o $(OBJ)brproc.o $(OBJ)brbaseproc.o $(OBJ)racquproc.o $(OBJ)brpaqu.o \
    6161             $(OBJ)racqurw.o $(OBJ)pciewrap.o $(OBJ)minifits.o
    62         $(CXXLINK) -o $(EXE)vismfib $(OBJ)vismfib.o $(OBJ)branap.o $(OBJ)brparam.o $(OBJ)racqumem.o $(OBJ)brfitsrd.o $(OBJ)brproc.o $(OBJ)brbaseproc.o $(OBJ)racquproc.o \
     62        $(CXXLINK) -o $(EXE)vismfib $(OBJ)vismfib.o $(OBJ)branap.o $(OBJ)brdiskw.o $(OBJ)brparam.o $(OBJ)racqumem.o $(OBJ)brfitsrd.o $(OBJ)brproc.o $(OBJ)brbaseproc.o $(OBJ)racquproc.o \
    6363                      $(OBJ)brpaqu.o $(OBJ)racqurw.o $(OBJ)pciewrap.o $(OBJ)minifits.o $(SOPHYAALLSLBLIST)
    6464
     
    6868$(OBJ)branap.o : branap.cc branap.h
    6969        $(CXXCOMPILE) -c  -o $(OBJ)branap.o branap.cc
     70
     71$(OBJ)brdiskw.o : brdiskw.cc brdiskw.h
     72        $(CXXCOMPILE) -c  -o $(OBJ)brdiskw.o brdiskw.cc
    7073
    7174##   --------------
  • trunk/AddOn/TAcq/minifits.cc

    r3684 r3688  
    220220  buff[strlen(buff)] = ' ';
    221221  buff = header+320;
    222   sprintf(buff, "NAXIS2  = %20ld / nb of rows = NumberOfPaquets", (long)nax2);
     222  if (fgnax3)
     223    sprintf(buff, "NAXIS2  = %20ld / Number of fibers ", (long)nax2);
     224  else
     225    sprintf(buff, "NAXIS2  = %20ld / nb of rows = NumberOfPaquets", (long)nax2);
    223226  buff[strlen(buff)] = ' ';
    224227  buff = header+400;
    225228  if (fgnax3)
    226     sprintf(buff, "NAXIS3  = %20ld / nb of rows = NumberOfFibers", (long)nax3);
     229    sprintf(buff, "NAXIS3  = %20ld / Number of paquets ", (long)nax3);
    227230  else
    228231    strcpy(buff,"COMMENT  BAO-Radio / MiniFITSFile ");
     
    311314
    312315/* --Methode-- */
     316string MiniFITSFile::GetKey(const char* key)
     317{
     318  char rs[80];
     319  char cle[10];
     320  strncpy(cle,key,8);
     321  cle[8]='=';
     322  for(int i=0;i<8;i++)
     323    if (cle[i]=='\0') cle[i]=' ';
     324  cle[9]='\0';
     325  for(int kh=80; kh<2800; kh+=80) {
     326    char * buff = header+kh;
     327    if (strncmp(buff, cle, 9) == 0)  {
     328      strncpy(rs, buff+10, 70);
     329      rs[70]='\0';
     330      break;
     331    }
     332  }
     333  return rs;
     334}
     335
     336/* --Methode-- */
    313337void MiniFITSFile::DecodeHeader()
    314338{
     
    322346  bool fgok3=false;
    323347  for(int kh=80; kh<2800; kh+=80) {
    324         buff = header+kh;
    325         if (strncmp(buff, "NAXIS1  =", 9) == 0)  {
    326           nax1 = atol(buff+10);
    327           fgok1 = true;
    328 //        cout << " FOUND : NAXIS1= " << nax1 << endl;
    329         }
    330         else if (strncmp(buff, "NAXIS2  =", 9) == 0)  {
    331           nax2 = atol(buff+10);
    332           fgok2 = true;
    333 //        cout << " FOUND : NAXIS2= " << nax2 << endl;           
    334         }
    335         else if (strncmp(buff, "NAXIS3  =", 9) == 0)  {
    336           nax3 = atol(buff+10);
    337           fgok3 = true;
    338 //        cout << " FOUND : NAXIS2= " << nax2 << endl;           
    339         }
    340         else if (strncmp(buff, "BITPIX  =", 9) == 0)  {
    341           int bpix = atoi(buff+10);
    342           fgokt = true;
    343           if (bpix == 8)  dtype = MF_Byte;
    344           else if (bpix == 16)  dtype = MF_Int16;
    345           else if (bpix == -32)  dtype = MF_Float32;
    346           else fgokt = false;
    347 //        cout << " FOUND : bpix= " << bpix << endl;             
    348         }
     348    buff = header+kh;
     349    if (strncmp(buff, "NAXIS1  =", 9) == 0)  {
     350      nax1 = atol(buff+10);
     351      fgok1 = true;
     352      //          cout << " FOUND : NAXIS1= " << nax1 << endl;
     353    }
     354    else if (strncmp(buff, "NAXIS2  =", 9) == 0)  {
     355      nax2 = atol(buff+10);
     356      fgok2 = true;
     357      //          cout << " FOUND : NAXIS2= " << nax2 << endl;           
     358    }
     359    else if (strncmp(buff, "NAXIS3  =", 9) == 0)  {
     360      nax3 = atol(buff+10);
     361      fgok3 = true;
     362      //          cout << " FOUND : NAXIS2= " << nax2 << endl;           
     363    }
     364    else if (strncmp(buff, "BITPIX  =", 9) == 0)  {
     365      int bpix = atoi(buff+10);
     366      fgokt = true;
     367      if (bpix == 8)  dtype = MF_Byte;
     368      else if (bpix == 16)  dtype = MF_Int16;
     369      else if (bpix == -32)  dtype = MF_Float32;
     370      else fgokt = false;
     371      //          cout << " FOUND : bpix= " << bpix << endl;             
     372    }
    349373  }
    350374  if (!(fgok1&&fgok2&&fgokt)) 
    351      throw MiniFITSException("MiniFITSFile::DecodeHeader()/Error- Missing/wrong NAXIS1/2,BITPIX");
     375    throw MiniFITSException("MiniFITSFile::DecodeHeader()/Error- Missing/wrong NAXIS1/2,BITPIX");
    352376  if (fgok3)  fgnax3=true;
    353377  return;
  • trunk/AddOn/TAcq/minifits.h

    r3684 r3688  
    9494    { return AddKeyS(key.c_str(), val.c_str(), comm.c_str()); }
    9595
    96   //  string getKey(string& key);
    97  protected:
     96  string GetKey(string& key) { return GetKey(key.c_str()) ; }
     97  string GetKey(const char* key);
     98
     99protected:
    98100  void FillHeader();
    99101  void DecodeHeader();
Note: See TracChangeset for help on using the changeset viewer.