当前位置: 首页>>代码示例>>Python>>正文


Python plt.axis方法代码示例

本文整理汇总了Python中pylab.plt.axis方法的典型用法代码示例。如果您正苦于以下问题:Python plt.axis方法的具体用法?Python plt.axis怎么用?Python plt.axis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pylab.plt的用法示例。


在下文中一共展示了plt.axis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compute_melmat_from_range

# 需要导入模块: from pylab import plt [as 别名]
# 或者: from pylab.plt import axis [as 别名]
def compute_melmat_from_range(lower_edges_hz, upper_edges_hz, num_fft_bands=513, sample_rate=16000):

    melmat = zeros((len(lower_edges_hz), num_fft_bands))
    freqs = linspace(0.0, sample_rate / 2.0, num_fft_bands)
    center_frequencies_hz = mean([lower_edges_hz,upper_edges_hz], axis = 0)

    for imelband, (lower, center, upper) in enumerate(zip(lower_edges_hz, center_frequencies_hz, upper_edges_hz)):

        left_slope = (freqs >= lower) == (freqs <= center)
        melmat[imelband, left_slope] = (
            (freqs[left_slope] - lower) / (center - lower)
        )

        right_slope = (freqs >= center) == (freqs <= upper)
        melmat[imelband, right_slope] = (
            (upper - freqs[right_slope]) / (upper - center)
        )
    return (melmat, center_frequencies_hz, freqs) 
开发者ID:ahodges9,项目名称:LedFx,代码行数:20,代码来源:mel.py

示例2: plot_fit

# 需要导入模块: from pylab import plt [as 别名]
# 或者: from pylab.plt import axis [as 别名]
def plot_fit(self, size=None, tol=0.1, axis_on=True):

        n, d = self.D.shape

        if size:
            nrows, ncols = size
        else:
            sq = np.ceil(np.sqrt(n))
            nrows = int(sq)
            ncols = int(sq)

        ymin = np.nanmin(self.D)
        ymax = np.nanmax(self.D)
        print('ymin: {0}, ymax: {1}'.format(ymin, ymax))

        numplots = np.min([n, nrows * ncols])
        plt.figure()

        for n in range(numplots):
            plt.subplot(nrows, ncols, n + 1)
            plt.ylim((ymin - tol, ymax + tol))
            plt.plot(self.L[n, :] + self.S[n, :], 'r')
            plt.plot(self.L[n, :], 'b')
            if not axis_on:
                plt.axis('off') 
开发者ID:dganguli,项目名称:robust-pca,代码行数:27,代码来源:r_pca.py

示例3: update

# 需要导入模块: from pylab import plt [as 别名]
# 或者: from pylab.plt import axis [as 别名]
def update(self, audio_samples):
        """ Return processed audio data
        Returns mel curve, x/y data
        This is called every time there is a microphone update
        Returns
        -------
        audio_data : dict
            Dict containinng "mel", "vol", "x", and "y"
        """
        min_frequency = self._config["audio_config"]["MIN_FREQUENCY"]
        max_frequency = self._config["audio_config"]["MAX_FREQUENCY"]

        audio_data = {}
        # Normalize samples between 0 and 1
        y = audio_samples / 2.0**15
        # Construct a rolling window of audio samples
        self.y_roll[:-1] = self.y_roll[1:]
        self.y_roll[-1, :] = np.copy(y)
        y_data = np.concatenate(self.y_roll, axis=0).astype(np.float32)
        vol = np.max(np.abs(y_data))
        # Transform audio input into the frequency domain
        N = len(y_data)
        N_zeros = 2**int(np.ceil(np.log2(N))) - N
        # Pad with zeros until the next power of two
        y_data *= self.fft_window
        y_padded = np.pad(y_data, (0, N_zeros), mode='constant')
        YS = np.abs(np.fft.rfft(y_padded)[:N // 2])
        # Construct a Mel filterbank from the FFT data
        mel = np.atleast_2d(YS).T * self.mel_y.T
        # Scale data to values more suitable for visualization
        mel = np.sum(mel, axis=0)
        mel = mel**2.0
        # Gain normalization
        self.mel_gain.update(np.max(gaussian_filter1d(mel, sigma=1.0)))
        mel /= self.mel_gain.value
        mel = self.mel_smoothing.update(mel)
        x = np.linspace(min_frequency, max_frequency, len(mel))
        y = self.fft_plot_filter.update(mel)

        audio_data["mel"] = mel
        audio_data["vol"] = vol
        audio_data["x"]   = x
        audio_data["y"]   = y
        return audio_data 
开发者ID:TobKra96,项目名称:music_led_strip_control,代码行数:46,代码来源:dsp.py


注:本文中的pylab.plt.axis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。