Esempio n. 1
0
 def _maybe_init(self):
   """
   Setup for simulation.
   """
   if not self._initialized:
     assert is_number(self.init_alpha), 'init_alpha must be a number'
     self.init_alpha = clip(self.init_alpha, 0, 1)
     self._resistor_1 = Resistor(self.n_top, self.n_middle, self.i_top_middle,
         (1 - self.init_alpha) * self.r)
     self._resistor_2 = Resistor(self.n_middle, self.n_bottom,
         self.i_middle_bottom, self.init_alpha * self.r)
     self._initialized = True
Esempio n. 2
0
 def __init__(self, k):
   """
   |k|: constant value.
   """
   assert is_number(k), 'k must be a number'
   self.k = k
Esempio n. 3
0
 def __init__(self, k):
     """
 |k|: constant value.
 """
     assert is_number(k), 'k must be a number'
     self.k = k