diff options
Diffstat (limited to 'panel.py')
-rw-r--r-- | panel.py | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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=[]): |