timeplot 0.3.9 → 0.3.10
raw patch · 2 files changed
+15/−15 lines, 2 files
Files
- Tools/TimePlot.hs +14/−14
- timeplot.cabal +1/−1
Tools/TimePlot.hs view
@@ -294,21 +294,21 @@ makeChart chartKindF events0 minT maxT zoomMode transformLabel = renderLayout1sStacked plots where events :: [(t, InEvent)]- events@((t0,_):_) = {-# SCC "sortEvents" #-} sortBy (comparing (\(t,_)-> t)) events0+ events@((t0,_):_) = sortBy (comparing (\(t,_)-> t)) events0 track2events :: M.Map S.ByteString [(t, InEvent)]- track2events = {-# SCC "track2events" #-} reverse `fmap` foldl' insert M.empty [(evt_track e, x) | x@(t, e) <- events]+ track2events = reverse `fmap` foldl' insert M.empty [(evt_track e, x) | x@(t, e) <- events] where insert m (s, r) = M.alter (Just . maybe [r] (r:)) s m - plots = {-# SCC "plots" #-} [ plotTrack k kind es | (k, es) <- M.toList track2events,+ plots = [ plotTrack k kind es | (k, es) <- M.toList track2events, kind <- chartKindF k, case kind of {KindNone -> False ; KindWithin _ _ -> False ; _ -> True} ] ++ withinPlots - withinPlots = {-# SCC "withinPlots" #-} [ plotWithKind name k es | (name, (k,es)) <- M.toList withinTracks ]+ withinPlots = [ plotWithKind name k es | (name, (k,es)) <- M.toList withinTracks ] where- withinTracks = {-# SCC "withinTracks" #-} M.fromListWith (\(ka,as) (kb,bs) -> (ka,mergeOn fst as bs)) components- components = {-# SCC "components" #-} [ (mn k, (sk, es))+ withinTracks = M.fromListWith (\(ka,as) (kb,bs) -> (ka,mergeOn fst as bs)) components+ components = [ (mn k, (sk, es)) | (k, es) <- M.toList track2events, kind <- chartKindF k, Just (sk,mn) <- [case kind of {KindWithin mn sk -> Just (sk,mn) ; _ -> Nothing}]]@@ -325,10 +325,10 @@ maxOutTime = case (zoomMode, maxT) of (ZoomOutput, Just t) -> t ; _ -> last times times :: [t]- times = {-# SCC "times" #-} sort $ [t | tes <- M.elems track2events, (t,_)<- tes]+ times = sort $ [t | tes <- M.elems track2events, (t,_)<- tes] commonTimeAxis :: AxisData t- commonTimeAxis = {-# SCC "commonTimeAxis" #-} transformLabels $ autoAxis axisTimes+ commonTimeAxis = transformLabels $ autoAxis axisTimes where axisTimes = case zoomMode of ZoomInput -> [minInTime] ++ times ++ [maxInTime]@@ -336,10 +336,10 @@ transformLabels axis = axis { axis_labels_ = map (map (\(t, s) -> (t, transformLabel t s))) (axis_labels_ axis) } plotTrack :: S.ByteString -> ChartKind t -> [(t, InEvent)] -> AnyLayout1 t- plotTrack name kind es = {-# SCC "plotTrack" #-} plotWithKind name kind es+ plotTrack name kind es = plotWithKind name kind es plotWithKind :: S.ByteString -> ChartKind t -> [(t, InEvent)] -> AnyLayout1 t- plotWithKind name k es = {-# SCC "plotWithKind" #-} case k of+ plotWithKind name k es = case k of KindACount bs -> withAnyOrdinate $ plotTrackACount name es bs KindAPercent bs b -> withAnyOrdinate $ plotTrackAPercent name es bs b KindAFreq bs -> withAnyOrdinate $ plotTrackAFreq name es bs@@ -371,7 +371,7 @@ defaultPlotBars plotTrackActivity :: S.ByteString -> [(t,InEvent)] -> Delta t -> ([(S.ByteString, Double)] -> Double -> Double) -> Layout1 t Double- plotTrackActivity name es bs transform = {-# SCC "plotTrackActivity" #-} layoutWithTitle [plotBars plot] name+ plotTrackActivity name es bs transform = layoutWithTitle [plotBars plot] name where plot = plot_bars_values ^= barsData $ plot_bars_item_styles ^= itemStyles $ plot_bars_titles ^= map show subTracks $@@ -475,7 +475,7 @@ toBars tvs = [(t,diffs vs) | (t,vs) <- tvs] diffs xs = zipWith (-) xs (0:xs) - groupByTrack xs = {-# SCC "groupByTrack" #-} M.toList $ sort `fmap` M.fromListWith (++) [(s, [(t,v)]) | (t,s,v) <- xs]+ groupByTrack xs = M.toList $ sort `fmap` M.fromListWith (++) [(s, [(t,v)]) | (t,s,v) <- xs] plotLines :: S.ByteString -> [(S.ByteString, [(t,Double)])] -> Layout1 t Double plotLines name vss = layoutWithTitle (map toPlot plots) name@@ -495,7 +495,7 @@ plot_points_style ^= hollowCircles 4 1 color $ plot_points_title ^= S.unpack subtrack $ defaultPlotPoints- | (subtrack, vs) <- {-# SCC "inDots" #-} groupByTrack (values es)+ | (subtrack, vs) <- groupByTrack (values es) | color <- map opaque colors] plotTrackCumSum :: S.ByteString -> [(t,InEvent)] -> SumSubtrackStyle -> Layout1 t Double@@ -594,7 +594,7 @@ bin@(t1,t2) <- getBin states <- getStates let binSizeSec = toSeconds (t2 `sub` t1) t1- RWS.tell [(bin, [(s, (fromIntegral npulse/binSizeSec + area + toSeconds (t2 `sub` start) t2*nopen)/binSizeSec) | (s,(area,start,nopen,npulse)) <- states])]+ RWS.tell [(bin, [(s, (fromIntegral npulse + area + toSeconds (t2 `sub` start) t2*nopen)/binSizeSec) | (s,(area,start,nopen,npulse)) <- states])] forM_ states $ \(s, (area,start,nopen,_)) -> putState s (0,t2,nopen,0) nextBin
timeplot.cabal view
@@ -1,5 +1,5 @@ name: timeplot-version: 0.3.9+version: 0.3.10 cabal-version: >=1.6 build-type: Simple license: BSD3