def pretty_string_samples(self, idx_start=0, idx_end=20, precision=4, header=False):
s = ''
if header:
t = ' '
u = 'ch'
for i in range(self.ch):
t += '-------:'
u += ' %2i :' %(i+1)
t += '\n'
u += '\n'
s += t # -------:-------:-------:
s += u # ch 1 : 2 : 3 :
s += t # -------:-------:-------:
s += np.array_str(self.samples[idx_start:idx_end,:],
max_line_width=260, # we can print 32 channels before linewrap
precision=precision,
suppress_small=True)
if (idx_end-idx_start) < self.nofsamples:
s = s[:-1] # strip the right ']' character
s += '\n ...,\n'
lastlines = np.array_str(self.samples[-3:,:],
max_line_width=260,
precision=precision,
suppress_small=True)
s += ' %s\n' %lastlines[1:] # strip first '['
return s
评论列表
文章目录