Commit 82bfdeec authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Use tracePhylo in PhyloMaker

parent ad332461
...@@ -37,7 +37,7 @@ cabal: ...@@ -37,7 +37,7 @@ cabal:
- .cabal/ - .cabal/
policy: pull-push policy: pull-push
script: script:
- nix-shell --run "./bin/update-project-dependencies $CABAL_STORE_DIR && cabal --store-dir=$CABAL_STORE_DIR v2-build --flags test-crypto --ghc-options='-O0 -fclear-plugins'" - nix-shell --run "./bin/update-project-dependencies $CABAL_STORE_DIR && cabal --store-dir=$CABAL_STORE_DIR v2-build --flags 'test-crypto no-phylo-debug-logs' --ghc-options='-O0 -fclear-plugins'"
allow_failure: false allow_failure: false
bench: bench:
......
...@@ -179,7 +179,7 @@ toBid g bs = ...@@ -179,7 +179,7 @@ toBid g bs =
exportToDot :: Phylo -> PhyloExport -> DotGraph DotId exportToDot :: Phylo -> PhyloExport -> DotGraph DotId
exportToDot phylo export = exportToDot phylo export =
trace ("\n-- | Convert " <> show(length $ export ^. export_branches) <> " branches and " tracePhylo ("\n-- | Convert " <> show(length $ export ^. export_branches) <> " branches and "
<> show(length $ export ^. export_groups) <> " groups " <> show(length $ export ^. export_groups) <> " groups "
<> show(length $ nub $ concat $ map (^. phylo_groupNgrams) $ export ^. export_groups) <> show(length $ nub $ concat $ map (^. phylo_groupNgrams) $ export ^. export_groups)
<> " terms to a dot file\n\n" <> " terms to a dot file\n\n"
......
...@@ -192,7 +192,7 @@ findSeaLadder phylo = case getSeaElevation phylo of ...@@ -192,7 +192,7 @@ findSeaLadder phylo = case getSeaElevation phylo of
appendGroups :: (a -> Period -> (Text,Text) -> Scale -> Int -> [Cooc] -> Map Int Double -> PhyloGroup) -> Scale -> Map (Date,Date) [a] -> Phylo -> Phylo appendGroups :: (a -> Period -> (Text,Text) -> Scale -> Int -> [Cooc] -> Map Int Double -> PhyloGroup) -> Scale -> Map (Date,Date) [a] -> Phylo -> Phylo
appendGroups f lvl m phylo = appendGroups f lvl m phylo =
trace ("\n" <> "-- | Append " tracePhylo ("\n" <> "-- | Append "
<> show (length $ concat $ elems m) <> show (length $ concat $ elems m)
<> " groups to scale " <> " groups to scale "
<> show (lvl) <> "\n" :: Text) <> show (lvl) <> "\n" :: Text)
...@@ -381,7 +381,7 @@ docsToTimeScaleCooc docs fdt = ...@@ -381,7 +381,7 @@ docsToTimeScaleCooc docs fdt =
mCooc' = fromList mCooc' = fromList
$ map (\t -> (t,empty)) $ map (\t -> (t,empty))
$ toTimeScale (map date docs) 1 $ toTimeScale (map date docs) 1
in trace ("\n" <> "-- | Build the coocurency matrix for " in tracePhylo ("\n" <> "-- | Build the coocurency matrix for "
<> show (length $ keys mCooc') <> show (length $ keys mCooc')
<> " unit of time" <> "\n" :: Text) <> " unit of time" <> "\n" :: Text)
$ unionWith sumCooc mCooc mCooc' $ unionWith sumCooc mCooc mCooc'
...@@ -407,7 +407,7 @@ groupDocsByPeriod' :: (NFData doc, Ord date, Enum date) => (doc -> date) -> [(da ...@@ -407,7 +407,7 @@ groupDocsByPeriod' :: (NFData doc, Ord date, Enum date) => (doc -> date) -> [(da
groupDocsByPeriod' f pds docs = groupDocsByPeriod' f pds docs =
let docs' = groupBy (\d d' -> f d == f d') $ sortOn f docs let docs' = groupBy (\d d' -> f d == f d') $ sortOn f docs
periods = parMap rpar (inPeriode f docs') pds periods = parMap rpar (inPeriode f docs') pds
in trace ("\n" <> "-- | Group " in tracePhylo ("\n" <> "-- | Group "
<> show(length docs) <> show(length docs)
<> " docs by " <> " docs by "
<> show(length pds) <> " periods" <> "\n" :: Text) <> show(length pds) <> " periods" <> "\n" :: Text)
...@@ -426,7 +426,7 @@ groupDocsByPeriod _ _ [] = panic "[ERR][Viz.Phylo.PhyloMaker] Empty [Documents ...@@ -426,7 +426,7 @@ groupDocsByPeriod _ _ [] = panic "[ERR][Viz.Phylo.PhyloMaker] Empty [Documents
groupDocsByPeriod f pds es = groupDocsByPeriod f pds es =
let periods = parMap rpar (inPeriode f es) pds let periods = parMap rpar (inPeriode f es) pds
in trace ("\n" <> "-- | Group " in tracePhylo ("\n" <> "-- | Group "
<> show(length es) <> " docs by " <> show(length es) <> " docs by "
<> show(length pds) <> " periods" <> "\n" :: Text) <> show(length pds) <> " periods" <> "\n" :: Text)
$ fromList $ zip pds periods $ fromList $ zip pds periods
...@@ -483,7 +483,7 @@ docsToTimeScaleNb :: [Document] -> Map Date Double ...@@ -483,7 +483,7 @@ docsToTimeScaleNb :: [Document] -> Map Date Double
docsToTimeScaleNb docs = docsToTimeScaleNb docs =
let docs' = fromListWith (+) $ map (\d -> (date d,1)) docs let docs' = fromListWith (+) $ map (\d -> (date d,1)) docs
time = fromList $ map (\t -> (t,0)) $ toTimeScale (keys docs') 1 time = fromList $ map (\t -> (t,0)) $ toTimeScale (keys docs') 1
in trace ("\n" <> "-- | Group " in tracePhylo ("\n" <> "-- | Group "
<> show(length docs) <> show(length docs)
<> " docs by " <> " docs by "
<> show(length time) <> show(length time)
...@@ -539,9 +539,9 @@ initPhylo docs conf = ...@@ -539,9 +539,9 @@ initPhylo docs conf =
then defaultPhyloParam { _phyloParam_config = setDefault conf timeScale (length docs) } then defaultPhyloParam { _phyloParam_config = setDefault conf timeScale (length docs) }
else defaultPhyloParam { _phyloParam_config = conf } else defaultPhyloParam { _phyloParam_config = conf }
periods = toPeriods (D.sort $ D.nub $ map date docs) (getTimePeriod timeScale) (getTimeStep timeScale) periods = toPeriods (D.sort $ D.nub $ map date docs) (getTimePeriod timeScale) (getTimeStep timeScale)
in trace ("\n" <> "-- | Init a phylo out of " in tracePhylo ("\n" <> "-- | Init a phylo out of "
<> show(length docs) <> " docs \n" :: Text) <> show(length docs) <> " docs \n" :: Text)
$ trace ("\n" <> "-- | lambda " $ tracePhylo ("\n" <> "-- | lambda "
<> show(_qua_granularity $ phyloQuality $ _phyloParam_config params) :: Text) <> show(_qua_granularity $ phyloQuality $ _phyloParam_config params) :: Text)
$ Phylo foundations $ Phylo foundations
docsSources docsSources
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment