def __init__(self, uri, dataset=None, **kwds): #--------------------------------------------- newfile = kwds.pop('create', False) if uri is None and (newfile or dataset is None): raise TypeError("No URI given for HDF5 recording") if uri is not None: BSMLRecording.__init__(self, uri, dataset, **kwds) if dataset: if newfile: self._h5 = H5Recording.create(uri, str(dataset), **kwds) self.graph = RecordingGraph(uri, rec_class=HDF5Recording) else: self._h5 = H5Recording.open(dataset, **kwds) if uri is None: BSMLRecording.__init__(self, self._h5.uri, dataset, **kwds) elif str(uri) != str(self._h5.uri): raise TypeError("Wrong URI in HDF5 recording") self._load_metadata() for n, s in enumerate(self._h5.signals()): signal = HDF5Signal.create_from_H5Signal(n, s) signal.add_metadata(self.graph) signal.clock.add_metadata( self.graph) ## We need to cache clocks in recording... self.add_signal(signal) else: self._h5 = None
def __init__(self, uri, dataset=None, **kwds): # --------------------------------------------- newfile = kwds.pop("create", False) if uri is None and (newfile or dataset is None): raise TypeError("No URI given for HDF5 recording") if uri is not None: BSMLRecording.__init__(self, uri, dataset, **kwds) if dataset: if newfile: self._h5 = H5Recording.create(uri, str(dataset), **kwds) self.graph = RecordingGraph(uri, rec_class=HDF5Recording) else: self._h5 = H5Recording.open(dataset, **kwds) if uri is None: BSMLRecording.__init__(self, self._h5.uri, dataset, **kwds) elif str(uri) != str(self._h5.uri): raise TypeError("Wrong URI in HDF5 recording") self._load_metadata() for n, s in enumerate(self._h5.signals()): signal = HDF5Signal.create_from_H5Signal(n, s) signal.add_metadata(self.graph) signal.clock.add_metadata(self.graph) ## We need to cache clocks in recording... self.add_signal(signal) else: self._h5 = None
def __init__(self, uri, dataset=None, **kwds): #--------------------------------------------- BSMLRecording.__init__(self, uri=uri, dataset=dataset, **kwds) self._edffile = None newfile = kwds.pop('create', False) if dataset: if newfile: pass ## Future... else: self.initialise() self._set_attributes()
def new_signal(self, uri, units, id=None, **kwds): # ------------------------------------------------- """ Create a new signal and add it to the recording. :param uri: The URI for the signal. :param units: The physical units of the signal's data. :rtype: :class:`HDF5Signal` :param kwds: Other :class:`~biosignalml.Signal` attributes to set. """ sig = BSMLRecording.new_signal(self, uri, units, id=id, **kwds) if self._h5: if sig.clock: self._h5.create_clock(sig.clock.uri, sig.clock.units, times=sig.clock.times) kwds["clock"] = sig.clock.uri sig._h5 = self._h5.create_signal(sig.uri, units, **kwds) return sig
def new_signal(self, uri, units, id=None, **kwds): #------------------------------------------------- """ Create a new signal and add it to the recording. :param uri: The URI for the signal. :param units: The physical units of the signal's data. :rtype: :class:`HDF5Signal` :param kwds: Other :class:`~biosignalml.Signal` attributes to set. """ sig = BSMLRecording.new_signal(self, uri, units, id=id, **kwds) if self._h5: if sig.clock: self._h5.create_clock(sig.clock.uri, sig.clock.units, times=sig.clock.times) kwds['clock'] = sig.clock.uri sig._h5 = self._h5.create_signal(sig.uri, units, **kwds) return sig
def __init__(self, uri, fname=None, **kwds): #------------------------------------------- BSMLRecording.__init__(self, uri=uri, fname=fname, **kwds) self._siginfo = None