Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge PyQt5 to main. Sensor Oscilloscope, Simulator, Blockly, and more #14

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ debian/expeyes-doc-common/
debian/microhope/
debian/expeyes-doc-*/
debian/eyes17/
debian/eyes17-blockly-plugin/

# autoconf generated files
Makefile.in
Expand Down Expand Up @@ -65,4 +66,7 @@ m4/
# LibreOffice extensions
*.oxt

#Pycharm IDE files
eyes17/.idea

SEELAB_EYES
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ install_arch: all_arch
#$(MAKE) -C po install DESTDIR=$(DESTDIR)
# for expeyes-doc-common
install -d $(DESTDIR)/usr/share/icons
install -m 644 pixmaps/*doc.png $(DESTDIR)/usr/share/icons
# install -m 644 pixmaps/*doc.png $(DESTDIR)/usr/share/icons
install -d $(DESTDIR)/usr/share/applications
install -m 644 desktop/*doc.desktop $(DESTDIR)/usr/share/applications
install -m 644 desktop/eyes17-doc.desktop $(DESTDIR)/usr/share/applications
# subdirs stuff
for d in $(SUBDIRS); do \
[ ! -f $$d/Makefile ] || $(MAKE) -C $$d install DESTDIR=$(DESTDIR); \
Expand Down Expand Up @@ -133,7 +133,7 @@ install_indep: all_indep
for f in eyes17/server*.html eyes17/*.py ; do \
cp $$f $(DESTDIR)/usr/share/eyes17; \
done
for d in code examples eyes17 html images lang layouts blockly screenshots; do \
for d in code examples eyes17 html images lang layouts blockly site interactive screenshots; do \
cp -a eyes17/$$d $(DESTDIR)/usr/share/eyes17; \
done
# help files for eyes17s help popup
Expand Down
48 changes: 45 additions & 3 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,9 +1,51 @@
expeyes (5.0+pyqt5-9) unstable; urgency=medium

* Modifications to I2C logger. Add BH1750 support

-- Jithin BP <[email protected]> Thu, 11 Apr 2024 10:19:32 +0530

expeyes (5.0+pyqt5-8) unstable; urgency=medium

* Modifications to data logger for ph meter

-- Jithin BP <[email protected]> Fri, 09 Feb 2024 10:19:32 +0530

expeyes (5.0+pyqt5-7) unstable; urgency=medium

* Added interactive schematics. improvements to visual coding

-- Jithin BP <[email protected]> Tue, 05 Dec 2023 10:19:32 +0530

expeyes (5.0+pyqt5-6) unstable; urgency=medium

* Added advanced XY plot, removed dependency on pylab

-- Jithin BP <[email protected]> Wed, 11 Oct 2023 10:19:32 +0530

expeyes (5.0+pyqt5-5) unstable; urgency=medium

* fixed issues with time measurement call singlepinedges

-- Jithin BP <[email protected]> Tue, 12 Sep 2023 10:19:32 +0530

expeyes (5.0+pyqt5-4) unstable; urgency=medium

* added data logger

-- Jithin BP <[email protected]> Tue, 25 Jan 2023 19:42:32 +0530

expeyes (5.0+pyqt5-3) unstable; urgency=medium

* added simulator for testing

-- Jithin BP <[email protected]> Tue, 22 Oct 2022 19:42:32 +0530

expeyes (5.0+pyqt5-2) unstable; urgency=medium

* added piano block to codeblocks: eyes17,
depending on pyqt5
* added piano block to codeblocks
* replaced configparser which is discontinued in python 3.10 with python3-metaconfig

-- Jithin BP <[email protected]> Sun Aug 28 15:13:00 2022
-- Jithin BP <[email protected]> Tue, 15 Oct 2022 19:42:32 +0530

expeyes (5.0+pyqt5-1) unstable; urgency=medium

Expand Down
12 changes: 6 additions & 6 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@ Build-Depends: debhelper (>= 10), quilt,
python3-all, dh-python,
pyqt5-dev-tools, qttools5-dev-tools, qt5-qmake,
locales
Standards-Version: 4.1.5
Standards-Version: 4.6.1
Homepage: http://expeyes.in/
Vcs-Browser: https://salsa.debian.org/georgesk/expeyes
Vcs-Git: https://salsa.debian.org/georgesk/expeyes.git

Package: eyes17
Architecture: all
Depends: python3, ${misc:Depends}, ${python3:Depends},
python3-pyqtgraph, python3-pyqt5, python3-pyqt5.qtwebkit,
python-configparser
Recommends: python3-numpy, python3-scipy,
python3-pyqt5.qtwebengine
python3-pyqtgraph, python3-pyqt5, python3-pyqt5.qtwebengine,python3-serial, python3-pyqt5.qtsvg, python3-metaconfig, python3-numpy, python3-scipy
Recommends: python3-pyqt5.qtwebkit
Description: hardware & software framework for developing science experiments
This package provides high level interfaces for making science experiments
with an ExpEYES-17 box.
with an ExpEYES-17 or SEELab3 device.
.
ExpEYES-17 is from the PHOENIX project of Inter-University Accelerator
Centre, New Delhi. It is a hardware & software framework for
Expand All @@ -31,6 +29,8 @@ Description: hardware & software framework for developing science experiments
in various features: multiple soft input ranges, more flexible wave
generator, better time resolution, better voltage resolution, supports
seamlessly cheap I2C sensors.
.
The SEELab3 device is the upgraded version of expeyes, and is compatible with this software



Expand Down
19 changes: 19 additions & 0 deletions debian/eyes17.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ case "$1" in
esac


## Install rules . added by jithin
echo "Setting User Permissions for USB port for ExpEYES17/SEELab3: Your Lab @ Home"

echo "SUBSYSTEM==\"usb\",ATTRS{idVendor}==\"03eb\", ATTRS{idProduct}==\"21ff\", MODE=\"666\"" > /etc/udev/rules.d/99-eyes.rules
echo "SUBSYSTEM==\"tty\",ATTRS{idVendor}==\"0403\", ATTRS{idProduct}==\"6001\", MODE=\"666\"" >> /etc/udev/rules.d/99-eyes.rules
echo "SUBSYSTEM==\"usb\",ATTRS{idVendor}==\"04d8\", ATTRS{idProduct}==\"00df\", MODE=\"666\"" >> /etc/udev/rules.d/99-eyes.rules
echo "SUBSYSTEM==\"tty\",ATTRS{idVendor}==\"1a86\", ATTRS{idProduct}==\"7523\", MODE=\"666\"" >> /etc/udev/rules.d/99-eyes.rules

echo "ATTRS{idVendor}==\"03eb\", ATTRS{idProduct}==\"21ff\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" >> /etc/udev/rules.d/99-eyes.rules
echo "ATTRS{idVendor}==\"0403\", ATTRS{idProduct}==\"6001\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" >> /etc/udev/rules.d/99-eyes.rules
echo "ATTRS{idVendor}==\"04d8\", ATTRS{idProduct}==\"00df\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" >> /etc/udev/rules.d/99-eyes.rules
echo "ATTRS{idVendor}==\"1a86\", ATTRS{idProduct}==\"7523\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" >> /etc/udev/rules.d/99-eyes.rules

cat /etc/udev/rules.d/99-eyes.rules
service udev restart
/etc/init.d/udev restart
echo "Reconnect ExpEYES/SEELab3 board on the USB Port for permissions to take effect"


## this was not managed properly by debian/rules:
if which py3compile >/dev/null 2>&1; then
py3compile -p eyes17
Expand Down
5 changes: 5 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ override_dh_auto_clean:
dh_auto_clean
rm -rf $(HOME)

# Added by jithin. latest debuild makes .zst compressed files which
# do not work with older ubuntu. needs xz-utils package.
override_dh_builddeb:
dh_builddeb -- -Zxz

DocDir = $(CURDIR)/debian/eyes17/usr/share/expeyes/doc
DocDirSource = $(CURDIR)/ExpEYES17/UserManual

Expand Down
199 changes: 199 additions & 0 deletions eyes17/BHCurveHMC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
import sys, time, math, os.path
import utils

from QtVersion import *

import pyqtgraph as pg
import numpy as np
import eyes17.eyemath17 as em

class Expt(QWidget):
TIMER = 80
RPWIDTH = 300
RPGAP = 4
running = False

VMIN = -3
VMAX = 3
VSET = VMIN
ZMIN = -3
ZMAX = 3
STEP = 0.050 # 50 mV
data = [ [], [] ]
currentTrace = None
traces = []
history = [] # Data store
sources = ['A1','A2','A3', 'MIC']
trial = 0
zero = 0.

def __init__(self, device=None):
QWidget.__init__(self)
self.p = device # connection to the device hardware
self.p.set_pv1(0)
self.traceCols = utils.makeTraceColors()

self.pwin = pg.PlotWidget() #pyqtgraph window
self.pwin.showGrid(x=True, y=True) # with grid
ax = self.pwin.getAxis('bottom')
ax.setLabel(self.tr('Voltage (V) -> Current -> Magnetic Field(B)'))
ax = self.pwin.getAxis('left')
ax.setLabel(self.tr('Magnetic Field (H)'))
self.pwin.disableAutoRange()
self.pwin.setXRange(self.VMIN, self.VMAX)
self.pwin.setYRange(self.ZMIN, self.ZMAX)
self.pwin.hideButtons() # Do not show the 'A' button of pg

right = QVBoxLayout() # right side vertical layout
right.setAlignment(Qt.AlignmentFlag(0x0020)) #Qt.AlignTop
right.setSpacing(self.RPGAP)



b = QPushButton(self.tr("Start"))
right.addWidget(b)
b.clicked.connect(self.start)

b = QPushButton(self.tr("Stop"))
right.addWidget(b)
b.clicked.connect(self.stop)

b = QPushButton(self.tr("Set Zero"))
right.addWidget(b)
b.clicked.connect(self.zero)

b = QPushButton(self.tr("Clear Traces"))
right.addWidget(b)
b.clicked.connect(self.clear)

self.SaveButton = QPushButton(self.tr("Save Data"))
self.SaveButton.clicked.connect(self.save_data)
right.addWidget(self.SaveButton)

#------------------------end of right panel ----------------

top = QHBoxLayout()
top.addWidget(self.pwin)
top.addLayout(right)

full = QVBoxLayout()
full.addLayout(top)
self.msgwin = QLabel(text='')
full.addWidget(self.msgwin)

self.setLayout(full)

self.timer = QTimer()
self.timer.timeout.connect(self.update)
self.timer.start(self.TIMER)

self.p.sensors.HMC5883L_init()
self.t = self.p.sensors.HMC5883L_all


self.zero =0
#----------------------------- end of init ---------------

def update(self):
if self.running == False:
return
try:
vs = self.p.set_pv1(self.VSET)
time.sleep(0.05)
X,Y,Z = self.t() # XYZ magnetic field
Z -= self.zero
except Exception as e:
print(e)
self.comerr()
return

self.data[0].append(vs)
self.data[1].append(Z)
self.VSET += self.STEP
if self.VSET > self.VMAX:
self.STEP*=-1

if self.VSET < self.VMIN:
self.running = False
self.history.append(self.data)
self.traces.append(self.currentTrace)
self.msg(self.tr('Completed plotting B-H'))
self.p.set_pv1(0)
return
if self.index > 1: # Draw the line
self.currentTrace.setData(self.data[0], self.data[1])
self.index += 1

def zero(self):
X,Y,Z = self.t()
self.zero = Z
self.msg(self.tr('Residual Magnetic Field: %.2f'%Z))

def start(self):
if self.running == True: return
self.VSET = self.VMIN
self.p.set_pv1(self.VSET)
time.sleep(0.5)
self.STEP = 0.05 # 50 mV


self.pwin.setXRange(self.VMIN, self.VMAX)
self.pwin.setYRange(self.ZMIN, self.ZMAX)

self.running = True
self.data = [ [], [] ]
self.VSET = self.VMIN
self.currentTrace = self.pwin.plot([0,0],[0,0], pen = self.traceCols[self.trial%5])
self.index = 0
self.trial += 1
self.msg(self.tr('Started'))

def stop(self):
if self.running == False: return
self.running = False
self.history.append(self.data)
self.traces.append(self.currentTrace)
self.msg(self.tr('User Stopped'))

def clear(self):
for k in self.traces:
self.pwin.removeItem(k)
self.history = []
self.data = [ [], [] ]
self.trial = 0
self.msg(self.tr('Cleared Traces and Data'))

def save_data(self):
if self.history == []:
self.msg(self.tr('No data to save'))
return
fn = QFileDialog.getSaveFileName()
if fn != '':
self.p.save(self.history, fn)
self.msg(self.tr('Traces saved to ') + fn)

def msg(self, m):
self.msgwin.setText(self.tr(m))

def comerr(self):
self.msgwin.setText('<font color="red">' + self.tr('Error. Try Device->Reconnect'))

if __name__ == '__main__':
import eyes17.eyes
dev = eyes17.eyes.open()
app = QApplication(sys.argv)

# translation stuff
lang=QLocale.system().name()
t=QTranslator()
t.load("lang/"+lang, os.path.dirname(__file__))
app.installTranslator(t)
t1=QTranslator()
t1.load("qt_"+lang,
QLibraryInfo.location(QLibraryInfo.TranslationsPath))
app.installTranslator(t1)

mw = Expt(dev)
mw.show()
sys.exit(app.exec_())

File renamed without changes.
4 changes: 2 additions & 2 deletions eyes17/RLCsteadystate.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,13 @@ def awg_text(self, text):
val = float(text)
if self.AWGmin <= val <= self.AWGmax:
self.AWGval = val
self.AWGslider.setValue(self.AWGval)
self.AWGslider.setValue(int(self.AWGval))
self.set_wave()

def awg_slider(self, val):
if self.AWGmin <= val <= self.AWGmax:
self.AWGval = val
self.AWGtext.setText(val)
self.AWGtext.setText('%d' % (val))
self.set_wave()

def msg(self, m):
Expand Down
Loading