code: def sortframe(frame):
      '''
      sorts particles for a frame
      '''
      d = frame['data'];
      sortedargs = np.lexsort([d['xi'],d['yi'],d['zi']])
      d = d[sortedargs];
      frame['data']=d;
      return framef sortframe(frame):
      '''
      sorts particles for a frame
      '''
      d = frame['data'];
      sortedargs = np.lexsort([d['xi'],d['yi'],d['zi']])
      d = d[sortedargs];
      frame['data']=d;
      return frame;
docs: sorts particles for a frame