Skip to content
This repository has been archived by the owner on Feb 18, 2020. It is now read-only.

External Code Interfaces

Daniel Patrick Foose edited this page Oct 20, 2016 · 2 revisions

Vespucci 1.1.x will integrate interprocess communication between Vespucci and Python and R packages distributed with Vespucci. More information will be available as this feature is implemented.

Sending/Receiving Matrices from Vespucci to the External Environment

To get a list of available matrices, use the list function of the Vespucci Python or R package. To copy a matrix from Vespucci, use the requestMatrix function, with the list of keys being the arguments. The returned value will be of the numpy.array type in Python and the matrix type in R.

Writing Extensions for Vespucci

Vespucci extensions in are scripts that must get the required matrices, execute the operation, then send the matrices back to Vespucci. The user specifies which command line arguments get passed to the script, and you can decide how the arguments should be passed. The extension should be a .py or .R file located in the "extensions" folder of the Vespucci binary directory. On startup, Vespucci will search for valid extensions and place them in the extensions menu. When the user requests an extension, a window containing plain text editor appears, allowing them to specify the command line parameters for the script. They can also specify which R or Python version is used to execute the script.\

Under the Hood

Vespucci keeps a list of all available matrices in shared memory. When the user calls the list function of the Python or R package, this list is presented as a list of lists, with each member containing the keys of the matrix. When the user calls the requestMatrix function, a message is passed to Vespucci, which then copies the requested matrix into shared memory. The Python or R package then copies the matrix as a numeric array into its local memory and deallocates the shared matrix. When the user calls addMatrix from the Python or R package, the matrix is copied into shared memory and a message is sent to Vespucci, which copies the matrix from shared memory into its local memory and deallocates the shared memory block. This is done using Qt D-Bus and QSharedMemory.

Clone this wiki locally