Today I altered beamPath.m in alamode to support gwmcmc.m, which is pretty much emcee for matlab. (The gw in gwmcmc stands for GoodmanWeare MCMC algorithm, not gravitational waves).
It's capabilities are pretty limited, all it can do is move around optics. It cannot set hard limits on where an optic can be placed yet, and it cannot vary a lens' focal length. It would be easy to add these capabilities for the future.
My log likelihood for the MCMC algorithm is 0.5 * [ weight1 * (1  overlap)^2 + weight2 * positionSensitivity^2 ], where weight1 = 100 and weight2 = 1. The user can choose how much to weight each metric which quantifies the quality of the mode match. Overlap and positionSensitivity were already calculated for me by alamode.
I ran the MCMC on our North path mode matching, allowing two of our lens to move around by about 20 cm for our old lens focal lengths. Initially, Lens1 was 0.9625 m from the PMC and Lens2 was 1.3717 m.
I get two peaks of different mode matching, which I thought was pretty cool. My final results for the Lens2 position ended up pretty far away from where I started, which is not physically possible in our setup. Need to add hard limits to this.
Not sure how to distribute this. It's in the tar in this ELOG. Will also copy this to Git/labutils/alm. Once it's cleaned up, our future person could make a pull request on github/alm.
Quote: 
This fragility of MM is one of those things we ought to develop a MCMC for. Jenne did something like this for the 40m input mode matching a long time ago, but that was before I understood what corner plots were for.
I wonder if JamMT or alaMode have the ability to be run to generate corner plots. If so, we could find out the sensitivity to lens positions and lens focal length errors in a visually useful way for each mode matching solution (generated from the discrete set of available focal lengths in the CVI catalog).
Might be a project to give to the CTN SURF this summer.

