diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-04-03 22:44:52 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-04-03 22:52:36 -0400 |
commit | 89b4ca088d7ee9c7d077f198043f273a78030bd0 (patch) | |
tree | 1bdda91b63f4c60cd5702a1c5943c8b5e08ff9fa /panel.py | |
parent | bda3233c007c9cfa3fd8d36e3bb8241f49c158a1 (diff) | |
download | pyExpControl-89b4ca088d7ee9c7d077f198043f273a78030bd0.tar.gz pyExpControl-89b4ca088d7ee9c7d077f198043f273a78030bd0.zip |
added ramp generator
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=[]): |