31 lines
801 B
Python
31 lines
801 B
Python
from mathutils import fit_polynomial,fit_gaussian, fit_harmonic, calculate_peaks
|
|
|
|
#try:
|
|
# collimator.move("In")
|
|
#except:
|
|
# pass
|
|
|
|
shutter.write(1)
|
|
|
|
result = lscan (collimatorX, diode, -0.5, 0.5 , 100, 0, relative = True)
|
|
|
|
|
|
|
|
shutter.write(0)
|
|
|
|
y = result.getReadable(0)
|
|
x = result.getPositions(0)
|
|
(normalization, mean, sigma) = fit_gaussian(readable, positions, True)
|
|
fitted_gaussian_function = Gaussian(normalization, mean, sigma)
|
|
print (normalization, mean, sigma)
|
|
|
|
|
|
resolution = step_size/100
|
|
fit_gaussian = []
|
|
for x in frange(start,end,resolution, True):
|
|
fit_gaussian.append(fitted_gaussian_function.value(x))
|
|
gx = frange(start, end+resolution, resolution)
|
|
|
|
plots = plot([y, fit_gaussian], ["data", "gaussian"], xdata = [x,gx] )
|
|
plots[0].addMarker(mean, None, "Mean=" + str(round(mean,2)))
|