code: def from_hdf5(cls, f):
          
          if isinstance(f, str):
              import h5py
              f = h5py.File(f)
  
          pos = quantity_from_hdf5(f['pos'])
          vel = quantity_from_hdf5(f['vel'])
  
          frame = None
          if 'frame' in f:
              g = f['frame']
  
              frame_mod = g.attrs['module']
              frame_cls = g.attrs['class']
              frame_units = [u.Unit(x.decode('utf-8')) for x in g['units']]
  
              if u.dimensionless_unscaled in frame_units:
                  units = DimensionlessUnitSystem()
              else:
                  units = UnitSystem(*frame_units)
  
              pars = dict()
              for k in g['parameters']:
                  pars[k] = quantity_from_hdf5(g['parameters/'+k])
  
              exec("from {0} import {1}".format(frame_mod, frame_cls))
              frame_cls = eval(frame_cls)
  
              frame = frame_cls(units=units, **pars)
  
          return cls(pos=pos, vel=vel, frame=frame)
docs: Load an object from an HDF5 file.
  
          Requires ``h5py``.
  
          Parameters
          ----------
          f : str, :class:`h5py.File`
              Either the filename or an open HDF5 file.