snu-quiqcl / iquip

Ion trap Quantum computing User Interface Project
GNU General Public License v3.0
7 stars 0 forks source link

Minimal `DataViewerApp` part 1: `DataPointWidget` #151

Closed kangz12345 closed 1 year ago

kangz12345 commented 1 year ago

See #144 for details.

This PR does not contain the histogram plot. It will be implemented in the next PR. The diffs might seem too large, but most of them are just trivial setters and getters and docstrings!

Screen Shot 2023-09-19 at 12 01 53

A demo script would be helpful:

from PyQt5.QtWidgets import QApplication
import iquip.apps.dataviewer as dv

qapp = QApplication([])
widget = dv.DataPointWidget()
widget.dataTypeChanged.connect(lambda x: print(x))
widget.thresholdChanged.connect(lambda x: print(x))
widget.setSeriesName("NAME")
widget.setNumberOfSamples(300)
widget.setThreshold(5)
widget.setDataType(dv.DataPointWidget.DataType.AVERAGE)
widget.setValue(120, dv.DataPointWidget.DataType.TOTAL)
widget.setValue(9.8, dv.DataPointWidget.DataType.AVERAGE)
widget.setValue(0.8, dv.DataPointWidget.DataType.P1)
widget.show()
qapp.exec_()

Save it as demo.py in the repository root directory. Then run it by

python3 -m demo

One may prefer to use python instead of python3.

kangz12345 commented 1 year ago

Next update preview: Screen Shot 2023-09-19 at 14 02 58