def proc_src_condition_unit(spikeunit, sweepLen, side, ADperiod, respWin, damaIndexes, timeStamps, filename): '''Get the unit in a condition in a src file that has been processed by the official matlab function. See proc_src for details''' if not damaIndexes: damaIndexes = [0] * len(spikeunit) timeStamps = [0] * len(spikeunit) trains = [] for sweep, damaIndex, timeStamp in zip(spikeunit, damaIndexes, timeStamps): timeStamp = brainwaresrcio.convert_brainwaresrc_timestamp(timeStamp) train = proc_src_condition_unit_repetition(sweep, damaIndex, timeStamp, sweepLen, side, ADperiod, respWin, filename) trains.append(train) return trains
def proc_src_comments(srcfile, filename): '''Get the comments in an src file that has been#!N processed by the official matlab function. See proc_src for details''' comm_seg = Segment(name='Comments', file_origin=filename) commentarray = srcfile['comments'].flatten()[0] senders = [res[0] for res in commentarray['sender'].flatten()] texts = [res[0] for res in commentarray['text'].flatten()] timeStamps = [res[0, 0] for res in commentarray['timeStamp'].flatten()] timeStamps = np.array(timeStamps, dtype=np.float32) t_start = timeStamps.min() timeStamps = pq.Quantity(timeStamps - t_start, units=pq.d).rescale(pq.s) texts = np.array(texts, dtype='S') senders = np.array(senders, dtype='S') t_start = brainwaresrcio.convert_brainwaresrc_timestamp(t_start.tolist()) comments = Event(times=timeStamps, labels=texts, senders=senders) comm_seg.events = [comments] comm_seg.rec_datetime = t_start return comm_seg
def proc_src_comments(srcfile, filename): '''Get the comments in an src file that has been#!N processed by the official matlab function. See proc_src for details''' comm_seg = Segment(name='Comments', file_origin=filename) commentarray = srcfile['comments'].flatten()[0] senders = [res[0] for res in commentarray['sender'].flatten()] texts = [res[0] for res in commentarray['text'].flatten()] timeStamps = [res[0, 0] for res in commentarray['timeStamp'].flatten()] timeStamps = np.array(timeStamps, dtype=np.float32) t_start = timeStamps.min() timeStamps = pq.Quantity(timeStamps - t_start, units=pq.d).rescale(pq.s) texts = np.array(texts, dtype='S') senders = np.array(senders, dtype='S') t_start = brainwaresrcio.convert_brainwaresrc_timestamp(t_start.tolist()) comments = EventArray(times=timeStamps, labels=texts, senders=senders) comm_seg.eventarrays = [comments] comm_seg.rec_datetime = t_start return comm_seg
def proc_src_comments(srcfile, filename): '''Get the comments in an src file that has been#!N processed by the official matlab function. See proc_src for details''' comm_seg = Segment(name='Comments', file_origin=filename) commentarray = srcfile['comments'].flatten()[0] senders = [res[0] for res in commentarray['sender'].flatten()] texts = [res[0] for res in commentarray['text'].flatten()] timeStamps = [res[0, 0] for res in commentarray['timeStamp'].flatten()] for sender, text, timeStamp in zip(senders, texts, timeStamps): time = pq.Quantity(timeStamp, units=pq.d) timeStamp = brainwaresrcio.convert_brainwaresrc_timestamp(timeStamp) commentevent = Event(time=time, label=str(text), sender=str(sender), name='Comment', file_origin=filename, description='container for a comment', timestamp=timeStamp) comm_seg.events.append(commentevent) return comm_seg