aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-04-03 22:44:52 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-04-03 22:52:36 -0400
commit89b4ca088d7ee9c7d077f198043f273a78030bd0 (patch)
tree1bdda91b63f4c60cd5702a1c5943c8b5e08ff9fa
parentbda3233c007c9cfa3fd8d36e3bb8241f49c158a1 (diff)
downloadpyExpControl-89b4ca088d7ee9c7d077f198043f273a78030bd0.tar.gz
pyExpControl-89b4ca088d7ee9c7d077f198043f273a78030bd0.zip
added ramp generator
-rw-r--r--panel.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/panel.py b/panel.py
index e9cafe3..6b55681 100644
--- a/panel.py
+++ b/panel.py
@@ -27,6 +27,21 @@ class SinGen:
sweeper = self.sweeper
return self.ampl * np.sin( 2*np.pi*sweeper.getRelPos()) + self.offset
+class RampGen:
+ # monotonically goes from start to stop, at final point move to start
+ def __init__(self, start=0, stop=0, sweeper=None):
+ self.start = start
+ self.stop = stop
+ 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
+ return self.start + sweeper.getRelPos()*(self.stop - self.start)
+
class Sweeper:
def __init__(self, widget, start, stop, Npoints, SweepTime, onTicCallbacks=[]):