aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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")