 
     (let [vecs
           (for [c (range cols) r (range rows)]
-            (let [num (or (::core/density-at-last-update (get grid-cells [r c]))
-                          0.0)]
+            (let [num (or
+                        (when clusters-only
+                          (do
+                            (println "clusers only")
+                            (let [cluster (::core/cluster (get grid-cells [r c]))]
+                              (println "cluster:" cluster)
+                              (if (and (not (= nil cluster))
+                                       (not (= "NO_CLASS" cluster)))
+                                (do
+                                  (println "cluster: " cluster)
+                                  (::core/density-at-last-update (get grid-cells [r c])))
+                                0.0))))
+                        (::core/density-at-last-update (get grid-cells [r c]))
+                        0.0)]
               num
               ))]
       {:matrix (->>



(deftest stuff
  (let [test-props   {
                      ::core/c_m         3.0
                      ::core/c_l         0.8
                      ::core/lambda      0.998
                      ::core/beta        0.3
                      ::core/dimensions  2
                      ::core/phase-space [
                                          {::core/domain-start    -2.5
                                           ::core/domain-end      2.5
                                           ::core/domain-interval 0.1}
                                          {::core/domain-start    -2.5
                                           ::core/domain-end      2.5
                                           ::core/domain-interval 0.1}]
                      ::core/gap-time    250}
        ;centroids    (vec (repeatedly 4 (fn [] (get-random-sample :unifrom test-props))))
        ;_            (println "centroids: " centroids)
        samples      (repeatedly 50000 #(hash-map
                                         ::core/raw-datum
                                         {::core/position-value
                                                       (vec
                                                         (take
                                                           (::core/dimensions test-props)
                                                           (repeatedly
                                                             (fn []

                                                               (if (> 0.5 (rand))
                                                                 (+ 0.1
                                                                    (* 0.15
                                                                       (first
                                                                         (random/sample-normal 1))))
                                                                 (+ 0.9
                                                                    (* 0.25
                                                                       (first
                                                                         (random/sample-normal 1)))))))))
                                          ::core/value 1.0}))

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

    ;;TODO abandon tsne for a simple dxd grid of 2d scatter plots

    (clojure.pprint/pprint displayable)
    (clojure.pprint/pprint sorted-stats)
    )
  )