let do_measurement ~time =
for i=0 to pred length do
let light_cone = light_cones.(i) in
if light_cone <> [||] then complexities.(i) <- lle i;
done;
let complexity = mean complexities in
let min_complexity = Array.fold_left (fun accu x -> if x = -1. then accu else min accu x)
infinity complexities in
let max_complexity = Array.fold_left max neg_infinity complexities in
let color_of_cmplx = match contrast_range with
| None ->
let range = max (max_complexity -. min_complexity) min_float in
(function
| -1. -> Graphics.red
| compl -> Femtolib.Colors.gray ((max_complexity -. compl) /. range))
| Some (minc, maxc) ->
let range = maxc -. minc in
(function
| -1. -> Graphics.red
| compl -> (maxc -. compl) /. range |> max 0. |> min 1. |> Femtolib.Colors.gray) in
(fun time ->
Printf.printf "%6i %#8.3f %#8.3f %#8.3f\n%!" time min_complexity max_complexity complexity;),
(fun time -> draw_cmplx color_of_cmplx complexities time)