SDEprob.py
def _check_args(f, g, X0, t, totSimNum,GUI):
    """Sanity checks on f, g, X0 and totSimNum.

    Does various tests of input, including testing whether dimensions
    match, matches input type of X0 with f and g, whether time input
    has uniform spacing, whether totSimNum is integer. Returns number of equations
    d, number of Wiener processes m, number of time jumps n along with all the
    inputs."""

    #sdelib requires uniform t.
    if not np.isclose(min(np.diff(t)), max(np.diff(t))):
        string = "t must be uniformly spaced."
        message(string,GUI,error=True)

    #Set dimension d of SDE, len doesn't work if X0 is number.
    try:
        d = len(X0)
    except TypeError:
        d = 1
        X0 = np.array(X0).reshape((d,))
    
    #Checks if output of f has correct shape.
    if f(X0, t[0]).shape != X0.shape:
        string = (
            "f(X0,t[0]).shape = "+ str(f(X0, t[0]).shape) + 
            ",while X0.shape = " + str(X0.shape) + ". The values are "
            + "f(X0,t[0]) = " + str(f(X0,t[0])) + ", while X0 = " + str(X0)
            + ".")
        message(string,GUI,error=True)

    #Checks that g is a list of m callable functions, throws error if not.
    if type(g) == list:#
        g = tuple(g)
        m = len(g)
        for k in range(0, m):
            if not callable(g[k]):
                message(string,GUI,error=True)
                return
            Gtestk = g[k](X0, t[0])
            if Gtestk.shape != X0.shape:#Checks if output has correct shape.
                string = ("g[k](X0, t[0]).shape = "+ str(np.shape(Gtestk))
                    +", while X0.shape = "+str(X0.shape)+". g[k](X0, t[0]) = "
                    +str(Gtestk)+", while X0 = " + str(X0)+".")
                message(string,GUI,error=True)
                return
    else:
        string = (
            "g needs to be a list. Each element in the list is a function.")
        message(string,GUI,error=True)
        return

    #Checks that totSimNum is integer
    if not np.isclose(totSimNum,int(totSimNum)):
        string = ("totSimNum isn't an integer, totSimNum = %d with type =  %s"
            % (totSimNum, type(totSimNum)))
        message(string,GUI,error=True)
        return
    else:
        totSimNum = int(totSimNum)
    return d, m, f, g, X0, t, totSimNum
Sanity checks on f, g, X0 and totSimNum.

    Does various tests of input, including testing whether dimensions
    match, matches input type of X0 with f and g, whether time input
    has uniform spacing, whether totSimNum is integer. Returns number of equations
    d, number of Wiener processes m, number of time jumps n along with all the
    inputs.
Sanity checks on f, g, X0 and totSimNum.
Does various tests of input, including testing whether dimensions
match, matches input type of X0 with f and g, whether time input
has uniform spacing, whether totSimNum is integer. Returns number of equations
d, number of Wiener processes m, number of time jumps n along with all the
inputs.
Sanity checks on f g X0 and totSimNum . Does various tests of input including testing whether dimensions match matches input type of X0 with f and g whether time input has uniform spacing whether totSimNum is integer . Returns number of equations d number of Wiener processes m number of time jumps n along with all the inputs .
def _check_args(f, g, X0, t, totSimNum,GUI):
    if not np.isclose(min(np.diff(t)), max(np.diff(t))):
        string = "t must be uniformly spaced."
        message(string,GUI,error=True)
    try:
        d = len(X0)
    except TypeError:
        d = 1
        X0 = np.array(X0).reshape((d,))
    if f(X0, t[0]).shape != X0.shape:
        string = (
            "f(X0,t[0]).shape = "+ str(f(X0, t[0]).shape) + 
            ",while X0.shape = " + str(X0.shape) + ". The values are "
            + "f(X0,t[0]) = " + str(f(X0,t[0])) + ", while X0 = " + str(X0)
            + ".")
        message(string,GUI,error=True)
    if type(g) == list:
        g = tuple(g)
        m = len(g)
        for k in range(0, m):
            if not callable(g[k]):
                message(string,GUI,error=True)
                return
            Gtestk = g[k](X0, t[0])
            if Gtestk.shape != X0.shape:
                string = ("g[k](X0, t[0]).shape = "+ str(np.shape(Gtestk))
                    +", while X0.shape = "+str(X0.shape)+". g[k](X0, t[0]) = "
                    +str(Gtestk)+", while X0 = " + str(X0)+".")
                message(string,GUI,error=True)
                return
    else:
        string = (
            "g needs to be a list. Each element in the list is a function.")
        message(string,GUI,error=True)
        return
    if not np.isclose(totSimNum,int(totSimNum)):
        string = ("totSimNum isn't an integer, totSimNum = %d with type =  %s"
            % (totSimNum, type(totSimNum)))
        message(string,GUI,error=True)
        return
    else:
        totSimNum = int(totSimNum)
    return d, m, f, g, X0, t, totSimNum
def _check_args ( f , g , X0 , t , totSimNum , GUI ) : if not np . isclose ( min ( np . diff ( t ) ) , max ( np . diff ( t ) ) ) : string = "t must be uniformly spaced." message ( string , GUI , error = True ) try : d = len ( X0 ) except TypeError : d = 1 X0 = np . array ( X0 ) . reshape ( ( d , ) ) if f ( X0 , t [ 0 ] ) . shape != X0 . shape : string = ( "f(X0,t[0]).shape = " + str ( f ( X0 , t [ 0 ] ) . shape ) + ",while X0.shape = " + str ( X0 . shape ) + ". The values are " + "f(X0,t[0]) = " + str ( f ( X0 , t [ 0 ] ) ) + ", while X0 = " + str ( X0 ) + "." ) message ( string , GUI , error = True ) if type ( g ) == list : g = tuple ( g ) m = len ( g ) for k in range ( 0 , m ) : if not callable ( g [ k ] ) : message ( string , GUI , error = True ) return Gtestk = g [ k ] ( X0 , t [ 0 ] ) if Gtestk . shape != X0 . shape : string = ( "g[k](X0, t[0]).shape = " + str ( np . shape ( Gtestk ) ) + ", while X0.shape = " + str ( X0 . shape ) + ". g[k](X0, t[0]) = " + str ( Gtestk ) + ", while X0 = " + str ( X0 ) + "." ) message ( string , GUI , error = True ) return else : string = ( "g needs to be a list. Each element in the list is a function." ) message ( string , GUI , error = True ) return if not np . isclose ( totSimNum , int ( totSimNum ) ) : string = ( "totSimNum isn't an integer, totSimNum = %d with type =  %s" % ( totSimNum , type ( totSimNum ) ) ) message ( string , GUI , error = True ) return else : totSimNum = int ( totSimNum ) return d , m , f , g , X0 , t , totSimNum
Sanity checks on f, g, X0 and totSimNum.
Sanity checks on f g X0 and totSimNum .
"""Sanity checks on f, g, X0 and totSimNum.

    Does various tests of input, including testing whether dimensions
    match, matches input type of X0 with f and g, whether time input
    has uniform spacing, whether totSimNum is integer. Returns number of equations
    d, number of Wiener processes m, number of time jumps n along with all the
    inputs.""" #sdelib requires uniform t.
 #Set dimension d of SDE, len doesn't work if X0 is number.
 #Checks if output of f has correct shape.
 #Checks that g is a list of m callable functions, throws error if not.
 #
 #Checks if output has correct shape.
 #Checks that totSimNum is integer

f
g
X0
t
totSimNum
GUI