Früher wurden diese Frequenzbänder per Auge beurteilt, wie geht das programmatisch?

Operatoren zur Untersuchung des Spektrums, Kenntnis des Ortes undBreite von jedem Peak das Stück beurteilen, zu dem das Spektrum gehört. Auf die neue Art und Weise wird das Bild von einer Kamera auf einem Bildschirm aufgenommen. Und die Breite jedes Bandes muss programmatisch berechnet werden.

Altes System: Spektroskop -> menschliches Auge Neues System: Spektroskop -> Kamera -> Programm

Was ist eine gute Methode, umBerechnen Sie die Breite jedes Bandesaufgrund ihrer ungefähren Position auf der X-Achse; da diese aufgabe früher perfekt von auge erledigt wurde und nun von programm erledigt werden muss?

Es tut mir leid, wenn mir die Details fehlen, aber sie sind rar.

Programmliste, die das vorherige Diagramm generiert hat; Ich hoffe es ist relevant:

import Image
from scipy import *
from scipy.optimize import leastsq

# Load the picture with PIL, process if needed
pic         = asarray(Image.open("spectrum.jpg"))

# Average the pixel values along vertical axis
pic_avg     = pic.mean(axis=2)
projection  = pic_avg.sum(axis=0)

# Set the min value to zero for a nice fit
projection /= projection.mean()
projection -= projection.min()

#print projection

# Fit function, two gaussians, adjust as needed
def fitfunc(p,x):
    return p[0]*exp(-(x-p[1])**2/(2.0*p[2]**2)) + \
        p[3]*exp(-(x-p[4])**2/(2.0*p[5]**2))
errfunc = lambda p, x, y: fitfunc(p,x)-y

# Use scipy to fit, p0 is inital guess
p0 = array([0,20,1,0,75,10])
X  = xrange(len(projection))
p1, success = leastsq(errfunc, p0, args=(X,projection))
Y = fitfunc(p1,X)

# Output the result
print "Mean values at: ", p1[1], p1[4]

# Plot the result
from pylab import *
#subplot(211)
#imshow(pic)
#subplot(223)
#plot(projection)
#subplot(224)
#plot(X,Y,'r',lw=5)
#show()

subplot(311)
imshow(pic)
subplot(312)
plot(projection)
subplot(313)
plot(X,Y,'r',lw=5)
show()

Antworten auf die Frage(3)

Ihre Antwort auf die Frage