code for logging hGMM sampling