Converting experiment to MWEL

Hi Chris,

Our seat upgrade still hasn’t processed, so here is the important code.

The key XML file is HoldAndDetectConstant/HoldAndDetectConstant8.xml

Thanks,
Mark

Hi Mark, Anna, & Paul,

I had a look at the hold-and-detect experiment XML. One thing that immediately seems clear is that it would be crazy (in terms of both the tedium and the likelihood of introducing errors) to try to convert this to MWEL by hand. The rough XML-to-MWEL translator that I wrote for Mark does a decent job with it, but there’s certainly room for improvement.

I think the first step is to improve the automatic XML-to-MWEL translation to produce output that is clean, readable, and as MWEL-ish as possible (and also preserves XML comments, which the current convertor does not). Once that’s done, and I have a good automatic translation in hand, I’ll think about ways to restructure the experiment to take advantage of MWEL’s more sophisticated features (i.e. includes and macros).

Chris

That sounds great from my perspective, Chris.

We want to improve the experiemnt in a few ways (i.e. replacing that huge set of if statements with array accesses), but I think the right thing to do is let you do the auto-convert to MWEL first, then make our changes.

If you could do this by mid- to end- December or so, that would be great - we’re starting to get animals ready for this experiment.

Mark

Hi Mark et al,

I’ve attached the automatic conversion of HoldAndDetectConstant8 to MWEL. Apart from maybe warranting some aesthetic tweaks (e.g. adding some blank lines for readability, moving some comments around), I think it’s in pretty good shape. It makes use of a couple recent changes I made to MWEL, so to run it, you’ll need the latest MWorks nightly build.

Also in the current nightly is the tool (aptly called xml2mwel) that did the conversion. To convert other experiments, open up Terminal and invoke xml2mwel like this:

/Library/Application\ Support/MWorks/MWEL/xml2mwel exp.xml > exp.mwel

If there are issues with the conversion, the script will print some error messages (although there really isn’t much that can go wrong).

If you see anything that the converter got wrong or have suggestions for how to make it better, please let me know!

Chris