Better Test Sample, python code modified to take 3D