50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
import ch.psi.utils.swing.SwingUtils as SwingUtils
|
|
import ch.psi.pshell.device.HistogramGenerator as HistogramGenerator
|
|
import ch.psi.pshell.swing.HistogramGeneratorPanel as HistogramGeneratorPanel
|
|
from collections import OrderedDict
|
|
import javax.swing.border.TitledBorder as TitledBorder
|
|
import javax.swing.JPanel as JPanel
|
|
import javax.swing.BoxLayout as BoxLayout
|
|
import java.awt.Dimension as Dimension
|
|
|
|
CHANNELS = ["intensity",
|
|
"x_center_of_mass",
|
|
"x_fwhm",
|
|
"x_rms",
|
|
"x_fit_amplitude",
|
|
"x_fit_mean",
|
|
"x_fit_offset",
|
|
"x_fit_standard_deviation",
|
|
"x_profile"
|
|
]
|
|
|
|
samples = 100
|
|
range_min, range_max = float('nan'),float('nan')
|
|
bins = 100
|
|
|
|
panels = OrderedDict()
|
|
|
|
cam_server.start(CAMERA_NAME + "_sp", True) #Start or connect to ScreenPanel pipeline
|
|
cam_server.stream.waitCacheChange(2000)
|
|
|
|
for channel in CHANNELS:
|
|
dev = cam_server.stream.getChild(channel)
|
|
hist = HistogramGenerator(CAMERA_NAME + ":" + channel, dev, samples, range_min, range_max, bins)
|
|
hist.monitored=True
|
|
add_device(hist, True)
|
|
pn = HistogramGeneratorPanel()
|
|
pn.border=TitledBorder(hist.name)
|
|
pn.setShowTitle(True)
|
|
pn.setDevice(hist)
|
|
pn.setPreferredSize(Dimension(800,150))
|
|
panels[hist.name]=pn
|
|
|
|
pn = JPanel()
|
|
pn.layout = BoxLayout(pn, BoxLayout.Y_AXIS)
|
|
for k in panels.keys():
|
|
pn.add(panels[k])
|
|
|
|
dlg = SwingUtils.showDialog(None, CAMERA_NAME , None, pn)
|
|
while(True):
|
|
time.sleep(1)
|