Optimal grouping at a nuclear magnetic resonance scanner