Wrappers#

This module contains the wrappers for interfacing with MATLAB custom functions, such as those for custom layers models or function backgrounds.

Wrappers for the interface between ratapi and MATLAB custom files.

class ratapi.wrappers.DylibWrapper(filename, function_name)#

Creates a python callback for a function in dynamic library.

Parameters:
  • filename (str) – The path of the dynamic library

  • function_name (str) – The name of the function to call

getHandle()#

Return a wrapper for the custom dynamic library function.

Returns:

wrapper – The wrapper function for the dynamic library callback

Return type:

Callable[[ArrayLike, ArrayLike, ArrayLike, int, int], tuple[ArrayLike, float]]

class ratapi.wrappers.MatlabWrapper(filename)#

Creates a python callback for a MATLAB function.

Parameters:

filename (string) – The path of the file containing MATLAB function

getHandle()#

Return a wrapper for the custom MATLAB function.

Returns:

wrapper – The wrapper function for the MATLAB callback

Return type:

Callable[[ArrayLike, ArrayLike, ArrayLike, int, int], tuple[ArrayLike, float]]

ratapi.wrappers.start_matlab()#

Start MATLAB asynchronously and returns a future to retrieve the engine later.

Returns:

future – A future used to get the actual matlab engine.

Return type:

matlab.engine.futureresult.FutureResult

ratapi.wrappers.use_shared_matlab(name, custom_error_message)#

Connect asynchronously to shared MATLAB engine instance with the given name.

Parameters:
  • name (str) – The name of shared MATLAB engine instance

  • custom_error_message (str) – The custom error message in case of failed connection

Returns:

future – A future used to get the actual matlab engine.

Return type:

matlab.engine.futureresult.FutureResult