Module curvepy.extension.constant

Expand source code
from .extension import Extension
from ..constant import Constant
from intervalpy import Interval

class ConstantExtension(Extension):

    """
    Extends an end of a function with a line using its edge values.
    """

    name = "constant"

    def update_extension(self):
        if self.curve.domain.is_empty:
            self.start_func.value = None
            self.end_func.value = None
            return

        if self.start:
            x = self.curve.domain.start
            y = self.curve.y(x)
            self.start_func.value = y

        if self.end:
            x = self.curve.domain.end
            y = self.curve.y(x)
            self.end_func.value = y

    def create_extension_func(self, start=False):
        return Constant(0)

Classes

class ConstantExtension (func, start=True, end=True, uniform=True, raise_on_empty=False, min_step=1e-05)

Extends an end of a function with a line using its edge values.

Expand source code
class ConstantExtension(Extension):

    """
    Extends an end of a function with a line using its edge values.
    """

    name = "constant"

    def update_extension(self):
        if self.curve.domain.is_empty:
            self.start_func.value = None
            self.end_func.value = None
            return

        if self.start:
            x = self.curve.domain.start
            y = self.curve.y(x)
            self.start_func.value = y

        if self.end:
            x = self.curve.domain.end
            y = self.curve.y(x)
            self.end_func.value = y

    def create_extension_func(self, start=False):
        return Constant(0)

Ancestors

Class variables

var name

Methods

def create_extension_func(self, start=False)
Expand source code
def create_extension_func(self, start=False):
    return Constant(0)

Inherited members