Commit 45e9c492 authored by Yan's avatar Yan
Browse files

More pythonic ZCE FWHM selection

parent 3aae324a
......@@ -31,17 +31,17 @@ def pop_dial(zcespec, gradspect, data_set, widget, coff_d, grad_d,
maxarg = np.argmax(grad_d['y'])
grad_d['gmax'] = coff_d['x'][maxarg]
climb = np.argsort(grad_d['y'][:maxarg])
fall = np.argsort(grad_d['y'][maxarg:]) + maxarg
halfmax = np.max(grad_d['y']) / 2
peakargs = np.where(grad_d['y'] > halfmax)[0]
start = [peakargs[0]-1, peakargs[0]]
end = [peakargs[-1]+1, peakargs[-1]]
grad_d['fwhm_y'] = [halfmax, halfmax]
grad_d['fwhm_x'] = [
np.interp(halfmax, grad_d['y'][climb], grad_d['x'][climb]),
np.interp(halfmax, grad_d['y'][fall], grad_d['x'][fall])]
np.interp(halfmax, grad_d['y'][start], grad_d['x'][start]),
np.interp(halfmax, grad_d['y'][end], grad_d['x'][end])]
grad_d['fwhm'] = grad_d['fwhm_x'][1] - grad_d['fwhm_x'][0]
gradspect.plot(grad_d['fwhm_x'], grad_d['fwhm_y'], "#880088")
textfield.setText(
"ZCE = {:.2f}\nFWHM = {:.2f}\nCenter(HM) = {:.2f}".format(
grad_d['gmax'], grad_d['fwhm'],
......@@ -50,7 +50,6 @@ def pop_dial(zcespec, gradspect, data_set, widget, coff_d, grad_d,
xy=(grad_d['fwhm_x'][1], grad_d['fwhm_y'][1]))
gradspect.annotate('{:.2f}'.format(grad_d['gmax']),
xy=(grad_d['x'][maxarg], grad_d['y'][maxarg]))
zcespec.figure.canvas.draw()
widget.show()
......
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