GUI #70

Open
topquark12 wants to merge 17 commits from GUI into master
Contributor
  • Adds GUI based on pyqtgraph
  • Updates docs
  • Minor bug fixes
- Adds GUI based on pyqtgraph - Updates docs - Minor bug fixes
topquark12 added 17 commits 2022-06-30 14:28:03 +08:00
sb10q reviewed 2022-06-30 16:11:50 +08:00
@ -71,0 +76,4 @@
The GUI is developed based on the Python library pyqtgraph. The environment needed to run the GUI is configured automatically by running:
```shell
nix develop
Owner

You could make it a nix shell

You could make it a ``nix shell``
sb10q reviewed 2022-06-30 16:12:47 +08:00
@ -76,0 +76,4 @@
shellHook=
''
export QT_PLUGIN_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtPluginPrefix}
export QML2_IMPORT_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtQmlPrefix}
Owner

Better solution: package tecQT (making a separate flake output) and use wrapQtApp

Better solution: package tecQT (making a separate flake output) and use wrapQtApp
sb10q reviewed 2022-06-30 16:14:44 +08:00
@ -0,0 +286,4 @@
paramList[0].restoreState(refreshTreeParam(paramList[0].saveState(), 0))
paramList[1].restoreState(refreshTreeParam(paramList[1].saveState(), 1))
paramList[0].sigTreeStateChanged.connect(change0)
Owner

Make channel the first parameter, use functools.partial, and remove change0/change1

Make ``channel`` the first parameter, use ``functools.partial``, and remove ``change0/change1``
sb10q reviewed 2022-06-30 16:18:51 +08:00
@ -117,0 +118,4 @@
1 => self.channel1.vref_meas,
_ => unreachable!(),
};
// let center_point = self.get_center(channel);
Owner

Why?
If the get_center function is broken then it should be fixed. In any case this commented-out line should be removed.

Why? If the get_center function is broken then it should be fixed. In any case this commented-out line should be removed.
sb10q reviewed 2022-06-30 16:19:24 +08:00
@ -0,0 +225,4 @@
return tempTree
cnt = 0
def updateData():
Owner

update_data, see PEP8

update_data, see PEP8
sb10q reviewed 2022-06-30 16:20:00 +08:00
@ -0,0 +10,4 @@
rec_len = 1000
refresh_period = 20
TECparams = [ [
Owner

tec_params, PEP8 and consistency with the two variables above

tec_params, PEP8 and consistency with the two variables above
sb10q reviewed 2022-06-30 16:25:19 +08:00
@ -0,0 +259,4 @@
if __name__ == '__main__':
tec = Client(host="192.168.1.26", port=23, timeout=None)
Owner

argparse, IP address settings

argparse, IP address settings
sb10q reviewed 2022-06-30 16:26:42 +08:00
@ -0,0 +255,4 @@
if quit:
break
cnt += 1
Owner

Should there be a feature to reset the plots and/or set a maximum number of samples to store?

Should there be a feature to reset the plots and/or set a maximum number of samples to store?
Owner

Minor bug fixes

Those could probably go into a separate PR.

> Minor bug fixes Those could probably go into a separate PR.
Owner

This error kept popping up on the console after running python pytec/tecQT.py.

Traceback (most recent call last):
  File "/home/occheung/Desktop/thermostat/pytec/tecQT.py", line 233, in updateData
    ch1tempGraph.update(data, cnt)
  File "/home/occheung/Desktop/thermostat/pytec/tecQT.py", line 186, in update
    curve.update(tec_data, cnt)
  File "/home/occheung/Desktop/thermostat/pytec/tecQT.py", line 165, in update
    np.copyto(self.data_buf, np.full(self.buffLen, tec_data[self.channel][self.keyStr]))
  File "<__array_function__ internals>", line 5, in copyto
TypeError: Cannot cast array data from dtype('O') to dtype('float64') according to the rule 'same_kind'

The GUI plot seems broken.
image
Replacing line 165 in pytec/tecQT.py with pass works around the problem.

Edit: This is caused by attempting to cast a None value. None value appears in the reported dictionary when there are empty TEC slots.

This error kept popping up on the console after running `python pytec/tecQT.py`. ``` Traceback (most recent call last): File "/home/occheung/Desktop/thermostat/pytec/tecQT.py", line 233, in updateData ch1tempGraph.update(data, cnt) File "/home/occheung/Desktop/thermostat/pytec/tecQT.py", line 186, in update curve.update(tec_data, cnt) File "/home/occheung/Desktop/thermostat/pytec/tecQT.py", line 165, in update np.copyto(self.data_buf, np.full(self.buffLen, tec_data[self.channel][self.keyStr])) File "<__array_function__ internals>", line 5, in copyto TypeError: Cannot cast array data from dtype('O') to dtype('float64') according to the rule 'same_kind' ``` The GUI plot seems broken. ![image](/attachments/7c44a3bb-c831-41ec-8f68-b9f0ccd31bc1) Replacing line 165 in `pytec/tecQT.py` with `pass` works around the problem. Edit: This is caused by attempting to cast a `None` value. `None` value appears in the reported dictionary when there are empty TEC slots.
109 KiB
esavkin was assigned by sb10q 2023-02-08 19:28:20 +08:00
This pull request has changes conflicting with the target branch.
  • README.md
  • flake.nix
  • pytec/autotune.py
  • pytec/pytec/client.py
  • src/channels.rs
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b GUI master
git pull origin GUI

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff GUI
git push origin master
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/thermostat#70
No description provided.