main = do
  (folderPath:numBatchStr:numLastTakeStr:displayPeriodStr:thresholdStr:_) <- getArgs
  let str = "S3_L1ProbeTop" 
      fileNames =
        L.map
          (\i -> folderPath L.++ "/" L.++ str 
            L.++ ".txt")
          [0 .. (read numBatchStr :: Int) - 1]
  print (L.head fileNames)
  numLines <- fmap (L.length . L.lines) . IO.readFile $ (L.head fileNames)
  print numLines
  xs <-
    M.mapM
      (\path -> energyFileSource path $$ sink (numLines - (read numLastTakeStr :: Int)) (read thresholdStr :: Double)) 
      fileNames
  print . L.length . takeEven (read displayPeriodStr :: Int) . L.head $ xs
  toFile def "l1norm.png" $ do
    layout_title .= "L1Norm"
    M.zipWithM_ (\i x -> plot (line (show i) [takeOdd (read displayPeriodStr :: Int) x])) [0 ..] xs
main = do
  (folderPath:numBatchStr:numLastTakeStr:displayPeriodStr:thresholdStr:_) <- getArgs
  let str = "S3_L1ProbeTop" 
      fileNames =
        L.map
          (\i -> folderPath L.++ "/" L.++ str 
            L.++ ".txt")
          [0 .. (read numBatchStr :: Int) - 1]
  print (L.head fileNames)
  numLines <- fmap (L.length . L.lines) . IO.readFile $ (L.head fileNames)
  print numLines
  xs <-
    M.mapM
      (\path -> energyFileSource path $$ sink (numLines - (read numLastTakeStr :: Int)) (read thresholdStr :: Double)) 
      fileNames
  print . L.length . takeEven (read displayPeriodStr :: Int) . L.head $ xs
  toFile def "l1norm.png" $ do
    layout_title .= "L1Norm"
    M.zipWithM_ (\i x -> plot (line (show i) [takeOdd (read displayPeriodStr :: Int) x])) [0 ..] xs
main = do
  (folderPath:numBatchStr:numLastTakeStr:displayPeriodStr:thresholdStr:_) <- getArgs
  let str = "S3_L1ProbeTop" 
      fileNames =
        L.map
          (\i -> folderPath L.++ "/" L.++ str 
            L.++ ".txt")
          [0 .. (read numBatchStr :: Int) - 1]
  print (L.head fileNames)
  numLines <- fmap (L.length . L.lines) . IO.readFile $ (L.head fileNames)
  print numLines
  xs <-
    M.mapM
      (\path -> energyFileSource path $$ sink (numLines - (read numLastTakeStr :: Int)) (read thresholdStr :: Double)) 
      fileNames
  print . L.length . takeEven (read displayPeriodStr :: Int) . L.head $ xs
  toFile def "l1norm.png" $ do
    layout_title .= "L1Norm"
    M.zipWithM_ (\i x -> plot (line (show i) [takeOdd (read displayPeriodStr :: Int) x])) [0 ..] xs