def create_entry(group, name, timestamp, **attributes): """Create a new ARF entry under group, setting required attributes. An entry is an abstract collection of data which all refer to the same time frame. Data can include physiological recordings, sound recordings, and derived data such as spike times and labels. See add_data() for information on how data are stored. name -- the name of the new entry. any valid python string. timestamp -- timestamp of entry (datetime object, or seconds since January 1, 1970). Can be an integer, a float, or a tuple of integers (seconds, microsceconds) Additional keyword arguments are set as attributes on created entry. Returns: newly created entry object """ # create group using low-level interface to store creation order from h5py import h5p, h5g, _hl try: gcpl = h5p.create(h5p.GROUP_CREATE) gcpl.set_link_creation_order( h5p.CRT_ORDER_TRACKED | h5p.CRT_ORDER_INDEXED) except AttributeError: grp = group.create_group(name) else: name, lcpl = group._e(name, lcpl=True) grp = _hl.group.Group(h5g.create(group.id, name, lcpl=lcpl, gcpl=gcpl)) set_uuid(grp, attributes.pop("uuid", None)) set_attributes(grp, timestamp=convert_timestamp(timestamp), **attributes) return grp
def create_entry(obj, name, timestamp, **attributes): """Create a new ARF entry under obj, setting required attributes. An entry is an abstract collection of data which all refer to the same time frame. Data can include physiological recordings, sound recordings, and derived data such as spike times and labels. See add_data() for information on how data are stored. name -- the name of the new entry. any valid python string. timestamp -- timestamp of entry (datetime object, or seconds since January 1, 1970). Can be an integer, a float, or a tuple of integers (seconds, microsceconds) Additional keyword arguments are set as attributes on created entry. Returns: newly created entry object """ # create group using low-level interface to store creation order from h5py import h5p, h5g from h5py._hl import group try: gcpl = h5p.create(h5p.GROUP_CREATE) gcpl.set_link_creation_order(h5p.CRT_ORDER_TRACKED | h5p.CRT_ORDER_INDEXED) except AttributeError: grp = obj.create_group(name) else: grp = group.Group(h5g.create(obj.id, name, lcpl=None, gcpl=gcpl)) set_uuid(grp, attributes.pop("uuid", None)) set_attributes(grp, timestamp=convert_timestamp(timestamp), **attributes) return grp
def create_group(self, name): """ Create and return a new subgroup. Name may be absolute or relative. Fails if the target name already exists. """ name, lcpl = self._e(name, lcpl=True) gid = h5g.create(self.id, name, lcpl=lcpl) return Group(gid)