def __read_comment(self):
"""
Read a single comment.
The comment is stored as an Event in Segment 0, which is
specifically for comments.
----------------------
Returns an empty list.
The returned object is already added to the Block.
No ID number: always called from another method
"""
# float64 -- timestamp (number of days since dec 30th 1899)
time = np.fromfile(self._fsrc, dtype=np.double, count=1)[0]
# int16 -- length of next string
numchars1 = np.asscalar(np.fromfile(self._fsrc,
dtype=np.int16, count=1))
# char * numchars -- the one who sent the comment
sender = self.__read_str(numchars1)
# int16 -- length of next string
numchars2 = np.asscalar(np.fromfile(self._fsrc,
dtype=np.int16, count=1))
# char * numchars -- comment text
text = self.__read_str(numchars2, utf=False)
comment = Event(times=pq.Quantity(time, units=pq.d), labels=text,
sender=sender, file_origin=self._file_origin)
self._seg0.events.append(comment)
return []
评论列表
文章目录