@@ -53,6 +53,42 @@ renderFloatStr w = justifyData w'. T.take w' . T.pack . stripLeadingZero
53
53
' 0' : xs@ (' .' : _) -> xs
54
54
xs -> xs
55
55
56
+ renderSummary :: RenderFormat -> Anchor -> Summary -> [Text ]
57
+ renderSummary AsJSON _ x = (: [] ) . LT. toStrict $ encodeToLazyText x
58
+ renderSummary AsGnuplot _ _ = error " renderSummary: output not supported: gnuplot"
59
+ renderSummary AsPretty _ _ = error " renderSummary: output not supported: pretty"
60
+ renderSummary _ a Summary {.. } =
61
+ render $
62
+ Props
63
+ { oProps = [ (" TITLE" , renderAnchorRuns a )
64
+ , (" SUBTITLE" , renderAnchorFiltersAndDomains a)
65
+ , (" DATE" , renderAnchorDate a)
66
+ , (" VERSION" , renderProgramAndVersion (aVersion a))
67
+ ]
68
+ , oConstants = []
69
+ , oBody = (: [] ) $
70
+ Table
71
+ { tColHeaders = [" Value" ]
72
+ , tExtended = False
73
+ , tApexHeader = Just " Property"
74
+ , tColumns = [kvs <&> snd ]
75
+ , tRowHeaders = kvs <&> fst
76
+ , tSummaryHeaders = []
77
+ , tSummaryValues = []
78
+ , tFormula = []
79
+ , tConstants = []
80
+ }
81
+ }
82
+ where
83
+ kvs = [ (" Date" , showText $ sumWhen)
84
+ , (" Machines" , showText $ sumLogStreams)
85
+ , (" Log objects" , showText $ sumLogObjects)
86
+ , (" Slots considered" , showText $ ddFilteredCount sumDomainSlots)
87
+ , (" Blocks considered" , showText $ ddFilteredCount sumDomainBlocks)
88
+ , (" Blocks dropped" , showText $ sumBlocksRejected)
89
+ ]
90
+
91
+
56
92
renderTimeline :: forall (a :: Type ). TimelineFields a => Run -> (Field ISelect I a -> Bool ) -> [TimelineComments a ] -> [a ] -> [Text ]
57
93
renderTimeline run flt comments xs =
58
94
concatMap (uncurry fLine) $ zip xs [(0 :: Int ).. ]
@@ -136,7 +172,7 @@ data RenderFormat
136
172
| AsOrg
137
173
| AsReport
138
174
| AsPretty
139
- deriving (Show , Bounded , Enum )
175
+ deriving (Eq , Show , Bounded , Enum )
140
176
141
177
-- | When rendering a CDF-of-CDFs _and_ subsetting the data, how to subset:
142
178
data CDF2Aspect
@@ -196,6 +232,7 @@ renderAnalysisCDFs a@Anchor{..} fieldSelr _c2a centileSelr AsOrg x =
196
232
\ f@ Field {} -> mapField x (T. pack . printf " %d" . cdfSize) f
197
233
] & transpose
198
234
, tFormula = []
235
+ , tConstants = []
199
236
}
200
237
}
201
238
where
@@ -230,40 +267,44 @@ renderAnalysisCDFs a@Anchor{..} fieldSelr aspect _centileSelr AsReport x =
230
267
, tColumns = transpose $
231
268
fields <&>
232
269
fmap (T. take 6 . T. pack . printf " %f" )
233
- . mapField x (snd hdrsProjs)
270
+ . mapFieldWithKey x (snd hdrsProjs)
234
271
, tRowHeaders = fields <&> fShortDesc
235
272
, tSummaryHeaders = []
236
273
, tSummaryValues = []
237
274
, tFormula = []
275
+ , tConstants = [(" nSamples" ,
276
+ fields <&> mapField x (T. pack . show . cdfSize) & head )]
238
277
}
239
278
}
240
279
where
241
280
fields :: [Field DSelect p a ]
242
281
fields = filter fieldSelr cdfFields
243
282
244
- hdrsProjs :: forall v . (Divisible v ) => ([Text ], CDF p v -> [Double ])
283
+ hdrsProjs :: forall v . (Divisible v ) => ([Text ], Field DSelect p a -> CDF p v -> [Double ])
245
284
hdrsProjs = aspectColHeadersAndProjections aspect
246
285
247
286
aspectColHeadersAndProjections :: forall v . (Divisible v )
248
- => CDF2Aspect -> ([Text ], CDF p v -> [Double ])
287
+ => CDF2Aspect -> ([Text ], Field DSelect p a -> CDF p v -> [Double ])
249
288
aspectColHeadersAndProjections = \ case
250
289
OfOverallDataset ->
251
290
(,)
252
- [" average" , " CoV" , " min" , " max" , " stddev" , " range" , " size" ]
253
- \ c@ CDF {cdfRange= (cdfMin, cdfMax), .. } ->
291
+ [" average" , " CoV" , " min" , " max" , " stddev" , " range" , " precision " , " size" ]
292
+ \ Field { .. } c@ CDF {cdfRange= (cdfMin, cdfMax), .. } ->
254
293
let avg = cdfAverageVal c & toDouble in
255
294
[ avg
256
295
, cdfStddev / avg
257
296
, fromRational . toRational $ cdfMin
258
297
, fromRational . toRational $ cdfMax
259
298
, cdfStddev
260
299
, fromRational . toRational $ cdfMax - cdfMin
300
+ , fromIntegral $ fromEnum fPrecision
261
301
, fromIntegral cdfSize
262
302
]
263
303
OfInterCDF ->
264
304
(,)
265
- [" average" , " CoV" , " min" , " max" , " stddev" , " range" , " size" ]
266
- (cdfArity
305
+ [" average" , " CoV" , " min" , " max" , " stddev" , " range" , " precision" , " size" ]
306
+ (\ Field {.. } ->
307
+ cdfArity
267
308
(error " Cannot do inter-CDF statistics on plain CDFs" )
268
309
(\ CDF {cdfAverage= cdfAvg@ CDF {cdfRange= (minAvg, maxAvg),.. }} ->
269
310
let avg = cdfAverageVal cdfAvg & toDouble in
@@ -273,6 +314,7 @@ renderAnalysisCDFs a@Anchor{..} fieldSelr aspect _centileSelr AsReport x =
273
314
, toDouble maxAvg
274
315
, cdfStddev
275
316
, toDouble $ maxAvg - minAvg
317
+ , fromIntegral $ fromEnum fPrecision
276
318
, fromIntegral cdfSize
277
319
]))
278
320
0 commit comments