diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-06-15 22:46:42 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-06-15 22:50:42 -0400 |
commit | e508d982779005d3d40cce156d9219744d47cc71 (patch) | |
tree | ab1aea972f30d7764d77879ef8cece61d1463ae2 | |
parent | 3bd85d6f6d3bd736ee374289a54371040657fc58 (diff) | |
download | pyExpControl-e508d982779005d3d40cce156d9219744d47cc71.tar.gz pyExpControl-e508d982779005d3d40cce156d9219744d47cc71.zip |
TriangleGen inherits from RampGen
-rw-r--r-- | funcGenerator.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/funcGenerator.py b/funcGenerator.py index e82f227..1d782a3 100644 --- a/funcGenerator.py +++ b/funcGenerator.py @@ -37,14 +37,14 @@ class RampGen: span = self.stop - self.start; self.setCenterAndSpan(center, span) - def getCenter(self, center): - retrun (self.stop + self.start)/2 + def getCenter(self): + return (self.stop + self.start)/2 def setSpan(self, span): center = (self.stop + self.start)/2 self.setCenterAndSpan(center, span) - def getSpan(self, span): + def getSpan(self): return self.stop - self.start; def getValue(self, sweeper=None): @@ -55,13 +55,8 @@ class RampGen: sweeper = self.sweeper return self.start + sweeper.getRelPos()*(self.stop - self.start) -class TriangleGen: +class TriangleGen(RampGen): # monotonically goes from start to stop, once reaches stop goes back 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") |