Пример #1
0
    def AddPoint(self, x):
        print self.name, "adding point", x
        if self.latestPoint == None:
            self.latestPoint = x
        else:
            # create a new split between the last click and this one
            # (getting the order right)
            if (x > self.latestPoint):
                self.splits.append(
                    Split.Split(self.motion, self.latestPoint, x))
            else:
                self.splits.append(
                    Split.Split(self.motion, x, self.latestPoint))

            # add the split to the total motion represented by the track
            # If this is the first split, we need to replace the masked motion
            # with the current split, otherwise add the new split to the
            # previous ones
            #if self.motion == self.maskedMotion :
            #	self.motion = self.splits[-1].GetMotion()
            #else:
            #	self.motion = Piavca.MotionAdder(self.splits[-1].GetMotion(), self.motion)

            self.latestPoint = None
Пример #2
0
 def LoadSplits(self):
     filename = "%s.txt" % self.GetName()
     print filename
     file = open(filename, "r")
     lines = file.readlines()
     for line in lines:
         print line
         splits = string.split(line, ",")
         print splits
         self.splits = []
         for split in splits:
             if (split == ""):
                 continue
             split = string.split(split)
             if split == []:
                 continue
             print split
             split = Split.Split(self.motion, float(split[0]),
                                 float(split[1]))
             self.splits.append(split)
     for s in self.splits:
         print s
Пример #3
0
def split(path):
  head, tail = Split(path)
  if len(head) > 1 and head[-1] == '/':
    head = head[:-1]
  return (head, tail)
Пример #4
0
import Split as sp
import Parser as prs
import mathExpr as ME

text = '''
X + y =100*65489-fsdahfj+76
x = c+4u
while (c>c( qb = fds+fgds
if (c>c) qb = fds+fgds
Q = x+y+n+5*9*y*u/u+i
'''

lists = sp.Split(text)

Res = prs.Parse(lists)

for i in range(len(lists)):
    print(lists[i],Res[i])

# text = 'x+y+n+5*9*y*u/u+i'
# lis = sp.Split(text)
# print (lis)
# print(ME.math_expr(lis[0]))
 def _split_bins(self):
     split_clf=Split(feature=self._temp,min_sample=self.min_sample,max_node_number=self._bins)
     split_clf.fit(self._df,self._label)
     self.bins=split_clf.bins