aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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=[]):