Hi Chris,
Is there any way to spin up MWorks with a Workspace file, and run a specified number of trials, incl. Matlab and Py bridges? Best would be the ability to specify a variable file on the command line (or I could edit the workspace file), and run headless. Do you do this sort of thing?
Mark
Hi Mark,
We do have a tool for unit testing (/Library/Application Support/MWorks/Developer/tests/MarionetteTest.app
). However, it doesn’t use the MWClient application. Instead, it uses the core mw::Client
class to interact with an MWServer instance. It’s also kind of terrible, and I wouldn’t recommend trying to use it for anything.
At present, the MWClient app doesn’t support any kind of automation. I’ve considered adding AppleScript support to it, but I suspect that wouldn’t see much use.
Can I ask what you’d like to accomplish? Are you really interested in unit testing your experiments, or are you thinking more about automating regular runs?
Chris
Hi Chris,
Yes, I’m trying to unit test experiments. When you come down here, I can show you in more detail our setup and discuss why. (Basically it’s because (1) without local scoping or functions, it’s really hard to make sure changes don’t break things elsewhere; we often have 10-20 animals running on an expt with different variable values at any given time and (2) my external device control can be a little flaky and benefits from testing.)
For that testing, I’d like to be able to provide a variables file, XML file, Python bridge file and MATLAB file, and have the server run that experiment for some amount of time.
I don’t think it’s worth you spending time to make that work. Let’s put it on hold till you visit.
On a related note, I recently saw some discussions of how best to build state machines in Python:
this on Javascript (similar ideas in py) How I Learned to Stop Worrying and ❤️ the State Machine http://raganwald.com/2018/02/23/forde.html
There’s a design patterns summary: StateMachine — Python 3 Patterns, Recipes and Idioms http://python-3-patterns-idioms-test.readthedocs.io/en/latest/StateMachine.html
And the library from Tal Yarkoni: GitHub - pytransitions/transitions: A lightweight, object-oriented finite state machine implementation in Python with many extensions https://github.com/pytransitions/transitions
I know you’ve made the argument that defining a state machine in python would be difficult/impossible for most MWorks users. For what my group does, I still think the best soln for us going forward is to replace xml/mwel with python. But I don’t have much time to think about that these days. We can talk about this again in person sometime.
Mark