Manages a Scilab session.
Uses MAT files to pass data between Scilab and Numpy. The function must either exist as an file in this directory or on Scilab’s path.
You may provide a logger object for logging events, or the scilab.get_log() default will be used. Events will be logged as debug unless verbose is set when calling a command, then they will be logged as info.
Parameters: | executable : str, optional
logger : logging object, optional
timeout : float, opional
oned_as : {‘row’, ‘column’}, optional
temp_dir : str, optional
|
---|
Start Scilab and create our MAT helpers
Closes this Scilab session and removes temp files
Put a variable or variables into the Scilab session.
Parameters: | name : str or list
var : object or list
timeout : float
|
---|
Examples
>>> from scilab2py import Scilab2Py
>>> sci = Scilab2Py()
>>> y = [1, 2]
>>> sci.push('y', y)
>>> sci.pull('y')
array([[ 1., 2.]])
>>> sci.push(['x', 'y'], ['spam', [1., 2., 3., 4.]])
>>> sci.pull(['x', 'y'])
[u'spam', array([[ 1., 2., 3., 4.]])]
Retrieve a value or values from the Scilab session.
Parameters: | var : str or list
timeout : float
|
---|---|
Returns: | out : object
Raises:
Examples: >>> from scilab2py import Scilab2Py
>>> sci = Scilab2Py()
>>> y = [1, 2]
>>> sci.push('y', y)
>>> sci.pull('y')
array([[ 1., 2.]])
>>> sci.push(['x', 'y'], ['spam', [1, 2, 3, 4]])
>>> sci.pull(['x', 'y'])
[u'spam', array([[ 1., 2., 3., 4.]])]
|
Perform Scilab command or commands.
Parameters: | cmd : str or list
verbose : bool, optional
timeout : float
plot_name : str, optional
plot_format: str, optional
plot_width: int, optional
plot_height: int, optional
return_both : bool, optional
|
---|---|
Returns: | out : str
|
Raises: | Scilab2PyError
|
Restart an Scilab session in a clean state
Called when we can’t open Scilab or Scilab throws an error
Return a console logger.
Output may be sent to the logger using the debug, info, warning, error and critical methods.
Parameters: | name : str
|
---|
References
[R1] | Logging facility for Python, http://docs.python.org/library/logging.html |
Scilab style struct, enhanced.
Supports dictionary and attribute style access. Can be pickled, and supports code completion in a REPL.
Examples
>>> from pprint import pprint
>>> from scilab2py import Struct
>>> a = Struct()
>>> a.b = 'spam' # a["b"] == 'spam'
>>> a.c["d"] = 'eggs' # a.c.d == 'eggs'
>>> pprint(a)
{'b': 'spam', 'c': {'d': 'eggs'}}