           (doseq [coord bmuCoords, x coord] (.writeFloat o (float x)))
           (doseq [nrn weights, w nrn] (.writeFloat o (float w))))))))
 
-(defn write-hebbian-simulation
-  "(write-hebbian-simulation output-filename retina hebbian-sim-result) writes information about
-   the given retina and result data produced by the Hebbian simulation to the file named by
-   output-filename."
-  [output-filename R H]
-  (let [[X V M] H
-        nmem (count (first M))
-        labels (get R :labels)
-        n (count labels)
-        coords (get (get R :mosaic) :coordinates)
-        rmap (loop [r {}, s (seq (get R :cones)), k 0]
-               (if s
-                 (recur (assoc r (first s) k) (next s) (inc k))
-                 r))]
-    (with-open [o (java.io.DataOutputStream. (java.io.FileOutputStream. output-filename))]
-      (.writeInt o n)
-      (.writeInt o nmem)
-      ;; cone types
-      (doseq [l labels] (.writeInt o (get rmap l)))
-      ;; coordinates
-      (doseq [c coords, x c] (.writeFloat o (float x)))
-      ;; hebbian sim stuff
-      (doseq [x X] (.writeFloat o (float (nth x 2))))
-      (doseq [v V] (.writeFloat o (float v)))
-      (doseq [m M, v m] (.writeFloat o (float v))))))
-

                                       :steps-per-signal steps-per-signal
                                       :spring-strength spring-strength
                                       :distance-fn distance-fn
                                       :step-monitor step-monitor
                                       :k 0})
     :full-reduce false)))


                                                                       0 R a save-every)
                                          :full-reduce false)))

(defn write-hebbian-simulation
  "(write-hebbian-simulation output-filename retina hebbian-sim-result) writes information about
   the given retina and result data produced by the Hebbian simulation to the file named by
   output-filename."
  [output-filename R H]
  (let [[X V M] H
        nmem (count (first M))
        labels (get R :labels)
        n (count labels)
        coords (get (get R :mosaic) :coordinates)
        rmap (loop [r {}, s (seq (get R :cones)), k 0]
               (if s
                 (recur (assoc r (first s) k) (next s) (inc k))
                 r))]
    (with-open [o (java.io.DataOutputStream. (java.io.FileOutputStream. output-filename))]
      (.writeInt o n)
      (.writeInt o nmem)
      ;; cone types
      (doseq [l labels] (.writeInt o (get rmap l)))
      ;; coordinates
      (doseq [c coords, x c] (.writeFloat o (float x)))
      ;; hebbian sim stuff
      (doseq [x X] (.writeFloat o (float (nth x 2))))
      (doseq [v V] (.writeFloat o (float v)))
      (doseq [m M, v m] (.writeFloat o (float v))))))

(defn- hebbian-analysis [signals cones opts]
  (cond
   ;; end of analysis...
