当前位置: 首页>>代码示例>>Python>>正文


Python SSUtilities.outputTextTable方法代码示例

本文整理汇总了Python中SSUtilities.outputTextTable方法的典型用法代码示例。如果您正苦于以下问题:Python SSUtilities.outputTextTable方法的具体用法?Python SSUtilities.outputTextTable怎么用?Python SSUtilities.outputTextTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SSUtilities的用法示例。


在下文中一共展示了SSUtilities.outputTextTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def report(self):
        """Reports the results from exploratory regression analysis."""

        #### Set Title ####
        title = self.label

        #### Column Labels ####
        labs = [ARCPY.GetIDMessage(84021), ARCPY.GetIDMessage(84249),
                ARCPY.GetIDMessage(84042), ARCPY.GetIDMessage(84036),
                ARCPY.GetIDMessage(84284), ARCPY.GetIDMessage(84292),
                ARCPY.GetIDMessage(84286)]
        r2Info = [ labs ]

        #### Adjusted R2, Sorted Highest to Lowest with ID Tie Breaks ####
        header = ARCPY.GetIDMessage(84287)
        numRes = UTILS.ssRange(len(self.bestR2Res))
        r2Data = []
        for i in numRes:
            r2Val = self.bestR2Vals[i]
            idVal = int(self.bestR2Res[i].split(":")[-1])
            r2Data.append((r2Val, idVal))
        r2Data = NUM.array(r2Data, dtype = [('r2', float), ('ids', int)])
        r2SortedInds = r2Data.argsort(order = ('r2', 'ids'))
        sortIndex = reversed(r2SortedInds)
        for ind in sortIndex:
            olsID = self.bestR2Res[ind]
            olsRes = self.olsResults[olsID]
            olsOut = olsRes.report(formatStr = "%0.2f")
            r2Info.append(olsOut)

        r2Report = UTILS.outputTextTable(r2Info, header = header,
                                         justify = masterJustify)

        #### Passing Models ####
        header = ARCPY.GetIDMessage(84288)
        passList = [ labs ]
        r2Values = []
        olsIDs = []
        for olsID in self.passBools:
            olsRes = self.olsResults[olsID]
            r2Values.append(olsRes.r2)
            olsIDs.append(olsID)
        sortIndex = NUM.argsort(r2Values).tolist()
        sortIndex.reverse()
        for ind in sortIndex:
            olsID = olsIDs[ind]
            olsRes = self.olsResults[olsID]
            olsOut = olsRes.report(formatStr = "%0.6f")
            passList.append(olsOut)

        passingReport = UTILS.outputTextTable(passList, header = header)

        #### Print Report ####
        starMess = ARCPY.GetIDMessage(84289) * 78
        finalReport = [starMess, title, r2Report, passingReport]
        finalReport = "\n".join(finalReport)
        finalReport = finalReport + "\n"
        ARCPY.AddMessage(finalReport)

        return finalReport
开发者ID:f-tonini,项目名称:Python-Scripts,代码行数:62,代码来源:ModelSelectionOLS.py

示例2: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def report(self, fileName = None):
        """Reports the Median Center results as a message or to a file.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results
        """

        header = ARCPY.GetIDMessage(84190)
        columns = [ARCPY.GetIDMessage(84191), ARCPY.GetIDMessage(84192), 
                   ARCPY.GetIDMessage(84193)]
        if self.attFields:
            for attField in self.attFields:
                columns.append(ARCPY.GetIDMessage(84194).format(attField))
        results = [ columns ]
        for case in self.uniqueCases:
            if not self.caseField:
                strCase = "ALL"
            else:
                strCase = UTILS.caseValue2Print(case, self.caseIsString)
            medX, medY = self.medianCenter[case]
            rowResult = [ strCase, LOCALE.format("%0.6f", medX),
                          LOCALE.format("%0.6f", medY) ]
            if self.attFields:
                for attInd, attField in enumerate(self.attFields):
                    medAtt = self.attCenter[case][attInd]
                    rowResult.append(LOCALE.format("%0.6f", medAtt))
            results.append(rowResult)

        outputTable = UTILS.outputTextTable(results, header = header)
        if fileName:
            f = open(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:37,代码来源:MedianCenter.py

示例3: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def report(self, fileName = None):
        """Reports the Standard Distance results as a message or to a file.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results
        """

        header = ARCPY.GetIDMessage(84224)
        columns = [ARCPY.GetIDMessage(84191), ARCPY.GetIDMessage(84211),
                   ARCPY.GetIDMessage(84212), ARCPY.GetIDMessage(84225),
                   ARCPY.GetIDMessage(84226)]
        results = [columns]
        for case in self.uniqueCases:
            if not self.caseField:
                strCase = "ALL"
            else:
                strCase = UTILS.caseValue2Print(case, self.caseIsString)
            meanX, meanY = self.meanCenter[case]
            rowResult = [ strCase, LOCALE.format("%0.6f", meanX),
                          LOCALE.format("%0.6f", meanY),
                          LOCALE.format("%0.6f", self.sd[case]),
                          LOCALE.format("%0.1f", self.stdDeviations) ]
            results.append(rowResult)

        outputTable = UTILS.outputTextTable(results, header = header)
        if fileName:
            f = UTILS.openFile(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:33,代码来源:StandardDistance.py

示例4: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def report(self, fileName = None):
        """Reports the Central Feature results as a message or to a file.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results.
        """

        header = ARCPY.GetIDMessage(84200)
        columns = [ARCPY.GetIDMessage(84191), ARCPY.GetIDMessage(84201), 
                   ARCPY.GetIDMessage(84202)]
        results = [ columns ]
        for case in self.uniqueCases:
            if not self.caseField:
                strCase = "ALL"
            else:
                strCase = UTILS.caseValue2Print(case, self.caseIsString)
            cfOIDs, minSumDist = self.cf[case]
            cfOIDs = [ str(i) for i in cfOIDs ]
            cfOIDs = ", ".join(cfOIDs)
            rowResult = [ strCase, 
                          cfOIDs,
                          LOCALE.format("%0.6f", minSumDist) ]
            results.append(rowResult)

        outputTable = UTILS.outputTextTable(results, header = header)
        if fileName:
            f = UTILS.openFile(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:33,代码来源:CentralFeature.py

示例5: createInterpretReport

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def createInterpretReport(self):
        """Creates the interpretation table for OLS."""

        #### Generate Interpretation Table #####
        header =  ARCPY.GetIDMessage(84081)

        #### Set up Rows in Tables ####
        decimalSep = UTILS.returnDecimalChar()
        if decimalSep == ".":
            pValue = "0.01"
            VIF = "7.5"
        else:
            pValue = "0,01"
            VIF = "7,5"

        significance = [ARCPY.GetIDMessage(84111), ARCPY.GetIDMessage(84082).format(pValue)]
        coefficient = [ARCPY.GetIDMessage(84080), ARCPY.GetIDMessage(84349)]
        probs = [ARCPY.GetIDMessage(84086), ARCPY.GetIDMessage(84350).format(pValue)]
        multicoll = [ARCPY.GetIDMessage(84103), ARCPY.GetIDMessage(84083).format(VIF)]
        rSquared = [ARCPY.GetIDMessage(84104), ARCPY.GetIDMessage(84084)]
        jointFW = [ARCPY.GetIDMessage(84105), ARCPY.GetIDMessage(84085).format(pValue)]
        bpRow = [ARCPY.GetIDMessage(84106), ARCPY.GetIDMessage(84087).format(pValue)]
        jbRow = [ARCPY.GetIDMessage(84107), ARCPY.GetIDMessage(84088).format(pValue)]

        #### Finalize Interpretation Table ####
        intTotal = [significance, coefficient, probs, multicoll,
                    rSquared, jointFW, bpRow, jbRow]

        body = UTILS.outputTextTable(intTotal, pad = 1,
                                     justify = ["center", "left"])
        self.interpretTable = "\n%s%s" % (header, body)
        self.interpretRaw = intTotal
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:34,代码来源:OLS.py

示例6: printWeightAnswer

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
def printWeightAnswer(y):
    """Describes the Weight/Analysis/Count Field."""

    minY = y.min()
    maxY = y.max()
    avgY = y.mean()
    stdY = y.std()

    minStr = ARCPY.GetIDMessage(84271) + ":"
    maxStr = ARCPY.GetIDMessage(84272) + ":"
    avgStr = ARCPY.GetIDMessage(84261) + ":"
    stdStr = ARCPY.GetIDMessage(84262) + ":"
    padStr = " " * 7

    minString = LOCALE.format("%0.4f", minY)
    maxString = LOCALE.format("%0.4f", maxY)
    avgString = LOCALE.format("%0.4f", avgY)
    stdString = LOCALE.format("%0.4f", stdY)
    row1 = [padStr, minStr, minString]
    row2 = [padStr, maxStr, maxString]
    row3 = [padStr, avgStr, avgString]
    row4 = [padStr, stdStr, stdString]
    results =  [row1, row2, row3, row4]
    outputTable = UTILS.outputTextTable(results, pad = 1,
                     justify = ['left', 'left', 'right'])

    ARCPY.AddMessage(outputTable)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:29,代码来源:OptimizedHotSpotAnalysis.py

示例7: createCoefficientReport

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def createCoefficientReport(self):
        """Creates a formatted summary table of the OLS
        coefficients."""

        #### Table Title ####
        header =  ARCPY.GetIDMessage(84075)
        aFoot = ARCPY.GetIDMessage(84080)
        bFoot = ARCPY.GetIDMessage(84086)
        cFoot = ARCPY.GetIDMessage(84103)
        coefColLab = ARCPY.GetIDMessage(84049) + " " + aFoot
        probColLab = ARCPY.GetIDMessage(84055) + " " + bFoot
        robColLab = ARCPY.GetIDMessage(84102) + " " + bFoot
        vifColLab = ARCPY.GetIDMessage(84284) + " " + cFoot

        #### Column Labels ####
        total = [[ARCPY.GetIDMessage(84068), coefColLab,
                  ARCPY.GetIDMessage(84051), ARCPY.GetIDMessage(84053),
                  probColLab, ARCPY.GetIDMessage(84097),
                  ARCPY.GetIDMessage(84101), robColLab]]

        if self.vif:
            total[0].append(vifColLab)

        #### Loop Through Explanatory Variables ####
        for row in xrange(self.k):
            #### Variable Name ####
            rowVals = [self.varLabels[row]]

            #### Standard Values ####
            rowVals.append(UTILS.formatValue(self.coef[row, 0]))
            rowVals.append(UTILS.formatValue(self.seCoef[row]))
            rowVals.append(UTILS.formatValue(self.tStats[row]))
            rowVals.append(UTILS.writePVal(self.pVals[row], padNonSig = True))

            #### Robust Values ####
            rowVals.append(UTILS.formatValue(self.seCoefRob[row]))
            rowVals.append(UTILS.formatValue(self.tStatsRob[row]))
            rowVals.append(UTILS.writePVal(self.pValsRob[row],
                                           padNonSig = True))

            #### VIF ####
            if self.vif:
                if row == 0:
                    rowVIF = ARCPY.GetIDMessage(84092)
                else:
                    rowVIF = self.vifVal[(row - 1)]
                    if abs(rowVIF) > 1000:
                        rowVIF = "> 1000.0"
                    else:
                        rowVIF = LOCALE.format("%0.6f", rowVIF)
                rowVals.append(rowVIF)

            #### Append Row to Result List ####
            total.append(rowVals)

        #### Finalize Coefficient Table ####
        self.coefTable = UTILS.outputTextTable(total, header = header,
                                               pad = 1, justify = "right")
        self.coefRaw = total
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:61,代码来源:OLS.py

示例8: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def report(self, fileName = None):
        """Reports the Moran's I results as a message or to a file.  If
        self.displayIt is set to True, then an html graphical report is
        generated to your default temp directory.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results.
        """

        #### Create Output Text Table ####
        header = ARCPY.GetIDMessage(84160)
        giString = LOCALE.format("%0.6f", self.gi)
        eiString = LOCALE.format("%0.6f", self.ei)
        viString = LOCALE.format("%0.6f", self.vi) 
        ziString = LOCALE.format("%0.6f", self.zi) 
        pvString = LOCALE.format("%0.6f", self.pVal) 
        row1 = [ARCPY.GetIDMessage(84148), giString]
        row2 = [ARCPY.GetIDMessage(84149), eiString]
        row3 = [ARCPY.GetIDMessage(84150), viString]
        row4 = [ARCPY.GetIDMessage(84151), ziString]
        row5 = [ARCPY.GetIDMessage(84152), pvString]
        results =  [row1, row2, row3, row4, row5]
        outputTable = UTILS.outputTextTable(results, header = header,
                                            pad = 1)

        #### Add Linear/Angular Unit ####
        if self.wType in [0, 1, 7]:
            distanceOut = self.ssdo.distanceInfo.outputString
            dmsg = ARCPY.GetIDMessage(84344)
            distanceMeasuredStr = dmsg.format(distanceOut)
            outputTable += "\n%s\n" % distanceMeasuredStr

        #### Write/Report Text Output ####
        if fileName:
            f = UTILS.openFile(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)

        #### Set Formatted Floats ####
        self.giString = giString
        self.eiString = eiString
        self.viString = viString
        self.ziString = ziString
        self.pvString = pvString
        
        return giString, ziString, pvString
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:50,代码来源:MoransI.py

示例9: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def report(self, fileName = None):
        """Reports the General G results as a message or to a file.  If
        self.displayIt is set to True, then an html graphical report is
        generated to your default temp directory.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results.
        """

        #### Format Output ####
        observedOut = LOCALE.format("%0.6f", self.nn)
        expectedOut = LOCALE.format("%0.6f", self.en)
        ratioOut = LOCALE.format("%0.6f", self.ratio)
        zValueOut = LOCALE.format("%0.6f", self.zn)
        pValOut = LOCALE.format("%0.6f", self.pVal)

        #### Create Output Text Table ####
        header = ARCPY.GetIDMessage(84161)
        row1 = [ ARCPY.GetIDMessage(84162), observedOut ]
        row2 = [ ARCPY.GetIDMessage(84163), expectedOut ]
        row3 = [ ARCPY.GetIDMessage(84164), ratioOut ]
        row4 = [ ARCPY.GetIDMessage(84151), zValueOut ]
        row5 = [ ARCPY.GetIDMessage(84152), pValOut ]
        total = [row1,row2,row3,row4,row5]
        outputTable = UTILS.outputTextTable(total, header = header, pad = 1)
        distanceOut = self.ssdo.distanceInfo.outputString
        dmsg = ARCPY.GetIDMessage(84344)
        distanceMeasuredStr = dmsg.format(distanceOut)
        outputTable += "\n%s\n" % distanceMeasuredStr

        if fileName:
            f = UTILS.openFile(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)

        #### Set Formatted Floats ####
        self.nnString = observedOut
        self.enString = expectedOut
        self.ratioString = ratioOut
        self.znString = zValueOut
        self.pvString = pValOut
        self.nnStringD = self.ssdo.distanceInfo.printDistance(self.nn)
        self.enStringD = self.ssdo.distanceInfo.printDistance(self.en)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:47,代码来源:NearestNeighbor.py

示例10: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def report(self, fileName = None):
        """Reports Field Information.

        INPUTS:
        fileName {str, None}: path to report text file
        """

        header = "Candidate Field Description"
        row1 = ["Field Name: ", self.name]
        row2 = ["Field Type: ", self.type]
        row3 = ["Field Alias: ", str(self.alias)]
        row4 = ["Field Length: ", str(self.length)]
        results =  [row1, row2, row3, row4]
        outputTable = UTILS.outputTextTable(results, header = header)
        if fileName:
            f = UTILS.openFile(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:22,代码来源:SSDataObject.py

示例11: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def report(self, fileName = None):
        """Reports the k-function results as a message or to a file.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results.
        """
        header = ARCPY.GetIDMessage(84185)
        columns = [ARCPY.GetIDMessage(84342), ARCPY.GetIDMessage(84180), 
                   ARCPY.GetIDMessage(84181)]
        if self.permutations:
            columns += [ARCPY.GetIDMessage(84182), ARCPY.GetIDMessage(84183)]
        results = [columns]
        for testIter in range(self.nIncrements):
            dist = self.cutoffs[testIter]
            ldVal = self.ld[testIter]
            diff = ldVal - dist
            rowResults = [ LOCALE.format("%0.2f", round(dist, 2)),
                           LOCALE.format("%0.2f", round(ldVal, 2)),
                           LOCALE.format("%0.2f", round(diff, 2)) ]
            if self.permutations:
                minVal = round(self.ldMin[testIter], 2)
                maxVal = round(self.ldMax[testIter], 2)
                rowResults.append(LOCALE.format("%0.2f", minVal))
                rowResults.append(LOCALE.format("%0.2f", maxVal))

            results.append(rowResults)

        outputTable = UTILS.outputTextTable(results, header = header)
        distanceOut = self.ssdo.distanceInfo.outputString
        distanceMeasuredStr = ARCPY.GetIDMessage(84343).format(distanceOut)
        outputTable += "\n%s" % distanceMeasuredStr
        if fileName:
            f = UTILS.openFile(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:39,代码来源:KFunction.py

示例12: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def report(self, fileName = None):
        """Reports the Moran's I results as a message or to a file.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results.
        """

        header = ARCPY.GetIDMessage(84160) + ARCPY.GetIDMessage(84282)
        results = [ self.resLabels ]
        hasNoNeighs = self.noNeighs.any()
        strNoNeighs = ARCPY.GetIDMessage(84111)

        #### Create Output Text Table ####
        for testIter in range(self.nIncrements):
            d, gi, ei, vi, zi, pv = self.giResults[testIter]
            d = LOCALE.format("%0.2f", round(d, 2))
            gi = LOCALE.format("%0.6f", gi)
            ei = LOCALE.format("%0.6f", ei)
            vi = LOCALE.format("%0.6f", vi)
            zi = LOCALE.format("%0.6f", zi)
            pv = LOCALE.format("%0.6f", pv)

            #### Add Asterisk to No Neigh Distances ####
            if hasNoNeighs:
                numNoNeighs = self.noNeighs[testIter]
                if numNoNeighs:
                    d += strNoNeighs
                else:
                    d += " "
            res = [d, gi, ei, vi, zi, pv]
            results.append(res)

        outputReport = UTILS.outputTextTable(results, header = header,
                                             justify = "right", pad = 1)

        #### Report Peaks ####
        firstPeakMess = ARCPY.GetIDMessage(84419)
        decimalSep = UTILS.returnDecimalChar()
        if decimalSep == ".":
            numSep = ","
        else:
            numSep = ";"
        if self.firstPeakInd != None:

            zi = LOCALE.format("%0.6f", self.giResults[self.firstPeakInd,4])
            d = LOCALE.format("%0.2f", round(self.firstPeakDistance, 2))

            firstPeakMess = firstPeakMess.format(d, numSep, zi)
        else:
            firstPeakMess = firstPeakMess.format("None", numSep, "None")
        outputReport += "\n" + firstPeakMess + "\n"

        maxPeakMess = ARCPY.GetIDMessage(84420)
        if self.maxPeakInd != None:
            zi = LOCALE.format("%0.6f", self.giResults[self.maxPeakInd,4])
            d = LOCALE.format("%0.2f", round(self.maxPeakDistance, 2))
            maxPeakMess = maxPeakMess.format(d, numSep, zi)
        else:
            maxPeakMess = maxPeakMess.format("None", numSep,"None")
        outputReport += maxPeakMess

        #### Add Linear/Angular Unit ####
        distanceOut = self.ssdo.distanceInfo.outputString
        dmsg = ARCPY.GetIDMessage(84344)
        distanceMeasuredStr = dmsg.format(distanceOut)
        outputReport += "\n%s\n" % distanceMeasuredStr

        if fileName:
            if hasNoNeighs:
                noNeighMess = ARCPY.GetIDMessage(84417) + "\n"
                outputReport += noNeighMess
            f = UTILS.openFile(fileName, "w")
            f.write(outputReport)
            f.close()
        else:
            ARCPY.AddMessage(outputReport)
            if hasNoNeighs:
                ARCPY.AddIDMessage("WARNING", 1532)

        return outputReport
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:82,代码来源:MoransI_Increment.py

示例13: setupLogit

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
def setupLogit():
    #### Get User Provided Inputs ####
    inputFC = ARCPY.GetParameterAsText(0)    
    outputFC = ARCPY.GetParameterAsText(1) 
    depVarName = str(ARCPY.GetParameterAsText(2))
    indVarNames = ARCPY.GetParameterAsText(3) 
    indVarNames = [ str(i) for i in indVarNames.split(";") ]
    indVarNames = ";".join(indVarNames)
    usePenalty = ARCPY.GetParameterAsText(4) 
    if usePenalty == 'true':
        usePenalty = "1"
    else:
        usePenalty = "0"

    coefTableIn = ARCPY.GetParameterAsText(5) 
    coefTable, dbf = UTILS.returnTableName(coefTableIn)

    diagTableIn = ARCPY.GetParameterAsText(6) 
    diagTable, dbf = UTILS.returnTableName(diagTableIn)

    #### Create R Command ####
    pyScript = SYS.argv[0]
    toolDir = OS.path.dirname(pyScript)
    rScript = OS.path.join(toolDir, "logitWithR.r")
    ARCPY.SetProgressor("default", "Executing R Script...")
    args = ["R", "--slave", "--vanilla", "--args",
            inputFC, outputFC, depVarName, indVarNames, 
            usePenalty, coefTable, diagTable]

    #### Uncomment Next Two Lines to Print/Create Command Line Args ####
    #cmd = RARC.createRCommand(args, rScript)
    #ARCPY.AddWarning(cmd)

    #### Execute Command ####
    scriptSource = open(rScript, 'rb')
    rCommand = SUB.Popen(args, 
                         stdin = scriptSource,
                         stdout = SUB.PIPE, 
                         stderr = SUB.PIPE,
                         shell=True)

    #### Print Result ####
    resString, errString = rCommand.communicate()

    #### Push Output to Message Window ####
    if errString and "Calculations Complete..." not in resString:
        ARCPY.AddError(errString)
    else:
        resOutString = RARC.printRMessages(resString)
        ARCPY.AddMessage(resOutString)

        #### Project the Data ####
        DM.DefineProjection(outputFC, inputFC)

        #### Create SSDO ####
        ssdo = SSDO.SSDataObject(outputFC)

        #### Display Symbology ####
        params = ARCPY.gp.GetParameterInfo()
        try:
            renderType = UTILS.renderType[ssdo.shapeType.upper()]
            if renderType == 0:
                renderLayerFile = "StdResidPoints.lyr"
            elif renderType == 1:
                renderLayerFile = "StdResidPolylines.lyr"
            else:
                renderLayerFile = "StdResidPolygons.lyr"
            fullRLF = OS.path.join(ARCPY.GetInstallInfo()['InstallDir'], 
                                   "ArcToolbox", "Templates", "Layers",
                                   renderLayerFile)
            params[1].Symbology = fullRLF 
        except:
            ARCPY.AddIDMessage("WARNING", 973)

        #### Print Coef Output Table ####
        try:
            rows = ARCPY.SearchCursor(coefTable)
        except:
            ARCPY.AddIDMessage("ERROR", 204)
            raise ERROR.ScriptError()

        labels = ["Variable", "Coef", "StdError", "Wald", "Prob"]
        header = "Logistic Regression Coefficient Table"
        res = [ labels ]
        for row in rows:
            rowRes = []
            for i, val in enumerate(labels):
                if i == 0:
                    rowRes.append(row.getValue(val))
                else:
                    rowRes.append(LOCALE.format("%0.6f", row.getValue(val)))
            res.append(rowRes)
        del rows

        coefTextTab = UTILS.outputTextTable(res, header = header)
        ARCPY.AddMessage("\n")
        ARCPY.AddMessage(coefTextTab)

        #### Add to TOC ####
        ARCPY.SetParameterAsText(5, coefTable)
#.........这里部分代码省略.........
开发者ID:MCSQRD,项目名称:R-toolbox-py,代码行数:103,代码来源:LogitWithR.py

示例14: endSummary

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def endSummary(self):
        """Creates End Summary for Report File."""

        #### Passing Model Global Summary ####
        passHeader = ARCPY.GetIDMessage(84294)
        emptyValue = ARCPY.GetIDMessage(84092)
        perfectMultiStr = ARCPY.GetIDMessage(84368)
        perfectInterStr = ARCPY.GetIDMessage(84369)
        perfectInterStr += " (%s)" % LOCALE.format("%0.2f", 100)

        passResults = [ [ARCPY.GetIDMessage(84295),
                         ARCPY.GetIDMessage(84296),
                         ARCPY.GetIDMessage(84297),
                         ARCPY.GetIDMessage(84298),
                         ARCPY.GetIDMessage(84299)] ]

        cutoffList = [ "> " + UTILS.formatValue(self.minR2, "%0.2f"),
                       "< " + UTILS.formatValue(self.maxCoef, "%0.2f"),
                       "< " + UTILS.formatValue(self.maxVIF, "%0.2f"),
                       "> " + UTILS.formatValue(self.minJB, "%0.2f"),
                       "> " + UTILS.formatValue(self.minMI, "%0.2f") ]

        categories = [ARCPY.GetIDMessage(84300), ARCPY.GetIDMessage(84301),
                      ARCPY.GetIDMessage(84302), ARCPY.GetIDMessage(84303),
                      ARCPY.GetIDMessage(84304)]

        boolPerc = [ returnPerc(i, self.sumRuns) for i in self.boolResults ]
        boolPerc.append( returnPerc(self.sumMoranPass, self.sumMoranRuns) )
        boolOut = list(self.boolResults) + [self.sumMoranPass]
        sumOut = [ self.sumRuns for i in self.boolResults ]
        sumOut += [self.sumMoranRuns]

        for ind, category in enumerate(categories):
            outValue = LOCALE.format("%0.2f", boolPerc[ind])
            outCutoff = cutoffList[ind]
            outTrial = sumOut[ind]
            outCount = boolOut[ind]
            passResults.append( [category, outCutoff, outTrial,
                                 outCount, outValue] )

        self.passReport = UTILS.outputTextTable(passResults,
                                        header = passHeader,
                                        pad = 1, justify = "right")

        ##### Variable Significance and VIF Reports ####
        ##### Create Table Headers ####
        signHeader = ARCPY.GetIDMessage(84305)
        vifHeader = ARCPY.GetIDMessage(84306)

        #### Create Column Labels and Result Lists ####
        signColInfo = [ [ARCPY.GetIDMessage(84068), ARCPY.GetIDMessage(84307),
                         ARCPY.GetIDMessage(84366), ARCPY.GetIDMessage(84367)] ]
        signResults = []
        vifResults = [ [ARCPY.GetIDMessage(84068), ARCPY.GetIDMessage(84284),
                        ARCPY.GetIDMessage(84308), ARCPY.GetIDMessage(84309)] ]

        ##### Get Covariate Total ####
        percVarRes = []
        totalTogether = 0
        for resultKey, result in UTILS.iteritems(self.resultDict):
            totalTogether += result.eachAppears

        ##### Populate Result Lists ####
        for ind, varName in enumerate(self.independentVars):
            totalNeg = 0
            totalPos = 0
            totalSign = 0
            totalRan = 0
            totalViolations = 0
            totalCovariates = COLL.defaultdict(int)
            for resultKey, result in UTILS.iteritems(self.resultDict):
                #### Significance Results ####
                numRan, numSign = result.signDict[varName]
                totalSign += numSign
                totalRan += numRan
                numNeg, numPos = result.varSignDict[varName]
                totalNeg += numNeg
                totalPos += numPos

                #### VIF Results ####
                numViolate, covariates = result.vifDict[varName]
                totalViolations += numViolate
                for covariate in covariates:
                    if covariate != varName:
                        totalCovariates[covariate] += 1

            #### Add Perfect Multicollinearity Results * ####
            successfulRun = totalRan > 0

            #### Complete Significance Row ####
            if successfulRun:
                percentSign = ((totalSign * 1.0) / totalRan) * 100.0
                percentNeg = ((totalNeg * 1.0) / totalRan) * 100.0
                percentPos = ((totalPos * 1.0) / totalRan) * 100.0
                rowRes = [varName, LOCALE.format("%0.2f", percentSign),
                          LOCALE.format("%0.2f", percentNeg),
                          LOCALE.format("%0.2f", percentPos)]
            else:
                percentSign = -1.0
                rowRes = [varName, emptyValue, emptyValue, emptyValue]
#.........这里部分代码省略.........
开发者ID:f-tonini,项目名称:Python-Scripts,代码行数:103,代码来源:ModelSelectionOLS.py

示例15: createDiagnosticReport

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import outputTextTable [as 别名]
    def createDiagnosticReport(self):
        """Creates a formatted summary table of the OLS
        diagnostics."""

        #### Create PValue Array ####
        allPVals = NUM.array( [self.fProb, self.waldProb,
                               self.BPProb, self.JBProb] )

        #### Check For Any Significance for Extra Padding ####
        signFlag = NUM.any(allPVals <= 0.05)

        #### Table Title ####
        header = ARCPY.GetIDMessage(84076)
        feet = [84104, 84105, 84106, 84107]
        feet = [ ARCPY.GetIDMessage(i) for i in feet ]
        dFoot, eFoot, fFoot, gFoot = feet
        dFoot = ARCPY.GetIDMessage(84104)

        row1 = [UTILS.addColon(ARCPY.GetIDMessage(84253)),
                self.ssdo.inName,
                '  ' + UTILS.addColon(ARCPY.GetIDMessage(84254)),
                UTILS.padValue(self.depVarName, significant = signFlag)]

        aiccLab = ARCPY.GetIDMessage(84251) + " " + dFoot
        row2 = [UTILS.addColon(ARCPY.GetIDMessage(84093)),
                str(self.n), '  ' + UTILS.addColon(aiccLab),
                UTILS.padValue(UTILS.formatValue(self.aicc),
                               significant = signFlag)]

        r2Lab = ARCPY.GetIDMessage(84019) + " " + dFoot
        adjR2Lab = ARCPY.GetIDMessage(84022) + " " + dFoot
        row3 = [UTILS.addColon(r2Lab), UTILS.formatValue(self.r2),
                '  ' + UTILS.addColon(adjR2Lab),
                UTILS.padValue(UTILS.formatValue(self.r2Adj),
                               significant = signFlag)]

        fdofLab = ARCPY.GetIDMessage(84028)
        fLab = ARCPY.GetIDMessage(84025) + " " + eFoot
        row4 = [UTILS.addColon(fLab), UTILS.formatValue(self.fStat),
                "  " + UTILS.addColon(fdofLab.format(self.q, self.dof)),
                UTILS.writePVal(self.fProb, padNonSig = True)]

        chiMess = ARCPY.GetIDMessage(84034)
        wLab = ARCPY.GetIDMessage(84031) + " " + eFoot
        row5 = [UTILS.addColon(wLab), UTILS.formatValue(self.waldStat),
                "  " + UTILS.addColon(chiMess.format(self.q)),
                UTILS.writePVal(self.waldProb, padNonSig = True)]

        kLab = ARCPY.GetIDMessage(84037) + " " + fFoot
        row6 = [UTILS.addColon(kLab), UTILS.formatValue(self.BP),
                '  '+ UTILS.addColon(chiMess.format(self.q)),
                UTILS.writePVal(self.BPProb, padNonSig = True)]

        jbLab = ARCPY.GetIDMessage(84043) + " " + gFoot
        row7 = [UTILS.addColon(jbLab), UTILS.formatValue(self.JB),
                '  '+ UTILS.addColon(chiMess.format(2)),
                UTILS.writePVal(self.JBProb, padNonSig = True)]

        #### Finalize Diagnostic Table ####
        diagTotal = [ row1, row2, row3, row4, row5, row6, row7 ]
        diagJustify = ["left", "right", "left", "right"]

        self.diagTable = UTILS.outputTextTable(diagTotal,
                                header = header, pad = 1,
                                justify = diagJustify)
        self.diagRaw = diagTotal
        self.diagJustify = diagJustify
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:69,代码来源:OLS.py


注:本文中的SSUtilities.outputTextTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。