From 3bd85d6f6d3bd736ee374289a54371040657fc58 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 15 Jun 2021 22:43:40 -0400 Subject: ramp generator get extra method to work with span and center --- funcGenerator.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'funcGenerator.py') 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") -- cgit v1.2.3