Skip to content

Commit

Permalink
Fixed "freq" - it was not normalized to 1. Bump to 1.0.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkff committed May 1, 2012
1 parent 20910fe commit 91115cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Tools/TimePlot/Plots.hs
Expand Up @@ -32,7 +32,8 @@ initGen (KindACount bs) = genActivity (\sns n -> n) bs
initGen (KindAPercent bs b) = genActivity (\sns n -> 100*n/b) bs initGen (KindAPercent bs b) = genActivity (\sns n -> 100*n/b) bs
initGen (KindAFreq bs) = genActivity (\sns n -> if n == 0 then 0 else (n / sum (M.elems sns))) bs initGen (KindAFreq bs) = genActivity (\sns n -> if n == 0 then 0 else (n / sum (M.elems sns))) bs
initGen (KindFreq bs k) = genAtoms atoms2freqs bs k initGen (KindFreq bs k) = genAtoms atoms2freqs bs k
where atoms2freqs as m = let n = length as in 0:[fromIntegral (M.findWithDefault 0 a m)/fromIntegral n | a <- as] where atoms2freqs as m = let s = sum [c | (a,c) <- M.toList m]
in if s==0 then [0] else 0:[fromIntegral (M.findWithDefault 0 a m)/fromIntegral s | a <- as]
initGen (KindHistogram bs k) = genAtoms atoms2hist bs k initGen (KindHistogram bs k) = genAtoms atoms2hist bs k
where atoms2hist as m = 0:[fromIntegral (M.findWithDefault 0 a m) | a <- as] where atoms2hist as m = 0:[fromIntegral (M.findWithDefault 0 a m) | a <- as]
initGen KindEvent = genEvent initGen KindEvent = genEvent
Expand Down
2 changes: 1 addition & 1 deletion timeplot.cabal
@@ -1,5 +1,5 @@
name: timeplot name: timeplot
version: 1.0.7 version: 1.0.8
cabal-version: >=1.6 cabal-version: >=1.6
build-type: Simple build-type: Simple
license: BSD3 license: BSD3
Expand Down

0 comments on commit 91115cb

Please sign in to comment.