Commit c3cdfb7a authored by Gustavo Pinzon's avatar Gustavo Pinzon
Browse files

Modifications to findHistogramPeaks

parent 7a2c07da
Pipeline #66190 passed with stages
in 26 minutes and 13 seconds
......@@ -130,25 +130,23 @@ def findHistogramPeaks(image, valley1=20000, valley2=[], phases=2, gaussianFit=F
peakPhases = numpy.array([peakPhase1,peakPhase2])
fig = plt.figure(1)
plt.plot(totalgreylevel,totalCounts,label="Histogram")
if showGraph == True:
fig = plt.figure(1)
plt.plot(totalgreylevel,totalCounts,label="Histogram")
plt.plot(peakPhase1,countsPhase1[countsPhase1==countsPhase1.max()],"ro",label="Peak Phase 1 @ {:5.0f}".format(float(peakPhase1)))
plt.plot(peakPhase2,countsPhase2[countsPhase2==countsPhase2.max()],"yo",label="Peak Phase 2 @ {:5.0f}".format(float(peakPhase2)))
plt.xlabel("Greylevel")
plt.ylabel("Counts")
plt.plot(peakPhase1,countsPhase1[countsPhase1==countsPhase1.max()],"ro",label="Peak Phase 1 @ {:5.0f}".format(float(peakPhase1)))
plt.plot(peakPhase2,countsPhase2[countsPhase2==countsPhase2.max()],"yo",label="Peak Phase 2 @ {:5.0f}".format(float(peakPhase2)))
plt.xlabel("Greylevel")
plt.ylabel("Counts")
if gaussianFit:
plt.plot(totalgreylevel[startIndex1:stopIndex1], gauss(totalgreylevel[startIndex1:stopIndex1], a1, peakPhase1, sigmaPhase1, offset1), label='Fit 1')
plt.plot(totalgreylevel[startIndex2:stopIndex2], gauss(totalgreylevel[startIndex2:stopIndex2], a2, peakPhase2, sigmaPhase2, offset2), label='Fit 2')
if gaussianFit:
plt.plot(totalgreylevel[startIndex1:stopIndex1], gauss(totalgreylevel[startIndex1:stopIndex1], a1, peakPhase1, sigmaPhase1, offset1), label='Fit 1')
plt.plot(totalgreylevel[startIndex2:stopIndex2], gauss(totalgreylevel[startIndex2:stopIndex2], a2, peakPhase2, sigmaPhase2, offset2), label='Fit 2')
plt.legend()
fig.tight_layout()
if saveFigPath is not None:
plt.savefig(saveFigPath)
if showGraph == True:
plt.show()
plt.legend()
fig.tight_layout()
if saveFigPath is not None:
plt.savefig(saveFigPath)
plt.close()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment