Changeset 1682 for branches/alma


Ignore:
Timestamp:
02/02/10 18:47:39 (14 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-1823

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/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Bug fix.
Supported operation with 1D list with length of 1, and with 2D list with
shape of (1,1) or (1,nchan).


Location:
branches/alma
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/python/asapmath.py

    r1679 r1682  
    10601060    nrow = scan.nrow()
    10611061    s = None
    1062     if len( value ) != nrow:
    1063         asaplog.push( 'len(value) must conform to scan.nrow()' )
     1062    if len( value ) == 1:
     1063        from asap._asap import stmath
     1064        stm = stmath()
     1065        s = scantable( stm._arrayop( scan.copy(), value[0], mode, tsys ) )
     1066        del stm
     1067    elif len( value ) != nrow:
     1068        asaplog.push( 'len(value) must be 1 or conform to scan.nrow()' )
    10641069        print_log( 'ERROR' )
    10651070    else:
  • branches/alma/src/STMath.cpp

    r1680 r1682  
    528528                                                     bool tsys )
    529529{
     530  if ( val.size() == 1 ){
     531    return unaryOperate( in, val[0], mode, tsys ) ;
     532  }
     533
    530534  // conformity of SPECTRA and TSYS
    531535  if ( tsys ) {
     
    557561  Vector<Float> fact( val ) ;
    558562  if ( fact.nelements() != mchans[0] ) {
    559     throw( AipsError("Vector size must be same as number of channel.") ) ;
     563    throw( AipsError("Vector size must be 1 or be same as number of channel.") ) ;
    560564  }
    561565
     
    600604                                                 bool tsys )
    601605{
     606  if ( val.size() == 1 ) {
     607    return unaryOperate( in, val[0], mode, tsys ) ;
     608  }
     609
    602610  // conformity of SPECTRA and TSYS
    603611  if ( tsys ) {
     
    618626  Vector<Float> fact( val ) ;
    619627  if ( fact.nelements() != in->nrow() ) {
    620     throw( AipsError("Vector size must be same as number of row.") ) ;
     628    throw( AipsError("Vector size must be 1 or be same as number of row.") ) ;
    621629  }
    622630
Note: See TracChangeset for help on using the changeset viewer.