Changeset 2143 for trunk/src


Ignore:
Timestamp:
04/18/11 12:13:08 (14 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: sdmath unit test (coming soon)

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Bug fix on subtraction and division of scantable.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r2135 r2143  
    492492  ArrayColumn<Float> specCol(tab,"SPECTRA");
    493493  ArrayColumn<Float> tsysCol(tab,"TSYS");
     494  if (mode=="DIV") val = 1.0/val ;
     495  else if (mode=="SUB") val *= -1.0 ;
    494496  for (uInt i=0; i<tab.nrow(); ++i) {
    495497    Vector<Float> spec;
     
    498500    tsysCol.get(i, ts);
    499501    if (mode == "MUL" || mode == "DIV") {
    500       if (mode == "DIV") val = 1.0/val;
     502      //if (mode == "DIV") val = 1.0/val;
    501503      spec *= val;
    502504      specCol.put(i, spec);
     
    506508      }
    507509    } else if ( mode == "ADD"  || mode == "SUB") {
    508       if (mode == "SUB") val *= -1.0;
     510      //if (mode == "SUB") val *= -1.0;
    509511      spec += val;
    510512      specCol.put(i, spec);
     
    587589  ArrayColumn<Float> specCol(tab,"SPECTRA");
    588590  ArrayColumn<Float> tsysCol(tab,"TSYS");
     591  if (mode == "DIV") fact = (float)1.0 / fact;
     592  else if (mode == "SUB") fact *= (float)-1.0 ;
    589593  for (uInt i=0; i<tab.nrow(); ++i) {
    590594    Vector<Float> spec;
     
    593597    tsysCol.get(i, ts);
    594598    if (mode == "MUL" || mode == "DIV") {
    595       if (mode == "DIV") fact = (float)1.0 / fact;
     599      //if (mode == "DIV") fact = (float)1.0 / fact;
    596600      spec *= fact;
    597601      specCol.put(i, spec);
     
    601605      }
    602606    } else if ( mode == "ADD"  || mode == "SUB") {
    603       if (mode == "SUB") fact *= (float)-1.0 ;
     607      //if (mode == "SUB") fact *= (float)-1.0 ;
    604608      spec += fact;
    605609      specCol.put(i, spec);
Note: See TracChangeset for help on using the changeset viewer.