aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-04-06 23:03:28 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-04-06 23:03:28 -0400
commit44a0c0f0ff41eea469b31ef24cdea8d09df69a3f (patch)
tree9a3e6aeea6b249c501369e91ada6b1314ec077b9
parentbfe0860fa9c3b33929d5cb05e1d14d19afc5f968 (diff)
downloadpyExpControl-44a0c0f0ff41eea469b31ef24cdea8d09df69a3f.tar.gz
pyExpControl-44a0c0f0ff41eea469b31ef24cdea8d09df69a3f.zip
added pulse generator
-rw-r--r--panel.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/panel.py b/panel.py
index f96c751..07a1362 100644
--- a/panel.py
+++ b/panel.py
@@ -61,6 +61,22 @@ class TriangleGen:
return self.start + 2*sweeper.getRelPos()*(self.stop - self.start)
return self.start + 2*(1-sweeper.getRelPos())*(self.stop - self.start)
+class PulseGen:
+ # monotonically goes from start to stop, once reaches stop goes back to start
+ def __init__(self, ampl=1, sweeper=None):
+ self.ampl = ampl
+ self.sweeper = sweeper
+
+ def getValue(self, sweeper=None):
+ if sweeper is None and self.sweeper is None:
+ print("Error: generator needs sweeper")
+ return 0
+ if sweeper is None:
+ sweeper = self.sweeper
+ if sweeper.getRelPos() < 0.5:
+ return self.ampl
+ return 0
+
class Sweeper:
def __init__(self, widget, Npoints, SweepTime, onTicCallbacks=[]):
# walk from start to stop with Npoints