Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

linePlot: use enumDouble, remove some helpers

  • Loading branch information...
commit d504292660e0d94f454b6a9b3771691b334a2bad 1 parent 2264435
@kfish authored
Showing with 6 additions and 18 deletions.
  1. +2 −6 Data/ZoomCache/Gnuplot.hs
  2. +4 −12 tools/zoom-cache-gnuplot.hs
View
8 Data/ZoomCache/Gnuplot.hs
@@ -69,12 +69,8 @@ avgPlot zsums = Plot.list Graph.lines avgs
----------------------------------------------------------------------
-linePlot :: [Packet] -> Plot.T Z.TimeStamp Double
-linePlot = Plot.list Graph.lines . concat . map pToTD
- where
- pToTD (Packet _ _ _ _ pData pTS) = zip pTS $ extract pData
- extract :: ZoomRaw -> [Double]
- extract (ZoomRaw l) = mapMaybe cast l
+linePlot :: [(Z.TimeStamp, Double)] -> Plot.T Z.TimeStamp Double
+linePlot = Plot.list Graph.lines
----------------------------------------------------------------------
View
16 tools/zoom-cache-gnuplot.hs
@@ -15,11 +15,10 @@ import System.Console.GetOpt
import System.Environment (getArgs)
import System.Exit (exitWith)
import System.FilePath.Posix
-
import qualified Data.Iteratee as I
import Data.Iteratee (Iteratee(..), stream2stream, fileDriverRandom)
import Data.Iteratee.ZoomCache (Stream)
-import Data.ZoomCache
+import Data.ZoomCache.Numeric
import Data.ZoomCache.Gnuplot
import qualified Graphics.Gnuplot.Advanced as Plot
@@ -177,9 +176,9 @@ lineProcess :: (FilePath, TrackNo) -> IO (Plot.T TimeStamp Double)
lineProcess (fp, tn) = fileDriverRandom iter fp
where
iter :: Iteratee ByteString IO (Plot.T TimeStamp Double)
- iter = I.joinI . (enumCacheFile standardIdentifiers) $ do
- streams <- mapMaybe (isPacket tn) <$> stream2stream
- return $ linePlot streams
+ iter = I.joinI . enumCacheFile standardIdentifiers $
+ (I.joinI . filterTracks [tn] .
+ I.joinI . enumDouble $ (linePlot <$> stream2stream))
isSumLvl :: TrackNo -> Int -> Stream -> Maybe ZoomSummary
isSumLvl tn lvl str =
@@ -188,13 +187,6 @@ isSumLvl tn lvl str =
StreamSummary _ tn' zsum@(ZoomSummary sum) ->
if tn == tn' && summaryLevel sum == lvl then Just zsum else Nothing
-isPacket :: TrackNo -> Stream -> Maybe Packet
-isPacket tn str =
- case str of
- StreamSummary{} -> Nothing
- StreamPacket _ tn' p ->
- if tn == tn' then Just p else Nothing
-
data UnrecognisedFormatException = UnrecognisedFormatException
deriving (Show, Typeable)
Please sign in to comment.
Something went wrong with that request. Please try again.