示例#1
0
def MoveBetweenListBoxes(sourcebox, destbox):
    indstomove=sourcebox.GetSelections()
#        self.junkfiles
    filestomove=[]
    for ind in reverse(indstomove):
        curstr=sourcebox.GetString(ind)
        filestomove.append(curstr)
        sourcebox.Delete(ind)
    for ent in reverse(filestomove):
        destbox.Append(ent)
def FixOneOver(strin,displaystyle=True):
    strout=strin
    oi=strout.find('\\over')
    if oi>-1:
        leftpart=rwkstr(strout[0:oi-1])#the -1 is because the syntax will always be {{num}\\over{den}} and I don't want the } before \\over
        linds=leftpart.findall('{{')
        linds=reverse(linds)
        for ti in linds:
            tempnum=leftpart[ti+2:]
            if checkonebalance(tempnum)==0:
                break
        num=tempnum
        b4=leftpart[0:ti]
        si=oi+len('\\over')+1
        rightpart=rwkstr(strout[si:])
        rinds=rightpart.findall('}}')
        for ri in rinds:
            tempden=rightpart[0:ri]
            if checkonebalance(tempden)==0:
                break
        den=tempden
        afterpart=rightpart[len(den)+2:]
        strout=b4
        if displaystyle:
            strout+=' \\displaystyle '
        strout+='\\frac{'+num+'}{'+den+'}'+afterpart
    return strout
示例#3
0
def staythreshbackwd(vectin, thresh, staypoints=20, above=True, startind=None):
    if startind is None:
        startind = vectin.shape[0]
    myvect = vectin[0:startind]
    myvect = reverse(myvect)
    ind1 = _staythresh(myvect, thresh, staypoints=staypoints, above=above)
    return startind-ind1
示例#4
0
文件: rref.py 项目: ryanGT/research
def backsub(mat, eps=1e-14):
#    Pdb().set_trace()
    nr=shape(mat)[0]
    nc=shape(mat)[1]
    if nc==(nr+1):
        B=mat[:,nc-1]
        A=mat[:,0:nc-1]
    else:
        B=zeros((nr,1),'D')
        A=mat
    nca=shape(A)[1]
    vectout=zeros((nr,1),'D')
#    vectout=vectout*1j
    for cr in reverse(range(nr)):
        if abs(mat[cr,cr])<eps:
            vectout[cr]=1
        else:
            if cr<(nca-1):
                dp=dot(A[cr,cr+1:],vectout[cr+1:])[0]
            else:
                dp=0
            vectout[cr]=B[cr]-dp/A[cr,cr]
    return vectout
示例#5
0
def DeleteFromListbox(controlwithitems, indlist):
    """Remove items from a controlwithitems.  indlist is an list of
    integers of the indices of the items to remove."""
    mylist=list(indlist)
    for index in reverse(mylist):
        controlwithitems.Delete(index)