aboutsummaryrefslogtreecommitdiff
path: root/panel.py
diff options
context:
space:
mode:
Diffstat (limited to 'panel.py')
-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