We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Something like this (multichannels not supported in this example)
class SpectralFlux(Feature): axis = Parameter(0) fmin = Parameter() fmax = Parameter() def requires(self): yield AbsRfft def on_start(self, source, featureset, sink): nfft = featureset['AbsRfft'].nfft freqs = featureset['AbsRfft'].frequencies fmin, fmax = self.fmin, self.fmax if fmin and fmax: self._index = np.logical_and(freqs >=fmin, freqs < fmax) nfft = np.sum(self._index) else: self._index = self._lastspec > 0 if source.channels > 1: self._lastspec = np.ones((nfft, source.channels)) else: self._lastspec = np.ones(nfft) if not any(self._index): raise ValueError('Could not find frequency bins between {} and {} Hz'.format(fmin, fmax)) def process(self, data, featuredata): curspec = featuredata['AbsRfft'][self._index] ds = curspec - self._lastspec specflux = np.sum((ds + np.abs(ds)) * 0.5) self._lastspec = curspec return specflux @classmethod def gen_by_edge_frequencies(cls, edgefreqs, prefixname='SpectralFlux'): for le, ue in zip(edgefreqs[:-1], edgefreqs[1:]): yield cls(name='{}{}to{}Hz'.format(cls.__name__, le, ue), fmin=le, fmax=ue)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Something like this (multichannels not supported in this example)
The text was updated successfully, but these errors were encountered: