From e17c70dba5cd4736c226d4e8b8295260c33cfa09 Mon Sep 17 00:00:00 2001 From: Pedro Martins Date: Mon, 23 Jan 2017 14:40:34 +0000 Subject: [PATCH] SMC - works fine! First test circuit ok --- DC_circuits.py | 2 +- ParamSchemDraw.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DC_circuits.py b/DC_circuits.py index e9817aa..e4a81eb 100644 --- a/DC_circuits.py +++ b/DC_circuits.py @@ -24,7 +24,7 @@ # TODO # change params to **kwargs # modify classes to support location of label. -# + def example_01(params, ekey, label=True): # Parameters V1 = vSource(params['$V_1$'], '$V_1$') diff --git a/ParamSchemDraw.py b/ParamSchemDraw.py index 332a04f..0f52b35 100644 --- a/ParamSchemDraw.py +++ b/ParamSchemDraw.py @@ -100,7 +100,7 @@ def resistanceEng(self): appending the ohms unit and using the significant number of digits defined when the object was created ''' - return enginnerNotation(self._resistance, resistor.__UNIT, self._digits) + return engineerNotation(self._resistance, resistor.__UNIT, self._digits) @property def label(self): @@ -359,7 +359,7 @@ def voltageEng(self): appending the volts unit and using the significant number of digits defined when the object was created ''' - return enginnerNotation(self._voltage, vSource.__UNIT, self._digits) + return engineerNotation(self._voltage, vSource.__UNIT, self._digits) @property def label(self): @@ -448,7 +448,7 @@ def currentEng(self): appending the volts unit and using the significant number of digits defined when the object was created ''' - return enginnerNotation(self._current, iSource.__UNIT, self._digits) + return engineerNotation(self._current, iSource.__UNIT, self._digits) @property def label(self): @@ -486,14 +486,14 @@ def isValidISource(I): return True return False -def enginnerNotation(value, units="", p=3): +def engineerNotation(value, units="", p=3): ''' Formats a number to engineering notation using p significant digits, appending the given unit after the magnitude prefix - USAGE: enginnerNotation(value, units, p) - enginnerNotation(value, units) - enginnerNotation(value) + USAGE: engineerNotation(value, units, p) + engineerNotation(value, units) + engineerNotation(value) ARGUMENTS: value -> value to be formatted to enginnering notation @@ -517,7 +517,7 @@ def enginnerNotation(value, units="", p=3): assert p >= 1 and p <= 16 # Engineering units prefixes and offset to unitary prefix - _PREFIX = ('$p$', '$n$', '$\mu$', '$m$', "", '$K$', '$M$', '$G$') + _PREFIX = ('p', 'n', '\mu', 'm', "", 'K', 'M', 'G') _UNIT_OFFSET = 4 # Handling negative numbers and zero