Пример #1
0
def feval(nargout, funcname, *arguments):
    """Executes an Octave function called funcname.

	The function is set to return nargout values. Returned values
	are stored in a tuple. If the nargout argument is less than 0,
	an empty tuple is returned.

	M-files are searched for in the Octave path.

	See also the Octave documentation for the builtin Octave function
	feval.

	Type conversions
	****************
	
	The following type conversions are supported:

	Python to Octave
	================
	
	Objects:
		int (32-bit)        int32
		float (64-bit)      double
		str                 character array
		dict                struct
		list                cell array
		
	Numeric Array:
		UBYTE, SBYTE,       matrix of correct type
		USHORT, SHORT,      -''-
		UINT, SINT,         -''-
		LONG,               -''-
		DOUBLE              -''-
		CHAR                character array
		OBJECT              cell array

	All other objects causes a pytave.ObjectConvertError to be
	raised. This exception inherits TypeError.

	When dicts are converted, all keys must be strings and
	constitute valid Octave identifiers. The behavior is
	analogical to the Octave "struct" function: values that
	evaluate to cells must have matching dimensions, singleton
	cells and non-cell values are expanded.
	
	Octave to Python
	================
	
        All scalar values are regarded as 1x1 matrices, as they are in
	Octave.

	Matrix values to Numeric arrays:
	   	double              DOUBLE
		single              FLOAT
		logical             DOUBLE
		int64               LONG
		int32, uint32       INT, UINT
		int16, uint16       SHORT, USHORT
		int8, unint8        SBYTE, UBYTE
		char                CHAR
		cell                OBJECT

	Structs are converted to dicts, where each value is an OBJECT
	array.

	All other values causes a pytave.ValueConvertError to be
	raised. This exception inherits TypeError.

	Errors
	******

	Octave runtime errors are encapsulated into
	pytave.OctaveError exceptions, base class RuntimeError.

	"""

    return _pytave.feval(nargout, funcname, arguments)
Пример #2
0
def path(*paths):
    """See Octave documentation"""
    return _pytave.feval(1, "path", paths)[0]
Пример #3
0
def unload_package(pkg_name):
    """Equivalent to pkg unload. See Octave documentation."""
    return _pytave.feval(0, "pkg", ("unload", pkg_name))
Пример #4
0
def addpath(*arguments):
    """See Octave documentation"""
    return _pytave.feval(1, "addpath", arguments)[0]
Пример #5
0
def feval(nargout, funcname, *arguments):

    """Executes an Octave function called funcname.

	The function is set to return nargout values. Returned values
	are stored in a tuple. If the nargout argument is less than 0,
	an empty tuple is returned.

	M-files are searched for in the Octave path.

	See also the Octave documentation for the builtin Octave function
	feval.

	Type conversions
	****************
	
	The following type conversions are supported:

	Python to Octave
	================
	
	Objects:
		int (32-bit)        int32
		float (64-bit)      double
		str                 character array
		dict                struct
		list                cell array
		
	Numeric Array:
		UBYTE, SBYTE,       matrix of correct type
		USHORT, SHORT,      -''-
		UINT, SINT,         -''-
		LONG,               -''-
		DOUBLE              -''-
		CHAR                character array
		OBJECT              cell array

	All other objects causes a pytave.ObjectConvertError to be
	raised. This exception inherits TypeError.

	When dicts are converted, all keys must be strings and
	constitute valid Octave identifiers. The behavior is
	analogical to the Octave "struct" function: values that
	evaluate to cells must have matching dimensions, singleton
	cells and non-cell values are expanded.
	
	Octave to Python
	================
	
        All scalar values are regarded as 1x1 matrices, as they are in
	Octave.

	Matrix values to Numeric arrays:
	   	double              DOUBLE
		single              FLOAT
		logical             DOUBLE
		int64               LONG
		int32, uint32       INT, UINT
		int16, uint16       SHORT, USHORT
		int8, unint8        SBYTE, UBYTE
		char                CHAR
		cell                OBJECT

	Structs are converted to dicts, where each value is an OBJECT
	array.

	All other values causes a pytave.ValueConvertError to be
	raised. This exception inherits TypeError.

	Errors
	******

	Octave runtime errors are encapsulated into
	pytave.OctaveError exceptions, base class RuntimeError.

	"""

    return _pytave.feval(nargout, funcname, arguments)
Пример #6
0
def unload_package(pkg_name):
    """Equivalent to pkg unload. See Octave documentation."""
    return _pytave.feval(0, "pkg", ("unload", pkg_name))
Пример #7
0
def path(*paths):
    """See Octave documentation"""
    return _pytave.feval(1, "path", paths)[0]
Пример #8
0
def addpath(*arguments):
    """See Octave documentation"""
    return _pytave.feval(1, "addpath", arguments)[0]