示例#1
0
        def evaluate(self, dataTable, functionTable, performanceTable, arguments):
            arguments = [x.evaluate(dataTable, functionTable, performanceTable) for x in arguments]
            performanceTable.begin("built-in \"%s\"" % self.name)

            fieldType = self.fieldTypeFromSignature(arguments)
            left, right = arguments
            dataColumn = DataColumn(fieldType, NP("arctan2", left.data, right.data), DataColumn.mapAnyMissingInvalid([left.mask, right.mask]))

            performanceTable.end("built-in \"%s\"" % self.name)
            return dataColumn
示例#2
0
        def evaluate(self, dataTable, functionTable, performanceTable,
                     arguments):
            arguments = [
                x.evaluate(dataTable, functionTable, performanceTable)
                for x in arguments
            ]
            performanceTable.begin("built-in \"%s\"" % self.name)

            fieldType = self.fieldTypeFromSignature(arguments)
            left, right = arguments
            dataColumn = DataColumn(
                fieldType, NP("arctan2", left.data, right.data),
                DataColumn.mapAnyMissingInvalid([left.mask, right.mask]))

            performanceTable.end("built-in \"%s\"" % self.name)
            return dataColumn
示例#3
0
        def evaluate(self, dataTable, functionTable, performanceTable,
                     arguments):
            arguments = [
                x.evaluate(dataTable, functionTable, performanceTable)
                for x in arguments
            ]
            performanceTable.begin("built-in \"%s\"" % self.name)

            fieldType = self.fieldTypeFromSignature(arguments)
            dataColumn = DataColumn(
                fieldType, NP("cos", arguments[0].data * arguments[1].data),
                DataColumn.mapAnyMissingInvalid(
                    [arguments[0].mask, arguments[1].mask]))

            performanceTable.end("built-in \"%s\"" % self.name)
            return dataColumn
示例#4
0
        def evaluate(self, dataTable, functionTable, performanceTable, arguments):
            arguments = [x.evaluate(dataTable, functionTable, performanceTable) for x in arguments]
            performanceTable.begin("built-in \"%s\"" % self.name)

            fieldType = self.fieldTypeFromSignature(arguments)
            left, right = arguments

            zeroDenominators = NP(NP(right.data == 0.0) * defs.INVALID)
            if not zeroDenominators.any():
                zeroDenominators = None

            mask = DataColumn.mapAnyMissingInvalid([zeroDenominators, left.mask, right.mask])

            dataColumn = DataColumn(fieldType, NP("floor_divide", left.data, right.data), mask)

            performanceTable.end("built-in \"%s\"" % self.name)
            return dataColumn
示例#5
0
        def evaluate(self, dataTable, functionTable, performanceTable, arguments):
            arguments = [x.evaluate(dataTable, functionTable, performanceTable) for x in arguments]
            performanceTable.begin("built-in \"%s\"" % self.name)

            fieldType = self.fieldTypeFromSignature(arguments)
            test, low, high = arguments

            if test.fieldType.dataType == "object" or (test.fieldType.dataType == "string" and test.fieldType.optype == "continuous" and low.fieldType.optype == "continuous"):
                ld = test.data
                rd = low.data
                data = NP("fromiter", (ld[i] >= rd[i] for i in xrange(len(dataTable))), dtype=fieldType.dtype, count=len(dataTable))

            elif test.fieldType.dataType == "string":
                ld = test.data
                rd = low.data
                l2s = test.fieldType.valueToString
                r2s = low.fieldType.valueToString
                data = NP("fromiter", (l2s(ld[i]) >= r2s(rd[i]) for i in xrange(len(dataTable))), dtype=fieldType.dtype, count=len(dataTable))

            else:
                data = NP("greater_equal", test.data, low.data)

            if test.fieldType.dataType == "object" or (test.fieldType.dataType == "string" and test.fieldType.optype == "continuous" and high.fieldType.optype == "continuous"):
                ld = test.data
                rd = high.data
                datahigh = NP("fromiter", (ld[i] <= rd[i] for i in xrange(len(dataTable))), dtype=fieldType.dtype, count=len(dataTable))

            elif test.fieldType.dataType == "string":
                ld = test.data
                rd = high.data
                l2s = test.fieldType.valueToString
                r2s = high.fieldType.valueToString
                datahigh = NP("fromiter", (l2s(ld[i]) <= r2s(rd[i]) for i in xrange(len(dataTable))), dtype=fieldType.dtype, count=len(dataTable))

            else:
                datahigh = NP("less_equal", test.data, high.data)

            NP("logical_and", data, datahigh, data)

            performanceTable.end("built-in \"%s\"" % self.name)
            return DataColumn(fieldType, data, DataColumn.mapAnyMissingInvalid([test.mask, low.mask, high.mask]))
示例#6
0
        def evaluate(self, dataTable, functionTable, performanceTable,
                     arguments):
            arguments = [
                x.evaluate(dataTable, functionTable, performanceTable)
                for x in arguments
            ]
            performanceTable.begin("built-in \"%s\"" % self.name)

            fieldType = self.fieldTypeFromSignature(arguments)
            left, right = arguments

            zeroDenominators = NP(NP(right.data == 0.0) * defs.INVALID)
            if not zeroDenominators.any():
                zeroDenominators = None

            mask = DataColumn.mapAnyMissingInvalid(
                [zeroDenominators, left.mask, right.mask])

            dataColumn = DataColumn(fieldType,
                                    NP("floor_divide", left.data, right.data),
                                    mask)

            performanceTable.end("built-in \"%s\"" % self.name)
            return dataColumn
示例#7
0
        def evaluate(self, dataTable, functionTable, performanceTable,
                     arguments):
            arguments = [
                x.evaluate(dataTable, functionTable, performanceTable)
                for x in arguments
            ]
            performanceTable.begin("built-in \"%s\"" % self.name)

            fieldType = self.fieldTypeFromSignature(arguments)
            test, low, high = arguments

            if test.fieldType.dataType == "object" or (
                    test.fieldType.dataType == "string"
                    and test.fieldType.optype == "continuous"
                    and low.fieldType.optype == "continuous"):
                ld = test.data
                rd = low.data
                data = NP("fromiter",
                          (ld[i] >= rd[i] for i in xrange(len(dataTable))),
                          dtype=fieldType.dtype,
                          count=len(dataTable))

            elif test.fieldType.dataType == "string":
                ld = test.data
                rd = low.data
                l2s = test.fieldType.valueToString
                r2s = low.fieldType.valueToString
                data = NP("fromiter", (l2s(ld[i]) >= r2s(rd[i])
                                       for i in xrange(len(dataTable))),
                          dtype=fieldType.dtype,
                          count=len(dataTable))

            else:
                data = NP("greater_equal", test.data, low.data)

            if test.fieldType.dataType == "object" or (
                    test.fieldType.dataType == "string"
                    and test.fieldType.optype == "continuous"
                    and high.fieldType.optype == "continuous"):
                ld = test.data
                rd = high.data
                datahigh = NP("fromiter",
                              (ld[i] <= rd[i] for i in xrange(len(dataTable))),
                              dtype=fieldType.dtype,
                              count=len(dataTable))

            elif test.fieldType.dataType == "string":
                ld = test.data
                rd = high.data
                l2s = test.fieldType.valueToString
                r2s = high.fieldType.valueToString
                datahigh = NP("fromiter", (l2s(ld[i]) <= r2s(rd[i])
                                           for i in xrange(len(dataTable))),
                              dtype=fieldType.dtype,
                              count=len(dataTable))

            else:
                datahigh = NP("less_equal", test.data, high.data)

            NP("logical_and", data, datahigh, data)

            performanceTable.end("built-in \"%s\"" % self.name)
            return DataColumn(
                fieldType, data,
                DataColumn.mapAnyMissingInvalid(
                    [test.mask, low.mask, high.mask]))
示例#8
0
        def evaluate(self, dataTable, functionTable, performanceTable, arguments):
            arguments = [x.evaluate(dataTable, functionTable, performanceTable) for x in arguments]
            performanceTable.begin("built-in \"%s\"" % self.name)

            fieldType = self.fieldTypeFromSignature(arguments)
            dataColumn = DataColumn(fieldType, NP("cos", arguments[0].data * arguments[1].data), DataColumn.mapAnyMissingInvalid([arguments[0].mask, arguments[1].mask]))

            performanceTable.end("built-in \"%s\"" % self.name)
            return dataColumn