def average_power(args): """ Average power = sum of PSD (in decibel) divided by number of pixels :param args: :return: """ psddb = get_psddb(args) return np.sum(psddb) / np.size(psddb)
def max_power(args): """ Max power is the darkest pixel in the spectrogram :param args: :return: """ psddb = get_psddb(args) return np.max(psddb)
def average_frame_power(args): """ Average power = sum of PSD (in decibel) divided by number of pixels :param args: :return: """ psddb = get_psddb(args) return np.mean(psddb, axis=0)
def dominant_frequency(args): """ Dominant frequency is the frequency at which max power occurs :param args: :return: """ psddb = get_psddb(args) fs = args['fs'] max_indices = np.argmax(psddb, axis=0) nyquist = fs / 2.0 return max_indices / psddb.shape[0] * nyquist
def max_frequency(args): """ Max frequency is the frequency at which max power occurs :param args: :return: float: max frequency over the entire duration """ psddb = get_psddb(args) fs = args['fs'] max_index = np.argmax(np.max(psddb, axis=1)) nyquist = fs / 2.0 return max_index / psddb.shape[0] * nyquist