def _impose_white_noise(self, data):
import scipy.stats as stats
original_shape = data.shape
noise_area_distr = stats.expon(scale = self._white_noise_rate)
data = data.reshape(data.shape[0], -1)
s = data.shape[1]
for i in xrange(data.shape[0]):
n_white_noise = int(np.minimum(noise_area_distr.rvs(size=1), self._white_noise_maximum) * s)
indx = np.random.choice(s, size=n_white_noise, replace=False)
data[i, indx] = self._signal_level
return data.reshape(original_shape)
lowbrightnessgenerator.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录