Compare commits

...

2 Commits

Author SHA1 Message Date
1fc5f7d5ae pytec: Add thermostat_{autotune,plot} entry pts
Forms an interface to run the `plot.py` and `autotune.py` scripts.
2024-11-18 11:47:33 +08:00
c632a85ce8 pytec: plot.py: Add main function 2024-11-18 11:47:11 +08:00
2 changed files with 119 additions and 106 deletions

View File

@ -4,6 +4,8 @@ import matplotlib.animation as animation
from threading import Thread, Lock from threading import Thread, Lock
from pytec.client import Client from pytec.client import Client
def main():
TIME_WINDOW = 300.0 TIME_WINDOW = 300.0
tec = Client() tec = Client()
@ -116,7 +118,7 @@ def animate(i):
margin_y = 0.01 * (max_y - min_y) margin_y = 0.01 * (max_y - min_y)
ax.set_ylim(min_y - margin_y, max_y + margin_y) ax.set_ylim(min_y - margin_y, max_y + margin_y)
global legend nonlocal legend
legend.remove() legend.remove()
legend = ax.legend() legend = ax.legend()
@ -126,3 +128,7 @@ ani = animation.FuncAnimation(
plt.show() plt.show()
quit = True quit = True
thread.join() thread.join()
if __name__ == "__main__":
main()

View File

@ -9,4 +9,11 @@ setup(
license="GPLv3", license="GPLv3",
install_requires=["setuptools"], install_requires=["setuptools"],
packages=find_packages(), packages=find_packages(),
entry_points={
"gui_scripts": [
"thermostat_autotune = autotune:main",
"thermostat_plot = plot:main",
]
},
py_modules=["autotune", "plot"],
) )