def __init__(self, function_label, order=(0, 0), weight_label=None, location=None): """ :param : order tuple of temporal_order and spatial_order :param : factor :param : location """ if not isinstance(order, tuple) or len(order) > 2: raise TypeError("order mus be 2-tuple of int.") if any([True for n in order if n < 0]): raise ValueError("derivative orders must be positive") if sum(order) > 2: raise ValueError("only derivatives of order one and two supported") if location is not None: if location and not isinstance(location, Number): raise TypeError("location must be a number") if not is_registered(function_label): raise ValueError("Unknown function label '{0}'!".format(function_label)) if weight_label is None: weight_label = function_label elif not isinstance(weight_label, str): raise TypeError("only strings allowed as 'weight_label'") Placeholder.__init__(self, {"func_lbl": function_label, "weight_lbl": weight_label}, order=order, location=location)
def __init__(self, function_label, order=0, location=None): if not is_registered(function_label): raise ValueError("Unknown function label '{0}'!".format(function_label)) Placeholder.__init__(self, {"func_lbl": function_label}, order=(0, order), location=location)