aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-06-15 22:43:40 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-06-15 22:43:40 -0400
commit3bd85d6f6d3bd736ee374289a54371040657fc58 (patch)
tree47f59dc681f0c834754d2f72f03a9d3b68a89b13
parent158e1e84390a9284b825369c74e2fc53a914ece9 (diff)
downloadpyExpControl-3bd85d6f6d3bd736ee374289a54371040657fc58.tar.gz
pyExpControl-3bd85d6f6d3bd736ee374289a54371040657fc58.zip
ramp generator get extra method to work with span and center
-rw-r--r--funcGenerator.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/funcGenerator.py b/funcGenerator.py
index caccacc..e82f227 100644
--- a/funcGenerator.py
+++ b/funcGenerator.py
@@ -29,6 +29,24 @@ class RampGen:
self.stop = stop
self.sweeper = sweeper
+ def setCenterAndSpan(self, center, span):
+ self.start = center-span/2
+ self.stop = center+span/2
+
+ def setCenter(self, center):
+ span = self.stop - self.start;
+ self.setCenterAndSpan(center, span)
+
+ def getCenter(self, center):
+ retrun (self.stop + self.start)/2
+
+ def setSpan(self, span):
+ center = (self.stop + self.start)/2
+ self.setCenterAndSpan(center, span)
+
+ def getSpan(self, span):
+ return self.stop - self.start;
+
def getValue(self, sweeper=None):
if sweeper is None and self.sweeper is None:
print("Error: generator needs sweeper")