Ignore:
Timestamp:
10/04/11 13:40:03 (13 years ago)
Author:
Malte Marquarding
Message:

Ticket #251: fixed copy of input scantable which breaks scantable selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapmath.py

    r2150 r2320  
    10121012
    10131013@asaplog_post_dec
    1014 def _array2dOp( scan, value, mode="ADD", tsys=False ):
     1014def _array2dOp( scan, value, mode="ADD", tsys=False, insitu=None):
    10151015    """
    10161016    This function is workaround on the basic operation of scantable
     
    10241024    nrow = scan.nrow()
    10251025    s = None
     1026    from asap._asap import stmath
     1027    stm = stmath()
     1028    stm._setinsitu(insitu)
    10261029    if len( value ) == 1:
    1027         from asap._asap import stmath
    1028         stm = stmath()
    1029         s = scantable( stm._arrayop( scan.copy(), value[0], mode, tsys ) )
    1030         del stm
     1030        s = scantable( stm._arrayop( scan, value[0], mode, tsys ) )
    10311031    elif len( value ) != nrow:
    10321032        raise ValueError( 'len(value) must be 1 or conform to scan.nrow()' )
    10331033    else:
    10341034        from asap._asap import stmath
    1035         stm = stmath()
    1036         # insitu must be True
     1035        if not insitu:
     1036            s = scan.copy()
     1037        else:
     1038            s = scan
     1039        # insitu must be True as we go row by row on the same data
    10371040        stm._setinsitu( True )
    1038         s = scan.copy()
    1039         sel = selector()
     1041        basesel = s.get_selection()
     1042        sel = selector()+basesel
    10401043        for irow in range( nrow ):
    10411044            sel.set_rows( irow )
     
    10461049                #stm._arrayop( s, value[irow], mode, tsys, 'channel' )
    10471050                stm._arrayop( s, value[irow], mode, tsys )
    1048             s.set_selection()
    1049             sel.reset()
    1050         del sel
    1051         del stm
     1051        s.set_selection(basesel)
    10521052    return s
Note: See TracChangeset for help on using the changeset viewer.