diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-04-06 23:03:28 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-04-06 23:03:28 -0400 |
commit | 44a0c0f0ff41eea469b31ef24cdea8d09df69a3f (patch) | |
tree | 9a3e6aeea6b249c501369e91ada6b1314ec077b9 /panel.py | |
parent | bfe0860fa9c3b33929d5cb05e1d14d19afc5f968 (diff) | |
download | pyExpControl-44a0c0f0ff41eea469b31ef24cdea8d09df69a3f.tar.gz pyExpControl-44a0c0f0ff41eea469b31ef24cdea8d09df69a3f.zip |
added pulse generator
Diffstat (limited to 'panel.py')
-rw-r--r-- | panel.py | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 |