Mercurial > hg > segmentation
diff novelty.py @ 8:a34f9c5d0cd9
remove pyc files tracked by mistake
author | mitian |
---|---|
date | Mon, 11 May 2015 17:29:19 +0100 |
parents | 294f66d285af |
children | c01fcb752221 |
line wrap: on
line diff
--- a/novelty.py Tue May 05 08:54:09 2015 +0100 +++ b/novelty.py Mon May 11 17:29:19 2015 +0100 @@ -46,6 +46,17 @@ novelty = (novelty - np.min(novelty)) / (np.max(novelty) - np.min(novelty)) return novelty +def getNoveltyDiff(novelty, N=1, relative=False): + '''Return the second order differece in the novelty curve.''' + + diff = np.zeros_like(novelty) + diff[:-N] = np.diff(novelty, n=N) + + if relative: + diff /= novelty + + return diff + def getDiagonalSlice(ssm, width): ''' Return a diagonal stripe of the ssm given its width, with 45 degrees rotation. Note: requres 45 degrees rotated kernel also.'''