def comprz_dB(xx,fr=0.05):
""" Compress signal in such a way that is logarithmic but also avoids negative values """
x = numpy.copy(xx)
sh = xx.shape
x = x.reshape(-1)
x = comprz(x)
x = numpy.setdiff1d(x,numpy.array([0.0]))
xs = numpy.sort(x)
mini = xs[int(fr*len(x))]
mn = numpy.ones_like(xx)*mini
xx = numpy.where(xx > mini, xx, mn)
xx = xx.reshape(sh)
return(10.0*numpy.log10(xx))
评论列表
文章目录