Ejemplo n.º 1
0
    def getPoints(self, values, fit=None, tgt=None):
        if not fit:
            return False, "Attacker is required"
        if not tgt:
            return False, "Target is required"

        fitDps = FitDps(fit)
        data = self.prepareData(values, fit, tgt)
        variable = None
        for fieldName, value in data.iteritems():
            d = Data(fieldName, value, 1 if fieldName == "distance" else None)
            if not d.isConstant():
                if variable is None:
                    variable = fieldName
                else:
                    # We can't handle more then one variable atm, OOPS F**K OUT
                    return False, "Can only handle 1 variable"

            fitDps.setData(d)

        if variable is None:
            return False, "No variable"

        x = []
        y = []
        for point, val in fitDps.getIterator():
            x.append(point[variable])
            y.append(val)

        return x, y
Ejemplo n.º 2
0
    def getPoints(self, fit, fields):
        fitDps = getattr(self, "fitDps", None)
        if fitDps is None or fitDps.fit != fit:
            fitDps = self.fitDps = FitDps(fit)

        fitDps.clearData()
        variable = None
        for fieldName, value in fields.items():
            d = Data(fieldName, value)
            if not d.isConstant():
                if variable is None:
                    variable = fieldName
                else:
                    # We can't handle more then one variable atm, OOPS F**K OUT
                    return False, "Can only handle 1 variable"

            fitDps.setData(d)

        if variable is None:
            return False, "No variable"

        x = []
        y = []
        for point, val in fitDps.getIterator():
            x.append(point[variable])
            y.append(val)

        return x, y
Ejemplo n.º 3
0
 def getPoint(self, values, point, fit=None, tgt=None):
     # yes, we're bypassing the whole superclass pipeline because it's futzy and overcomplicated for fetching just one point
     if fit and tgt and point[0] > 0 and point[0] <= fit.maxTargetRange:
         fitDps = FitDps(fit)
         data = self.prepareData(values, fit, tgt)
         data["distance"] = point[0]
         return fitDps.calcDps(data)
     return None