changeset 417:f689967c2545

modified phi-space lookup to return indices.
author Robert McIntyre <rlm@mit.edu>
date Wed, 19 Mar 2014 22:47:13 -0400
parents 9e52b6730fd0
children 027707c75f39
files org/worm_learn.clj thesis/org/roadmap.org
diffstat 2 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/worm_learn.clj	Wed Mar 19 22:02:06 2014 -0400
     1.2 +++ b/org/worm_learn.clj	Wed Mar 19 22:47:13 2014 -0400
     1.3 @@ -299,9 +299,6 @@
     1.4                experiences {:touch touch-data
     1.5                             :proprioception proprioception-data
     1.6                             :muscle muscle-data})
     1.7 -             (if-let [res (phi-scan proprioception-data)]
     1.8 -               (println-repl "lookup successful --" (count res))
     1.9 -               (println-repl "lookup failed"))
    1.10               (cond
    1.11                (grand-circle? @experiences) (println "Grand Circle")
    1.12                (curled? @experiences)       (println "Curled")
    1.13 @@ -350,15 +347,28 @@
    1.14  (defn gen-phi-scan [phi-space]
    1.15    (let [bin-keys (map bin [3 2 1])
    1.16          bin-maps
    1.17 -        (map (fn [bin-key phi-space]
    1.18 -               (group-by (comp bin-key :proprioception) phi-space))
    1.19 -             bin-keys (repeat phi-space))
    1.20 +        (map (fn [bin-key]
    1.21 +               (group-by
    1.22 +                (comp bin-key :proprioception phi-space)
    1.23 +                (range (count phi-space)))) bin-keys)
    1.24          lookups (map (fn [bin-key bin-map]
    1.25                        (fn [proprio] (bin-map (bin-key proprio))))
    1.26                      bin-keys bin-maps)]
    1.27      (fn lookup [proprio-data]
    1.28        (some #(% proprio-data) lookups))))
    1.29  
    1.30 +;; (defn gen-phi-scan [phi-space]
    1.31 +;;   (let [bin-keys (map bin [3 2 1])
    1.32 +;;         bin-maps
    1.33 +;;         (map (fn [bin-key phi-space]
    1.34 +;;                (group-by (comp bin-key :proprioception) phi-space))
    1.35 +;;              bin-keys (repeat phi-space))
    1.36 +;;         lookups (map (fn [bin-key bin-map]
    1.37 +;;                        (fn [proprio] (bin-map (bin-key proprio))))
    1.38 +;;                      bin-keys bin-maps)]
    1.39 +;;     (fn lookup [proprio-data]
    1.40 +;;       (some #(% proprio-data) lookups))))
    1.41 +
    1.42  (defn init []
    1.43    (def phi-space (generate-phi-space))
    1.44    (def phi-scan (gen-phi-scan phi-space))
     2.1 --- a/thesis/org/roadmap.org	Wed Mar 19 22:02:06 2014 -0400
     2.2 +++ b/thesis/org/roadmap.org	Wed Mar 19 22:47:13 2014 -0400
     2.3 @@ -205,10 +205,13 @@
     2.4  *** DONE build an automatic "do all the things" sequence.
     2.5      CLOSED: [2014-03-19 Wed 16:55] SCHEDULED: <2014-03-19 Wed>
     2.6      CLOCK: [2014-03-19 Wed 16:53]--[2014-03-19 Wed 16:55] =>  0:02
     2.7 -*** TODO implement proprioception based movement lookup in phi-space
     2.8 +*** DONE implement proprioception based movement lookup in phi-space
     2.9 +    CLOSED: [2014-03-19 Wed 22:04] SCHEDULED: <2014-03-19 Wed>
    2.10 +    CLOCK: [2014-03-19 Wed 19:32]--[2014-03-19 Wed 22:04] =>  2:32
    2.11 +*** TODO make proprioception reference phi-space indexes
    2.12      SCHEDULED: <2014-03-19 Wed>
    2.13 -    CLOCK: [2014-03-19 Wed 16:55]
    2.14 -    CLOCK: [2014-03-19 Wed 16:53]--[2014-03-19 Wed 16:53] =>  0:00
    2.15 +    CLOCK: [2014-03-19 Wed 22:07]
    2.16 +
    2.17  
    2.18  
    2.19  *** TODO create test videos, also record positions of worm segments