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


Python pylab.axvline方法代码示例

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


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

示例1: pick_peaks

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axvline [as 别名]
def pick_peaks(nc, L=16):
    """Obtain peaks from a novelty curve using an adaptive threshold."""
    offset = nc.mean() / 20.

    nc = filters.gaussian_filter1d(nc, sigma=4)  # Smooth out nc

    th = filters.median_filter(nc, size=L) + offset
    #th = filters.gaussian_filter(nc, sigma=L/2., mode="nearest") + offset

    peaks = []
    for i in range(1, nc.shape[0] - 1):
        # is it a peak?
        if nc[i - 1] < nc[i] and nc[i] > nc[i + 1]:
            # is it above the threshold?
            if nc[i] > th[i]:
                peaks.append(i)
    #plt.plot(nc)
    #plt.plot(th)
    #for peak in peaks:
        #plt.axvline(peak)
    #plt.show()

    return peaks 
开发者ID:urinieto,项目名称:msaf,代码行数:25,代码来源:segmenter.py

示例2: plot_signal_and_label

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axvline [as 别名]
def plot_signal_and_label(self, title, timestamp, signal, label_timestamp, label):
        if not self.to_save and not self.to_show:
            return

        pylab.figure()

        pylab.plot(timestamp, signal, color='m', label='signal')

        for i in range(0, len(label_timestamp)):
            pylab.axvline(label_timestamp[i], color="k", label="{}: key {}".format(i, label[i]), ls='dashed')

        pylab.legend()

        pylab.title(title)
        pylab.xlabel('Time')
        pylab.ylabel('Amplitude') 
开发者ID:tonybeltramelli,项目名称:Deep-Spying,代码行数:18,代码来源:View.py

示例3: plot_sensor_data_and_segment

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axvline [as 别名]
def plot_sensor_data_and_segment(self, title, timestamp, x, y, z, segment, label):
        if not self.to_save and not self.to_show:
            return

        self.big_figure()

        pylab.plot(timestamp, x, color='r', label='x')
        pylab.plot(timestamp, y, color='g', label='y')
        pylab.plot(timestamp, z, color='b', label='z')

        for i in range(0, len(segment)):
            pylab.axvline(segment[i][0], color="c", ls='dashed')
            pylab.axvline(segment[i][1], color="k", label="{}: key {}".format(i, label[i]), ls='dashed')
            pylab.axvline(segment[i][2], color="m", ls='dashed')

        pylab.legend()

        pylab.title(title)
        pylab.xlabel('Time')
        pylab.ylabel('Amplitude') 
开发者ID:tonybeltramelli,项目名称:Deep-Spying,代码行数:22,代码来源:View.py

示例4: plot

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axvline [as 别名]
def plot(self):
        import pylab as plt

        q_ticks_int = [self.q_dist[i] for i in self.q_ticks]
        q_ticks_label = self.q_labels
        for i, q in enumerate(q_ticks_label):
            if q in self.translate_to_pylab:
                q_ticks_label[i] = self.translate_to_pylab[q]
        plt.plot(self.q_dist, self.ew_list)
        plt.xticks(q_ticks_int, q_ticks_label)
        for x in q_ticks_int:
            plt.axvline(x, color="black")
        return plt 
开发者ID:pyiron,项目名称:pyiron,代码行数:15,代码来源:bandstructure.py

示例5: plot_objectivefunction

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axvline [as 别名]
def plot_objectivefunction(results,evaluation,limit=None,sort=True, fig_name = 'objective_function.png'):
    """Example Plot as seen in the SPOTPY Documentation"""
    import matplotlib.pyplot as plt
    likes=calc_like(results,evaluation,spotpy.objectivefunctions.rmse)
    data=likes
    #Calc confidence Interval
    mean = np.average(data)
    # evaluate sample variance by setting delta degrees of freedom (ddof) to
    # 1. The degree used in calculations is N - ddof
    stddev = np.std(data, ddof=1)
    from scipy.stats import t
    # Get the endpoints of the range that contains 95% of the distribution
    t_bounds = t.interval(0.999, len(data) - 1)
    # sum mean to the confidence interval
    ci = [mean + critval * stddev / np.sqrt(len(data)) for critval in t_bounds]
    value="Mean: %f" % mean
    print(value)
    value="Confidence Interval 95%%: %f, %f" % (ci[0], ci[1])
    print(value)
    threshold=ci[1]
    happend=None
    bestlike=[data[0]]
    for like in data:
        if like<bestlike[-1]:
            bestlike.append(like)
        if bestlike[-1]<threshold and not happend:
            thresholdpos=len(bestlike)
            happend=True
        else:
            bestlike.append(bestlike[-1])
    if limit:
        plt.plot(bestlike,'k-')#[0:limit])
        plt.axvline(x=thresholdpos,color='r')
        plt.plot(likes,'b-')
        #plt.ylim(ymin=-1,ymax=1.39)
    else:
        plt.plot(bestlike)
    plt.savefig(fig_name) 
开发者ID:thouska,项目名称:spotpy,代码行数:40,代码来源:analyser.py

示例6: plot_sensor_data_and_label

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axvline [as 别名]
def plot_sensor_data_and_label(self, title, timestamp, x, y, z, label_timestamp, label=None):
        if not self.to_save and not self.to_show:
            return

        self.big_figure()

        pylab.plot(timestamp, x, color='r', label='x')
        pylab.plot(timestamp, y, color='g', label='y')
        pylab.plot(timestamp, z, color='b', label='z')

        for i in range(0, len(label_timestamp)):
            if label is not None:
                if i != 0:
                    pylab.axvline(label_timestamp[i], color="k", ls='dashed')
                else:
                    pylab.axvline(label_timestamp[i], color="k", label="keystroke", ls='dashed')
            else:
                pylab.axvline(label_timestamp[i], color="k", ls='dashed')

        pylab.legend()

        pylab.title(title)
        pylab.xlabel('Time')
        pylab.ylabel('Amplitude')
        if label:
            pylab.xticks(label_timestamp, label) 
开发者ID:tonybeltramelli,项目名称:Deep-Spying,代码行数:28,代码来源:View.py

示例7: processFlat

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axvline [as 别名]
def processFlat(self):
        """Main process.
        Returns
        -------
        est_idxs : np.array(N)
            Estimated indeces the segment boundaries in frames.
        est_labels : np.array(N-1)
            Estimated labels for the segments.
        """
        # Preprocess to obtain features
        F = self._preprocess()

        # Normalize
        F = msaf.utils.normalize(F, norm_type=self.config["bound_norm_feats"])

        # Make sure that the M_gaussian is even
        if self.config["M_gaussian"] % 2 == 1:
            self.config["M_gaussian"] += 1

        # Median filter
        F = median_filter(F, M=self.config["m_median"])
        #plt.imshow(F.T, interpolation="nearest", aspect="auto"); plt.show()

        # Self similarity matrix
        S = compute_ssm(F)

        # Compute gaussian kernel
        G = compute_gaussian_krnl(self.config["M_gaussian"])
        #plt.imshow(S, interpolation="nearest", aspect="auto"); plt.show()

        # Compute the novelty curve
        nc = compute_nc(S, G)

        # Find peaks in the novelty curve
        est_idxs = pick_peaks(nc, L=self.config["L_peaks"])

        # Add first and last frames
        est_idxs = np.concatenate(([0], est_idxs, [F.shape[0] - 1]))

        # Empty labels
        est_labels = np.ones(len(est_idxs) - 1) * -1

        # Post process estimations
        est_idxs, est_labels = self._postprocess(est_idxs, est_labels)

        return est_idxs, est_labels
        # plt.figure(1)
        # plt.plot(nc);
        # [plt.axvline(p, color="m") for p in est_bounds]
        # [plt.axvline(b, color="g") for b in ann_bounds]
        # plt.figure(2)
        # plt.imshow(S, interpolation="nearest", aspect="auto")
        # [plt.axvline(b, color="g") for b in ann_bounds]
        # plt.show() 
开发者ID:urinieto,项目名称:msaf,代码行数:56,代码来源:segmenter.py


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