python-2.7raspberry-pioctaveraspbianoct2py

Octave library - 'MeanPeakHeight' invalid parameter


I would like to do a peak detection of a .wav file signal in Python with Octave library on a Raspberry pi 3 with Raspbian but there is a problem with the octave.findpeaks function. I had this error:findpeaks : argument 'MeanPeakHeight' did not match any valid parameter of the parser I have installed all the packages concerning Octave so this is why i don't understand. This is a part of my program :

import matplotlib.pyplot as plt  
import numpy as np  
from scipy.io import wavfile as wav  
from scipy.signal import find_peaks_cwt, butter, lfilter  
from pylab import *  
import os  
from operator import truediv  
from easygui import *  
from oct2py import octave  

"High and Low Frequency for the filter"  

    low = 100  
    high = 50  
    list_file = []  
    octave.eval("pkg load signal")  

def display_wav(wav_file):

    samplerate, beat = wav.read('/home/pi/heartbeat_project/heartbeat_songs/%s' %wav_file)
    beat_resize = np.fromfile(open('/home/pi/heartbeat_project/heartbeat_songs/%s' %wav_file),np.int16)[4*samplerate:float(beat.shape[0])-4*samplerate]
    beat_resize = beat_resize / (2.**15)
    timeArray = arange(0,float(beat_resize.shape[0]),1)
    timeArray = timeArray / samplerate   
    ylow = butter_lowpass_filter(samplerate, 5, low, beat_resize)
    y = butter_highpass_filter(samplerate, 5, high, ylow)


    peaks, indexes = octave.findpeaks(np.array(y),'DoubleSided','MeanPeakHeight',np.std(y))

Solution

  • findpeaks is part of the octave-forge signal package:source file

    This function doesn't have a 'MeanPeakHeight' parameter. Is guess this is a typo and you want 'MinPeakHeight'