   )
 
 
-
-
+(defn sample-at-time [t time-intervals props]
+  (hash-map
+    ::core/raw-datum
+    {::core/position-value
+                  (vec (take (::core/dimensions props)
+                             (repeatedly
+                               (fn []
+                                 (let [r (rand)]
+                                   (cond (< t (int (/ time-intervals 2))) (+ 0.1
+                                                                             (* 0.2
+                                                                                (first
+                                                                                  (random/sample-normal 1))))
+                                         :else (-
+                                                 (* 0.2
+                                                    (first
+                                                      (random/sample-normal 1)))
+                                                 0.4)))))))
+     ::core/value 1.0}))
 
 (deftest stuff
   (let [test-props     {::core/c_m         3.0

                                      ::core/initialized-clusters false}}

        _              (println "samples count: " (count samples))
        [{:keys [final-state state-ts]} prof-stats] (profiled {} (core/dstream-iterations test-state samples :state-append-every 100))
        final-grids    (::core/grid-cells final-state)
        sorted-stats   (take 3 (sort-by #(* -1 (:mean (second %))) (:id-stats-map prof-stats)))
        displayable    (display-state "final" test-props (::core/grid-cells final-state))]

            [clojure.core.matrix.random :as random]
            [taoensso.tufte :as tufte :refer (defnp p profiled profile)]))

(defn grids-2d->heatmap-vec [grid-cells props & {:keys [clusters-only]}]
  (let [phase-space (::core/phase-space props)
        d1          (first phase-space)
        d2          (second phase-space)
        rows        (int (/ (- (::core/domain-end d1) (::core/domain-start d1)) (::core/domain-interval d1)))
        cols        (int (/ (- (::core/domain-end d2) (::core/domain-start d2)) (::core/domain-interval d2)))]
    (let [vecs
          (for [c (range cols) r (range rows)]
            (let [num (or
