cf = CurveFitter(exposures, list(levels)) cf.doFit(CurveFitter.STRAIGHT_LINE) fitParams = cf.getParams() slope = fitParams[1] intercept = fitParams[0] rSqr = cf.getRSquared() print("slope=", slope, " ; intercept=", intercept, " ; rSquared=", rSqr) # Plot the data and the regression line newPlotFlags = Plot.TRIANGLE + Plot.X_GRID + Plot.X_NUMBERS + Plot.Y_GRID + Plot.Y_NUMBERS newPlot = Plot("DARK NOISE", "EXPOSURE, ms", "MEAN GRAY LEVEL", newPlotFlags) newPlot.setLineWidth(2) newPlot.setColor("red") newPlot.add("triangle", exposures, list(levels)) newPlot.setLineWidth(1) newPlot.setColor("black") newPlot.drawLine(exposures[0], cf.f(exposures[0]), exposures[-1], cf.f(exposures[-1])) newPlot.setColor("blue") newPlot.setFontSize(20) newPlot.addText("y = a+bx", 100.0, 13000.0) newPlot.addText("a = " + str(round(intercept, 2)), 100.0, 12250.0) newPlot.addText("b = " + str(round(slope, 2)), 100.0, 11500.0) newPlot.addText("R squared = " + str(round(rSqr, 3)), 100.0, 10750.0) newPlot.show() # Place the plot data into a ResultsTable rt = newPlot.getResultsTable() rt.show("Dark Noise Results")