Skip to content

Instantly share code, notes, and snippets.

@blink1073
Last active August 29, 2015 14:09
Show Gist options
  • Save blink1073/792e7093e38098b74d3b to your computer and use it in GitHub Desktop.
Save blink1073/792e7093e38098b74d3b to your computer and use it in GitHub Desktop.
Pymatbridge <-> Oct2Py Integration

Pymatbridge using Matlab

Pros

  • Separation of concerns - no pipes!
  • Nice descriptive output from run_code
  • It works with this nested cell array, very impressive:

myCell = {1, 2, 3; 'text', rand(5,10,2), {11; 22; 33}}

Cons

  • Perhaps start() should be called by the utility functions if not started
  • I'd like to be able to use m.ones(10), but I could be persuaded not to. If you agree, I'll submit a PR
  • Lists should be interpreted as arrays, no?
  • The api could be cleaned up -> why are context, platform, id, socket, and socket_addr public?
  • I miss the ability to interact with the figure as opposed to just returning an image, but I can see where it presents a cleaner break
  • It'd be nice be able to affect the plot output - file format, size
  • If I set maxtime = 2, and then run sleep(5), it completes without error --> I later realized it is the max time to wait for the server to start - a bit confusing
  • If you try to get_variable on a figure handle, you get a matlabserver error and get dumped into a debug prompt. The same happens with a timeseries object. When you try run_code('keyboard') you just get dumped to this prompt: K>> , but it is not responsive. You can hit Ctrl+C in these cases, but then the session is dead, causing the matlab instance to get zombied.
  • It would improve performance significantly if larger arrays were sent as binary. This could be done by checking sum(size(variable)) against a threshold and passing it as a binary attachment, similar to how IPython handles display data in the kernel spec.

Octave

  • Had to specify executable='octave'
  • I will send a PR to fix the Octave plotting issue

Recommendations

  • I'd like to deprecate Oct2Py in favor of PyMatBridge - the whole thing is too brittle, and we can get more done together.
  • Add an Octave Magic to PyMatbridge -> similar to the _Session refactor
  • Create the Matlab_Kernel based on MetaKernel, and then the Octave_Kernel based on that. We can later switch to a more "direct" approach once MetaKernel supports it, but I think the standard set of magics is well work flexing for.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment