This is related to bob.bio.gmm#17 (closed) I thought it would be best to have the function here rather than bob.bio.gmm.