Ignore:
Timestamp:
07/18/09 06:35:47 (15 years ago)
Author:
TakTsutsumi
Message:

New Development: No, merge with asap2.3.1

JIRA Issue: Yes CAS-1450

Ready to Release: Yes/No?

Interface Changes: Yes/No?

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes

Module(s): single dish

Description: Upgrade of alma branch based on ASAP2.2.0

(rev.1562) to ASAP2.3.1 (rev.1561)


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/src/STMath.cpp

    r1516 r1603  
    297297                                             bool droprows)
    298298{
    299   if (insitu_) return in;
     299  if (insitu_) {
     300    return in;
     301  }
    300302  else {
    301303    // clone
    302     Scantable* tabp = new Scantable(*in, Bool(droprows));
    303     return CountedPtr<Scantable>(tabp);
     304    return CountedPtr<Scantable>(new Scantable(*in, Bool(droprows)));
    304305  }
    305306}
     
    15131514  ArrayColumn<Float> specCol(tab, "SPECTRA");
    15141515  ArrayColumn<uChar> flagCol(tab, "FLAGTRA");
     1516  ArrayColumn<Float> tsysCol(tab, "TSYS");
    15151517  for ( uInt i=0; i<tab.nrow(); ++i) {
    15161518    Float zdist = Float(C::pi_2) - elev(i);
     
    15201522    specCol.put(i, ma.getArray());
    15211523    flagCol.put(i, flagsFromMA(ma));
     1524    Vector<Float> tsys;
     1525    tsysCol.get(i, tsys);
     1526    tsys *= factor;
     1527    tsysCol.put(i, tsys);
    15221528  }
    15231529  return out;
     
    16141620  while ( it != in.end() ){
    16151621    if ( ! (*it)->conformant(*out) ) {
    1616       // log message: "ignoring scantable i, as it isn't
    1617       // conformant with the other(s)"
    1618       cerr << "oh oh" << endl;
    1619       ++it;
    1620       continue;
     1622      // non conformant.
     1623      pushLog(String("Warning: Can't merge scantables as header info differs."));
    16211624    }
    16221625    out->appendToHistoryTable((*it)->history());
     
    16281631        Table thetab = freqit.table();
    16291632        uInt nrow = tout.nrow();
    1630         //tout.addRow(thetab.nrow());
     1633        tout.addRow(thetab.nrow());
    16311634        TableCopy::copyRows(tout, thetab, nrow, 0, thetab.nrow());
    16321635        ROTableRow row(thetab);
     
    18261829
    18271830  InterpolateArray1D<Double,Float>::InterpolationMethod interp = stringToIMethod(method);
     1831  /*
     1832  // Comment from MV.
     1833  // the following code has been commented out because different FREQ_IDs have to be aligned together even
     1834  // if the frame doesn't change. So far, lack of this check didn't cause any problems.
    18281835  // test if user frame is different to base frame
    18291836  if ( in->frequencies().getFrameString(true)
     
    18321839                    " (use set_freqframe) or it is aligned already."));
    18331840  }
     1841  */
    18341842  MFrequency::Types system = in->frequencies().getFrame();
    18351843  MVTime mvt(refEpoch.getValue());
     
    18571865
    18581866    ROArrayColumn<Float> sCol(t, "SPECTRA");
    1859     MDirection direction = dirCol(0);
    1860     uInt nchan = sCol(0).nelements();
     1867    const MDirection direction = dirCol(0);
     1868    const uInt nchan = sCol(0).nelements();
     1869
     1870    // skip operations if there is nothing to align
     1871    if (fiter.pastEnd()) {
     1872        continue;
     1873    }
     1874
     1875    Table ftab = fiter.table();
     1876    // align all frequency ids with respect to the first encountered id
     1877    ScalarColumn<uInt> freqidCol(ftab, "FREQ_ID");
     1878    // get the SpectralCoordinate for the freqid, which we are iterating over
     1879    SpectralCoordinate sC = in->frequencies().getSpectralCoordinate(freqidCol(0));
     1880    FrequencyAligner<Float> fa( sC, nchan, refEpoch,
     1881                                direction, refPos, system );
     1882    // realign the SpectralCoordinate and put into the output Scantable
     1883    Vector<String> units(1);
     1884    units = String("Hz");
     1885    Bool linear=True;
     1886    SpectralCoordinate sc2 = fa.alignedSpectralCoordinate(linear);
     1887    sc2.setWorldAxisUnits(units);
     1888    const uInt id = out->frequencies().addEntry(sc2.referencePixel()[0],
     1889                                                sc2.referenceValue()[0],
     1890                                                sc2.increment()[0]);
    18611891    while ( !fiter.pastEnd() ) {
    1862       Table ftab = fiter.table();
    1863       ScalarColumn<uInt> freqidCol(ftab, "FREQ_ID");
    1864       // get the SpectralCoordinate for the freqid, which we are iterating over
    1865       SpectralCoordinate sC = in->frequencies().getSpectralCoordinate(freqidCol(0));
    1866       FrequencyAligner<Float> fa( sC, nchan, refEpoch,
    1867                                   direction, refPos, system );
    1868       // realign the SpectralCoordinate and put into the output Scantable
    1869       Vector<String> units(1);
    1870       units = String("Hz");
    1871       Bool linear=True;
    1872       SpectralCoordinate sc2 = fa.alignedSpectralCoordinate(linear);
    1873       sc2.setWorldAxisUnits(units);
    1874       uInt id = out->frequencies().addEntry(sc2.referencePixel()[0],
    1875                                             sc2.referenceValue()[0],
    1876                                             sc2.increment()[0]);
    1877       TableVector<uInt> tvec(ftab, "FREQ_ID");
    1878       tvec = id;
     1892      ftab = fiter.table();
     1893      // spectral coordinate for the current FREQ_ID
     1894      ScalarColumn<uInt> freqidCol2(ftab, "FREQ_ID");
     1895      sC = in->frequencies().getSpectralCoordinate(freqidCol2(0));
    18791896      // create the "global" abcissa for alignment with same FREQ_ID
    18801897      Vector<Double> abc(nchan);
    1881       Double w;
    18821898      for (uInt i=0; i<nchan; i++) {
    1883         sC.toWorld(w,Double(i));
    1884         abc[i] = w;
    1885       }
     1899           Double w;
     1900           sC.toWorld(w,Double(i));
     1901           abc[i] = w;
     1902      }
     1903      TableVector<uInt> tvec(ftab, "FREQ_ID");
     1904      // assign new frequency id to all rows
     1905      tvec = id;
    18861906      // cache abcissa for same time stamps, so iterate over those
    18871907      TableIterator timeiter(ftab, "TIME");
     
    18921912        MEpoch::ROScalarColumn timeCol(tab, "TIME");
    18931913        // use align abcissa cache after the first row
     1914        // these rows should be just be POLNO
    18941915        bool first = true;
    1895         // these rows should be just be POLNO
    18961916        for (int i=0; i<int(tab.nrow()); ++i) {
    18971917          // input values
Note: See TracChangeset for help on using the changeset viewer.