Ejemplo n.º 1
0
    This is raised by `scipy.odr` if an error occurs during fitting.
    """
    pass


class odr_stop(Exception):
    """
    Exception stopping fitting.

    You can raise this exception in your objective function to tell
    `scipy.odr` to stop fitting.
    """
    pass

__odrpack._set_exceptions(odr_error, odr_stop)


def _conv(obj, dtype=None):
    """ Convert an object to the preferred form for input to the odr routine.
    """

    if obj is None:
        return obj
    else:
        if dtype is None:
            obj = numpy.asarray(obj)
        else:
            obj = numpy.asarray(obj, dtype)
        if obj.shape == ():
            # Scalar.
Ejemplo n.º 2
0
class OdrStop(Exception):
    """
    Exception stopping fitting.

    You can raise this exception in your objective function to tell
    `scipy.odr` to stop fitting.
    """
    pass

# Backwards compatibility
odr_error = OdrError
odr_stop = OdrStop

__odrpack._set_exceptions(OdrError, OdrStop)


def _conv(obj, dtype=None):
    """ Convert an object to the preferred form for input to the odr routine.
    """

    if obj is None:
        return obj
    else:
        if dtype is None:
            obj = numpy.asarray(obj)
        else:
            obj = numpy.asarray(obj, dtype)
        if obj.shape == ():
            # Scalar.