                                       ::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))
+        [{:keys [final-state state-ts]} prof-stats] (profiled {} (core/dstream-iterations test-state samples :state-append-every (int (/ time-intervals 20))))
         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))]

                            (if (and (not (= nil cluster))
                                     (not (= "NO_CLASS" cluster)))
                              (do
                                (println "cluster:" cluster)
                                (::core/density-at-last-update (get grid-cells [r c])))
                              (/ (rand) 10000))))
                        (::core/density-at-last-update (get grid-cells [r c]))
                        (/ (rand) 10000))]
              num
              ))]

      {:matrix (->>
                 vecs
                 (viz/matrix-2d rows cols)
                 )
       :rows   rows
       :cols   cols})
    ))

(defn heatmap-spec
  [id the-matrix]
  (println "id, matrix: " id the-matrix)
  {:matrix        the-matrix
   :value-domain  (viz/value-domain-bounds the-matrix)
   :palette       (->> id (grad/cosine-schemes) (apply grad/cosine-gradient 100))

                        ::core/phase-space [
                                            {::core/domain-start    -1.0
                                             ::core/domain-end      1.0
                                             ::core/domain-interval 0.1}
                                            {::core/domain-start    -1.0
                                             ::core/domain-end      1.0
                                             ::core/domain-interval 0.1}]
                        ::core/gap-time    500}
        time-intervals 10000
        samples        (map (fn [t]
                              (sample-at-time t time-intervals test-props)
                              ) (range time-intervals))

        test-state     {::core/state {::core/grid-cells           {}
