Changeset 1679 for branches


Ignore:
Timestamp:
01/29/10 14:02:29 (15 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-1823

Ready to Release: No

Interface Changes: Yes

What Interface Changed: Added new function asapmath._array2dOp

Test Programs: List test programs

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

I have defined a new function asapmath._array2dOp() which performs
an operation (add, sub, mul, div) of scantable with 2d list (float or
int).


File:
1 edited

Legend:

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

    r1673 r1679  
    10471047    os.system('rm -rf '+tmpms)
    10481048    return outfiles
     1049
     1050def _array2dOp( scan, value, mode="ADD", tsys=False ):
     1051    """
     1052    This function is workaround on the basic operation of scantable
     1053    with 2 dimensional float list.
     1054
     1055    scan:    scantable operand
     1056    value:   float list operand
     1057    mode:    operation mode (ADD, SUB, MUL, DIV)
     1058    tsys:    if True, operate tsys as well
     1059    """
     1060    nrow = scan.nrow()
     1061    s = None
     1062    if len( value ) != nrow:
     1063        asaplog.push( 'len(value) must conform to scan.nrow()' )
     1064        print_log( 'ERROR' )
     1065    else:
     1066        from asap._asap import stmath
     1067        stm = stmath()
     1068        # insitu must be True
     1069        stm._setinsitu( True )
     1070        s = scan.copy()
     1071        sel = selector()
     1072        for irow in range( nrow ):
     1073            sel.set_rows( irow )
     1074            s.set_selection( sel )
     1075            if len( value[irow] ) == 1:
     1076                stm._unaryop( s, value[irow][0], mode, tsys )
     1077            else:
     1078                stm._arrayop( s, value[irow], mode, tsys, 'channel' )
     1079            s.set_selection()
     1080            sel.reset()
     1081        del sel
     1082        del stm
     1083    return s
     1084
     1085           
     1086           
Note: See TracChangeset for help on using the changeset viewer.