arokem / python-matlab-bridge

A simple Python => MATLAB(R) interface and a matlab_magic for ipython
BSD 2-Clause "Simplified" License
335 stars 96 forks source link

Existing session #209

Closed brunobeltran closed 9 years ago

brunobeltran commented 9 years ago

PR Contains:

  1. Preliminary solution to Issue #196.
  2. Reorganization of code to facilitate Matlab scripts that use pymatbridge to call Python functions. Separation of concerns (moving _preamble_code to matlabserver helper functions) is how I think the solution to #13 should look.
  3. Replaced all "print" and *.write() statements with configurable logging.
  4. Tried to update code comments that were out of date.

The new convention for connecting to Matlab is that

lab = Matlab(executable=something, ...)

follows the old behavior, while

lab = Matlab(executable=None, socket_addr='ipc:///something', ...)

connects to a Matlab sessions where the matlabserver.m function is being executed.

The only thing I'm having trouble getting to work is the new "separate" command, designed for when you've started a Matlab session via Matlab(executable=matlab).start() and later decide that what you need to do requires (or would just be nicer) if you were to drop into Matlab proper without having to save, exit, and reload the workspace. Combined with the ability to dynamically connect to Matlab, this could facilitate workflows that involve actively switching back and forth.

On my box, calling something like lab = Matlab() lab.start() lab.separate() opens the Matlab desktop GUI, as expected, but the ZMQ socket and context closing messages are mysteriously printed twice, and the GUI eventually exists without becoming available for use. Any ideas here?

brunobeltran commented 9 years ago

Man, it must have been really late when I made the pull request. Problem with lab.separate() was super simple. Fixed now, as well as some bug fixes in messenger.c that I missed in my half-asleep state.

brunobeltran commented 9 years ago

rebase'd over my previous pull request, so this branch should be merge-able. Any thoughts on why it hasn't been merged, or is it just a not-enough-time thing?

arokem commented 9 years ago

Just not-enough-time. I really want to sort out the Travis breakage on master, before considering any more massive changes, but have been too busy with a host of other things, and this has languished. Again - working towards a deadline mid-next-week, but might have time to look towards the end of the week. Sorry for the delay...

On Thu, Sep 10, 2015 at 10:35 PM, Bruno Beltran notifications@github.com wrote:

rebase'd over my previous pull request, so this branch should be merge-able. Any thoughts on why it hasn't been merged, or is it just a not-enough-time thing?

— Reply to this email directly or view it on GitHub https://github.com/arokem/python-matlab-bridge/pull/209#issuecomment-139458299 .

arokem commented 9 years ago

Can I close this one? Looks like it's superseded by #218

brunobeltran commented 9 years ago

Oh, didn't realize I had the inf-fix stuff over this branch. Putting it all in one place sounds fine to me.