Changeset 1520 in Sophya for trunk/ArchTOIPipe/TestPipes


Ignore:
Timestamp:
Jun 12, 2001, 7:40:20 PM (24 years ago)
Author:
cmv
Message:

Re-shape de map2toi cmv 12/6/01

Location:
trunk/ArchTOIPipe/TestPipes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/TestPipes/tstmap2toi.cc

    r1476 r1520  
    1717void usage(void) {
    1818 cout<<"tstmap2toi [-h] [-p lp] [-s samplemin,samplemax] [-w data_window_size]"<<endl
    19      <<"           [-a label_alpha] [-d label_delta] [-b label_bolomuv]"<<endl
    20      <<"           fitsin fitsphere fitsout"<<endl;
     19     <<"           [-a label_coord1In] [-d label_coord2In] [-b label_bolomuv]"<<endl
     20     <<"           [-i c,h] [-m c,h]"<<endl
     21     <<"           fitsin_point fitsphere fitsout"<<endl
     22     <<" -p lp : print level (def=0)"<<endl
     23     <<" -s samplemin,samplemax : sample range to be treated (def=all)"<<endl
     24     <<" -w data_window_size : window size for pipe (def=8192)"<<endl
     25     <<" -a label_coord1 : label fits for alpha/gLong (def=coord1)"<<endl
     26     <<" -d label_coord2 : label fits for delta/gLat (def=coord2)"<<endl
     27     <<"          coord1 = alpha or gLong ; coord2 = delta or gLat"<<endl
     28     <<" -b label_bolomuv : label fits for bolo value (def=boloMuV)"<<endl
     29     <<" -i c,h : coordIn caracteristics (c=G/E h=H/D) (def=G,D)"<<endl
     30     <<" -m c,h : idem -i for Sphere"<<endl
     31     <<" fitsin_point : fits file for pointing"<<endl
     32     <<" fitsphere : fits file for input Healpix sphere"<<endl
     33     <<" fitsout : fits file for output"<<endl;
    2134 return;
     35}
     36
     37unsigned long typecoord(char typc=' ',char hd=' ');
     38unsigned long typecoord(char typc,char hd)
     39// typc : G=galactiques, E=equatoriales, autres=galactiques
     40// hd : H=heure, D=degre, autres=(heure si typc==E, degre si typc==G)
     41{
     42  if(typc!='G' && typc!='E') typc='G';
     43  if(hd!='H' && hd!='D') {if(typc=='E') hd='H'; else hd='D';}
     44 unsigned long rc=TypCoordUndef;
     45  if(typc=='G') rc |= TypCoordGal;
     46    else        rc |= TypCoordEq;
     47  if(hd=='D')   rc |= TypCoordDD;
     48    else        rc |= TypCoordHD;
     49  return rc;
    2250}
    2351
     
    2957//-- Decodage arguments
    3058int lp = 0, width = 8192;
    31 char *label_alpha = "alpha", *label_delta = "delta", *label_bolomuv = "boloMuV";
     59char *label_coord1 = "coord1", *label_coord2 = "coord2", *label_bolomuv = "boloMuV";
    3260long sdeb,sfin;
    33 int c;
    34 while((c = getopt(narg,arg,"hp:s:w:a:d:b:")) != -1) {
     61unsigned long tcoorin=typecoord(), tcoormap=typecoord();
     62int c; char t=' ',h=' ';
     63while((c = getopt(narg,arg,"hp:s:w:a:d:b:i:m:")) != -1) {
    3564  switch (c) {
    3665  case 's' :
     
    3867    cout<<"Requested Samples from "<<sdeb<<" , "<<sfin<<endl;
    3968    if(sfin>=sdeb) mgr->setRequestedSample(sdeb,sfin);
    40     else {cout<<"Bad sample interval "<<endl; exit(-2);}
     69    else {cout<<"Bad sample interval "<<endl; exit(1);}
    4170    break;
    4271  case 'w' :
     
    5079    break;
    5180  case 'a' :
    52     label_alpha = optarg;
     81    label_coord1 = optarg;
    5382    break;
    5483  case 'd' :
    55     label_delta = optarg;
     84    label_coord2 = optarg;
    5685    break;
    5786  case 'b' :
    5887    label_bolomuv = optarg;
    5988    break;
     89  case 'i' :
     90    sscanf(optarg,"%c,%c",&t,&h);
     91    tcoorin=typecoord(t,h);
     92    break;
     93  case 'm' :
     94    sscanf(optarg,"%c,%c",&t,&h);
     95    tcoormap=typecoord(t,h);
     96    break;
    6097  case 'h' :
    61     usage(); exit(-1);
    62     break;
    6398  default:
    64     usage(); exit(-1);
     99    usage(); exit(1);
    65100  }
    66101}
    67 if(optind+2>=narg) {usage(); exit(-2);}
    68 char * fitsin          = arg[optind];
     102if(optind+2>=narg) {usage(); exit(2);}
     103char * fitsin_point    = arg[optind];
    69104string const fitsphere = arg[optind+1];
    70105char * fitsout         = arg[optind+2];
    71106
     107{
     108unsigned long tg,te,hd,dd;
    72109cout<<">>>> tstmap2toi:"<<endl
    73     <<"Fits Infile(snum,alpha,delta)= "<<fitsin<<endl
    74     <<"  ...label_alpha "<<label_alpha<<"  ,  label_delta "<<label_delta<<endl
    75     <<"Fits Sphere Healpix"<<fitsphere<<endl
    76     <<"Fits Outfile(snum,[alpha,delta],boloMuV)"<<fitsout<<endl
     110    <<"Pipe Window Size "<<width<<endl
     111    <<"Fits OutFile "<<fitsout<<endl
    77112    <<"  ...label_bolomuv "<<label_bolomuv<<endl;
     113tg = tcoorin&TypCoordGal; te = tcoorin&TypCoordEq;
     114hd = tcoorin&TypCoordHD;  dd = tcoorin&TypCoordDD;
     115cout<<"Fits Infile Pointing "<<fitsin_point<<endl
     116    <<"  ...label_coord1 "<<label_coord1<<endl
     117    <<"  ...label_coord2 "<<label_coord2<<endl
     118    <<"  ...... Gal="<<tg<<" Eq="<<te<<"   hour="<<hd<<" deg="<<dd<<endl;
     119tg = tcoormap&TypCoordGal; te = tcoormap&TypCoordEq;
     120hd = tcoormap&TypCoordHD;  dd = tcoormap&TypCoordDD;
     121cout<<"Fits Healpix Sphere "<<fitsphere<<endl
     122    <<"  ...... Gal="<<tg<<" Eq="<<te<<"   hour="<<hd<<" deg="<<dd<<endl;
     123}
    78124
    79125SophyaInit();
     
    85131
    86132 // FITS reader et writer
    87  FITSTOIReader rfits(fitsin);
     133 FITSTOIReader rfits(fitsin_point);
    88134 int ncol = rfits.getNOut();
    89  cout<<"Number of columns in fits Infile : "<<ncol<<endl;
    90  if(ncol<2) exit(-3);
     135 cout<<"Number of columns in fits Infile Pointing : "<<ncol<<endl;
     136 if(ncol<2) exit(3);
    91137
    92138 FITSTOIWriter wfits(fitsout);
     
    104150 Map2TOI m2toi(sph);
    105151 cout<<"Map2TOI created"<<endl;
     152 m2toi.SetEquinox(2000.);
     153 m2toi.SetCoorIn((TypAstroCoord) tcoorin);
     154 m2toi.SetCoorMap((TypAstroCoord) tcoormap);
    106155
    107156 // Definition des tuyaux
    108  TOISeqBuffered * toialphain = new TOISeqBuffered("toi_alpha_in",width);
    109  if(lp) toialphain->setDebugLevel(1);
    110  rfits.addOutput(label_alpha,toialphain);
    111  m2toi.addInput("AlphaIn",toialphain);
    112 
    113  TOISeqBuffered * toialphaout = new TOISeqBuffered("toi_alpha_out",width);
    114  m2toi.addOutput("AlphaOut",toialphaout);
    115  wfits.addInput(label_alpha,toialphaout);
    116 
    117  TOISeqBuffered * toideltain = new TOISeqBuffered("toi_delta_in",width);
    118  if(lp) toideltain->setDebugLevel(1);
    119  rfits.addOutput(label_delta,toideltain);
    120  m2toi.addInput("DeltaIn",toideltain);
    121 
    122  TOISeqBuffered * toideltaout = new TOISeqBuffered("toi_delta_out",width);
    123  m2toi.addOutput("DeltaOut",toideltaout);
    124  wfits.addInput(label_delta,toideltaout);
     157 TOISeqBuffered * toicoord1in = new TOISeqBuffered("toi_coord1_in",width);
     158 // toicoord1in->setDebugLevel(1);
     159 rfits.addOutput(label_coord1,toicoord1in);
     160 m2toi.addInput("Coord1In",toicoord1in);
     161
     162 TOISeqBuffered * toicoord1out = new TOISeqBuffered("toi_coord1_out",width);
     163 m2toi.addOutput("Coord1Out",toicoord1out);
     164 wfits.addInput(label_coord1,toicoord1out);
     165
     166 TOISeqBuffered * toicoord2in = new TOISeqBuffered("toi_coord2_in",width);
     167 // toicoord2in->setDebugLevel(1);
     168 rfits.addOutput(label_coord2,toicoord2in);
     169 m2toi.addInput("Coord2In",toicoord2in);
     170
     171 TOISeqBuffered * toicoord2out = new TOISeqBuffered("toi_coord2_out",width);
     172 m2toi.addOutput("Coord2Out",toicoord2out);
     173 wfits.addInput(label_coord2,toicoord2out);
    125174
    126175 TOISeqBuffered * toibolout = new TOISeqBuffered("toi_bolo_out",width);
    127  if(lp) toibolout->setDebugLevel(1);
     176 // toibolout->setDebugLevel(1);
    128177 m2toi.addOutput("BoloOut",toibolout);
    129178 wfits.addInput(label_bolomuv,toibolout);
     
    142191 if(lp>1)
    143192   for(int jjjj=0;jjjj<5;jjjj++) {
    144      cout<<*toialphain;
     193     cout<<*toicoord1in;
    145194     cout<<*toibolout;
    146195     sleep(2);
  • trunk/ArchTOIPipe/TestPipes/tsttoi2map.cc

    r1516 r1520  
    2929     <<" -b label_bolomuv : label fits for bolo value (def=boloMuV)"<<endl
    3030     <<" -n nlat : nlat for Healpix sphere (def=128)"<<endl
    31      <<" -i c,h : coord1 caracteristics (c=G/E h=H/D) (def=G,D)"<<endl
    32      <<" -o c,h : idem -i for coord2"<<endl
     31     <<" -i c,h : coordIn caracteristics (c=G/E h=H/D) (def=G,D)"<<endl
     32     <<" -o c,h : idem -i for coordOut"<<endl
    3333     <<" fitsin_point : fits file for pointing"<<endl
    3434     <<" fitsin_bolo : fits file for bolo values"<<endl
     
    124124tg = tcoorin&TypCoordGal; te = tcoorin&TypCoordEq;
    125125hd = tcoorin&TypCoordHD;  dd = tcoorin&TypCoordDD;
    126 cout<<"  ...label_coord1 "<<label_coord1<<endl
     126cout<<"Fits Infile Pointing "<<fitsin_point<<endl
     127    <<"  ...label_coord1 "<<label_coord1<<endl
    127128    <<"  ...label_coord2 "<<label_coord2<<endl
    128129    <<"  ...... Gal="<<tg<<" Eq="<<te<<"   hour="<<hd<<" deg="<<dd<<endl;
Note: See TracChangeset for help on using the changeset viewer.