第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在python中獲取軸坐標(biāo)

如何在python中獲取軸坐標(biāo)

縹緲止盈 2023-02-07 16:02:41
我正在嘗試在收集信號的全局峰值和谷值的地方實(shí)現(xiàn)峰值檢測,但是,當(dāng)我將其實(shí)現(xiàn)為一個簡單的信號時(shí),該功能可以完美運(yùn)行,沒有錯誤。但是,當(dāng)我將代碼運(yùn)行到大量數(shù)據(jù)集(大約 9000 個樣本)中時(shí),它一直給我這個錯誤:TypeError: only integer scalar arrays can be converted to a scalar index我的峰值檢測功能可以在下面找到:def custom_peakdetection_envelope(y_axis, peak_height, x_axis=None):    """    keyword arguments:    y_axis -- A list containing the signal over which to find peaks    x_axis -- (optional) A x-axis whose values correspond to the 'y_axis' list and is used in the return to specify the position of the peaks. If omitted the index of the y_axis is used. (default: None)    peak_height --  This specifies a minimum height of the peak        return -- two lists [maxtab, mintab] containing the positive and negative peaks respectively. Each cell of the lists contains a tuple of:    (position, peak_value) to get the average peak value do 'np.mean(maxtab, 0)[1]' on the results    """        global amplitude_envelope_y    global amplitude_envelope_x        maxtab = []    mintab = []    maxthresh = []    minthresh = []    ax = []    amplitude_envelope_mx = []    amplitude_envelope_mn = []    if x_axis is None:        x = arange(len(y_axis))    else:        x = asarray(x_axis)    y = asarray(y_axis)    ax.append((x,y))    if len(y) != len(x):        sys.exit('Input vectors y and x must have same length')    if not isscalar(peak_height):        sys.exit('Input argument peak_height must be a scalar')    # if peak_height <= 0:    #     sys.exit('Input argument peak_height must be positive')    # maxima and minima candidates are temporarily stored in mx and mn respectively:    mn, mx = np.Inf, -np.Inf    mnpos, mxpos = NaN, NaN   
查看完整描述

1 回答

?
冉冉說

TA貢獻(xiàn)1877條經(jīng)驗(yàn) 獲得超1個贊

也許process_x_max_peak必須更改為容納整數(shù)。嘗試以下操作:

process_y[process_x_max_peak.astype(int)]


查看完整回答
反對 回復(fù) 2023-02-07
  • 1 回答
  • 0 關(guān)注
  • 202 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號