Ignore:
Timestamp:
06/30/04 11:00:23 (20 years ago)
Author:
mmarquar
Message:

Updated data container. Changed the axis order in the spectrum/flag arrays to [nBeam,nIF,nPol,nChan]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDContainer.cc

    r14 r16  
    3838using namespace atnf_sd;
    3939
    40 SDContainer::SDContainer(uInt nBeam, uInt nIF, uInt nChan, uInt nPol)
     40SDContainer::SDContainer(uInt nBeam, uInt nIF, uInt nPol, uInt nChan)
    4141  : nBeam_(nBeam),
    42   nIF_(nIF),
    43   nChan_(nChan),
    44   nPol_(nPol),
    45   spectrum_(IPosition(4,nBeam,nIF,nChan,nPol)),
    46   flags_(IPosition(4,nBeam,nIF,nChan,nPol)),
    47   tsys_(IPosition(4,nBeam,nIF,nChan,nPol)) {
     42    nIF_(nIF),
     43    nPol_(nPol),
     44    nChan_(nChan),
     45    spectrum_(IPosition(4,nBeam,nIF,nPol,nChan)),
     46    flags_(IPosition(4,nBeam,nIF,nPol,nChan)),
     47    tsys_(IPosition(4,nBeam,nIF,nPol,nChan)) {
     48  uChar x = 0;
     49  flags_ = ~x;
     50}
     51
     52SDContainer::SDContainer(IPosition shp)
     53  : nBeam_(shp(0)),
     54    nIF_(shp(1)),
     55    nPol_(shp(2)),
     56    nChan_(shp(3)),
     57    spectrum_(shp),
     58    flags_(shp),
     59    tsys_(shp) {
    4860  uChar x = 0;
    4961  flags_ = ~x;
     
    7284 
    7385  //Vector<Float> pols(nPol);
    74   ArrayAccessor<Float, Axis<0> > j(spec);
     86  ArrayAccessor<Float, Axis<1> > j(spec);
    7587  IPosition shp0 = spectrum_.shape();
    7688  IPosition shp1 = spec.shape();
    77   if ( (shp0(2) != shp1(0)) || (shp0(3) != shp1(1)) ) {
     89  if ( (shp0(2) != shp1(1)) || (shp0(3) != shp1(0)) ) {
    7890    cerr << "Arrays not conformant" << endl;     
    7991    return False;
    8092  }
    81   //uInt chani = 0;
    82   //uInt poli = 0;
    8393  // assert dimensions are the same....
    8494  for (ArrayAccessor<Float, Axis<2> > i(aa1);i != i.end(); ++i) {
    85     //pols = spec.row(chani);   
    86     ArrayAccessor<Float, Axis<1> > jj(j);
     95    ArrayAccessor<Float, Axis<0> > jj(j);
    8796    for (ArrayAccessor<Float, Axis<3> > ii(i);ii != ii.end(); ++ii) {
    88       //(*ii) = pols[poli];     
    8997      (*ii) = (*jj);
    90       //poli++;
    9198      jj++;
    9299    }
    93     //poli = 0;
    94     //chani++;
    95100    j++;
    96101  }
     
    113118  aa1.reset(aa1.begin(whichIF));
    114119 
    115   ArrayAccessor<uChar, Axis<0> > j(flag);
     120  ArrayAccessor<uChar, Axis<1> > j(flag);
    116121  IPosition shp0 = flags_.shape();
    117122  IPosition shp1 = flag.shape();
    118   if ( (shp0(2) != shp1(0)) || (shp0(3) != shp1(1)) ) {
     123  if ( (shp0(2) != shp1(1)) || (shp0(3) != shp1(0)) ) {
    119124    cerr << "Arrays not conformant" << endl;     
    120125    return False;
     
    123128  // assert dimensions are the same....
    124129  for (ArrayAccessor<uChar, Axis<2> > i(aa1);i != i.end(); ++i) {
    125     ArrayAccessor<uChar, Axis<1> > jj(j);
     130    ArrayAccessor<uChar, Axis<0> > jj(j);
    126131    for (ArrayAccessor<uChar, Axis<3> > ii(i);ii != ii.end(); ++ii) {
    127132      (*ii) = (*jj);
     
    130135    j++;
    131136  }
     137  return True;
    132138}
    133139
     
    139145  aa1.reset(aa1.begin(whichIF));
    140146  // assert dimensions are the same....
    141   uInt idx = 0;
    142 
    143 
    144   for (ArrayAccessor<Float, Axis<2> > i(aa1);i != i.end(); ++i) {   
    145     idx = 0;
     147  for (ArrayAccessor<Float, Axis<3> > i(aa1);i != i.end(); ++i) {   
    146148    ArrayAccessor<Float, Axis<0> > j(tsys);
    147     for (ArrayAccessor<Float, Axis<3> > ii(i);ii != ii.end(); ++ii) {
     149    for (ArrayAccessor<Float, Axis<2> > ii(i);ii != ii.end(); ++ii) {
    148150      (*ii) = (*j);
    149151      j++;
Note: See TracChangeset for help on using the changeset viewer.