diff --git a/Initial_Condition.py b/Initial_Condition.py index d6aad0c550e2189bf510041562f7f4407cfb8c8e..cb03f31efaa0f07bf6811d3f0a94552f306de4c8 100644 --- a/Initial_Condition.py +++ b/Initial_Condition.py @@ -127,7 +127,7 @@ class Sine(InitialCondition): Attributes ---------- factor : float - Factor by which is the evaluation point is multiplied before applying + Factor by which the evaluation point is multiplied before applying sine. Methods @@ -335,7 +335,7 @@ class Linear(InitialCondition): Attributes ---------- factor : float - Factor by which is the evaluation point is multiplied. + Factor by which the evaluation point is multiplied. Methods ------- @@ -393,7 +393,7 @@ class LinearAbsolut(InitialCondition): Attributes ---------- factor : float - Factor by which is the evaluation point is multiplied. + Factor by which the evaluation point is multiplied. Methods ------- @@ -459,9 +459,9 @@ class DiscontinuousConstant(InitialCondition): x0 : float X-value where jump is induced. left_factor : float - Factor by which is the evaluation point is multiplied before the jump. + Factor by which the evaluation point is multiplied before the jump. right_factor : float - Factor by which is the evaluation point is multiplied after the jump. + Factor by which the evaluation point is multiplied after the jump. Methods ------- @@ -513,7 +513,7 @@ class Polynomial(InitialCondition): Attributes ---------- factor : float - Factor by which is the evaluation point is multiplied. + Factor by which the evaluation point is multiplied. exponential : int Degree of the polynomial. @@ -575,7 +575,7 @@ class Continuous(InitialCondition): Attributes ---------- factor : float - Factor by which is the evaluation point is multiplied. + Factor by which the evaluation point is multiplied. Methods ------- @@ -632,8 +632,10 @@ class HeavisideOneSided(InitialCondition): Attributes ---------- - factor : float - Factor by which is the evaluation point is multiplied. + left_factor : float + Factor by which the evaluation point is multiplied before the jump. + right_factor : float + Factor by which the evaluation point is multiplied after the jump. Methods ------- @@ -655,7 +657,8 @@ class HeavisideOneSided(InitialCondition): super()._reset(config) # Unpack necessary configurations - self._factor = config.pop('factor', -1) + self._left_factor = config.pop('factor', 1) + self._right_factor = config.pop('factor', 2) def is_smooth(self): """Returns flag that function is not smooth.""" @@ -670,8 +673,10 @@ class HeavisideOneSided(InitialCondition): Fixed parameters for initial condition. """ - factor = config.pop('factor', np.random.choice([-100, 100])) - config = {'factor': factor} + left_factor = config.pop('left_factor', np.random.choice([-100, 100])) + right_factor = config.pop('right_factor', + np.random.choice([-100, 100])) + config = {'left_factor': left_factor, 'right_factor': right_factor} self._reset(config) def _get_point(self, x): @@ -688,7 +693,8 @@ class HeavisideOneSided(InitialCondition): Value of function evaluates at x-value. """ - return self._factor - 2 * self._factor * np.heaviside(x, 0) + return self._left_factor + \ + (self._right_factor - self._left_factor) * np.heaviside(x, 0) class HeavisideTwoSided(InitialCondition): @@ -697,9 +703,9 @@ class HeavisideTwoSided(InitialCondition): Attributes ---------- left_factor : float - Factor by which is the evaluation point is multiplied before the jump. + Factor by which the evaluation point is multiplied before the jump. right_factor : float - Factor by which is the evaluation point is multiplied after the jump. + Factor by which the evaluation point is multiplied after the jump. adjustment : float Extent of adjustment of evaluation point in x-direction.