Browse Source

Put max entropy figure in a script because I can't get notebooks working. Also added the correlation length analysis for circular values.

moritz 3 years ago
parent
commit
69e1352b15

BIN
figures/figure_4_paper_perlin/A_circular_connectivity_rule.pdf


+ 355 - 114
figures/figure_4_paper_perlin/A_circular_connectivity_rule.svg

@@ -14,7 +14,7 @@
    viewBox="0 0 30.000001 27.749999"
    version="1.1"
    id="svg13531"
-   inkscape:version="0.92.1 r15371"
+   inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
    sodipodi:docname="A_circular_connectivity_rule.svg"
    inkscape:export-filename="/home/moritz/PycharmProjects/subiculum_polar_interneurons/figures/figure_4_paper_draft/panel_a_grid_connections_circle.png"
    inkscape:export-xdpi="200"
@@ -396,6 +396,246 @@
          style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.00000003pt;stroke-opacity:1"
          transform="scale(0.4)" />
     </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-2-4-06-3"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-9-5-8-67"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#fa0000;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-3-5-1-5"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-5-9-49-3"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-3-5-68-5"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-5-9-84-6"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-2-4-0-2"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-9-5-7-9"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#fa0000;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-2-4-4-1"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-9-5-4-2"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#fa0000;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-3-5-5-7"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-5-9-4-0"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-2-4-9"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-9-5-3"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#fa0000;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-3-5-60"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-5-9-6"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-26"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-1"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#fa0000;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-2-8"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-9-79"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#fa0000;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-2-9-2"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-9-3-0"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#fa0000;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-3-0-6-2"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-5-6-1-3"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-3-0-6-7-7"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-5-6-1-9-5"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-3-5-7-5-9"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-5-9-8-0-2"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-23-9-1-6-2"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-7-7-9-1-8"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#fa0000;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM-3-9"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path1013-5-7"
+         d="M 5.77,0 -2.88,5 V -5 Z"
+         style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.00000003pt;stroke-opacity:1"
+         transform="scale(0.4)" />
+    </marker>
   </defs>
   <sodipodi:namedview
      id="base"
@@ -405,15 +645,15 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="4"
-     inkscape:cx="-51.84654"
+     inkscape:cx="4.0789796"
      inkscape:cy="-11.527562"
      inkscape:document-units="mm"
      inkscape:current-layer="layer1"
      showgrid="false"
-     inkscape:window-width="2558"
-     inkscape:window-height="1400"
+     inkscape:window-width="1920"
+     inkscape:window-height="1171"
      inkscape:window-x="0"
-     inkscape:window-y="38"
+     inkscape:window-y="0"
      inkscape:window-maximized="1"
      scale-x="1.5">
     <inkscape:grid
@@ -429,7 +669,7 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title></dc:title>
+        <dc:title />
       </cc:Work>
     </rdf:RDF>
   </metadata>
@@ -439,33 +679,35 @@
      id="layer1"
      transform="translate(0,-417.75)">
     <ellipse
-       style="opacity:0.25;fill:#005eff;fill-opacity:1;stroke:none;stroke-width:0.26063645;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       id="path1209"
-       cx="20.021955"
-       cy="428.9198"
+       style="opacity:0.25;fill:#005eff;fill-opacity:1;stroke:none;stroke-width:0.194571;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path1209-3"
+       cx="15.093596"
+       cy="437.56488"
        inkscape:export-xdpi="200"
        inkscape:export-ydpi="200"
-       rx="7.3393207"
-       ry="7.3393188" />
+       rx="5.4789696"
+       ry="5.4789681" />
     <ellipse
-       style="opacity:0.25;fill:#005eff;fill-opacity:1;stroke:none;stroke-width:0.26063645;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       id="path1209-3"
-       cx="12.26183"
-       cy="437.41068"
+       style="opacity:0.25;fill:#005eff;fill-opacity:1;stroke:none;stroke-width:0.194571;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path1209-3-4"
+       cx="21.384939"
+       cy="431.39255"
        inkscape:export-xdpi="200"
        inkscape:export-ydpi="200"
-       rx="7.3393216"
-       ry="7.3393197" />
+       rx="5.4789696"
+       ry="5.4789681" />
     <g
        id="g5127"
-       transform="matrix(0.82499953,0,0,0.82499929,2.5935755,77.205529)">
+       transform="matrix(0.82499954,0,0,0.82499931,3.3068609,79.448567)"
+       inkscape:export-xdpi="200"
+       inkscape:export-ydpi="200">
       <circle
          inkscape:export-ydpi="200"
          inkscape:export-xdpi="200"
          style="fill:#0000ff;fill-opacity:1;stroke:#0000ff;stroke-width:0.041794;stroke-opacity:1"
          r="1.0554578"
-         cy="425.94077"
-         cx="21.053171"
+         cy="426.52341"
+         cx="21.950348"
          id="path12" />
       <path
          sodipodi:nodetypes="cc"
@@ -473,68 +715,70 @@
          inkscape:export-xdpi="200"
          inkscape:connector-curvature="0"
          id="path1216"
-         d="m 18.182686,424.99907 1.370957,0.60895"
-         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM)" />
+         d="m 19.024797,423.35307 1.9146,1.98822"
+         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-26)" />
       <path
          inkscape:export-ydpi="200"
          inkscape:export-xdpi="200"
          sodipodi:nodetypes="cc"
          inkscape:connector-curvature="0"
          id="path1216-1"
-         d="m 18.476714,430.99996 1.685883,-3.79934"
-         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2)" />
+         d="m 18.290473,429.65409 2.413885,-2.20369"
+         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-8)" />
       <path
          inkscape:export-ydpi="200"
          inkscape:export-xdpi="200"
          sodipodi:nodetypes="cc"
          inkscape:connector-curvature="0"
          id="path1216-1-6"
-         d="m 25.89559,424.68243 -3.343519,0.83588"
-         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-9)" />
+         d="m 25.462058,423.23715 -2.177419,2.63283"
+         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-9-2)" />
       <path
          inkscape:export-ydpi="200"
          inkscape:export-xdpi="200"
          sodipodi:nodetypes="cc"
          inkscape:connector-curvature="0"
          id="path1216-6-2-8"
-         d="m 20.829606,427.05493 -1.727193,3.9526"
-         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-0-6)" />
+         d="m 21.78091,427.20107 -2.705821,2.53811"
+         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-0-6-2)" />
       <path
          inkscape:export-ydpi="200"
          inkscape:export-xdpi="200"
          sodipodi:nodetypes="cc"
          inkscape:connector-curvature="0"
          id="path1216-6-2-8-2"
-         d="m 21.737299,426.3753 3.280192,-0.94143"
-         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-0-6-7)" />
+         d="m 22.649509,425.77033 1.452056,-1.7019"
+         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-0-6-7-7)" />
       <path
          inkscape:export-ydpi="200"
          inkscape:export-xdpi="200"
          sodipodi:nodetypes="cc"
          inkscape:connector-curvature="0"
          id="path1216-6-8-4-3"
-         d="m 21.420662,426.69194 3.57836,4.57462"
-         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5-7-5)" />
+         d="m 22.634476,426.95794 2.465759,2.035"
+         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5-7-5-9)" />
       <path
          inkscape:export-ydpi="200"
          inkscape:export-xdpi="200"
          sodipodi:nodetypes="cc"
          inkscape:connector-curvature="0"
          id="path1216-2-3-4-0"
-         d="m 25.801947,431.32846 -3.566515,-4.41281"
-         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-23-9-1-6)" />
+         d="m 26.112831,430.6408 -3.318467,-2.84936"
+         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-23-9-1-6-2)" />
       <path
          sodipodi:nodetypes="cc"
          inkscape:export-ydpi="200"
          inkscape:export-xdpi="200"
          inkscape:connector-curvature="0"
          id="path1216-6"
-         d="m 20.806427,425.54997 -0.972736,-0.52288"
-         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3)" />
+         d="m 21.260126,426.45582 -2.268349,-2.38975"
+         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-9)" />
     </g>
     <g
        id="g5164"
-       transform="translate(-0.00115923,0.0347649)">
+       transform="translate(0.49118262,1.0032896)"
+       inkscape:export-xdpi="200"
+       inkscape:export-ydpi="200">
       <path
          inkscape:export-ydpi="200"
          inkscape:export-xdpi="200"
@@ -826,81 +1070,78 @@
          id="path10-6-32-1-5-7"
          sodipodi:type="star" />
     </g>
-    <g
-       id="g4996"
-       transform="matrix(0.82499953,0,0,0.82499929,2.5935755,77.205529)">
-      <circle
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         style="fill:#0000ff;fill-opacity:1;stroke:#0000ff;stroke-width:0.041794;stroke-opacity:1"
-         r="1.0554578"
-         cy="436.61288"
-         cx="11.599006"
-         id="path12-2" />
-      <path
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         sodipodi:nodetypes="cc"
-         inkscape:connector-curvature="0"
-         id="path1216-6-8"
-         d="m 12.175376,436.20232 4.546287,-3.13514"
-         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5)" />
-      <path
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         sodipodi:nodetypes="cc"
-         inkscape:connector-curvature="0"
-         id="path1216-1-2"
-         d="m 18.387373,432.55199 -5.321076,3.72171"
-         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-4)" />
-      <path
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         sodipodi:nodetypes="cc"
-         inkscape:connector-curvature="0"
-         id="path1216-6-8-7"
-         d="m 11.652159,437.24972 -0.271877,1.05503"
-         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5-5)" />
-      <path
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         sodipodi:nodetypes="cc"
-         inkscape:connector-curvature="0"
-         id="path1216-1-2-3"
-         d="m 10.347456,439.13909 0.404782,-1.27061"
-         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-4-4)" />
-      <path
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         sodipodi:nodetypes="cc"
-         inkscape:connector-curvature="0"
-         id="path1216-1-2-8"
-         d="m 18.363658,440.05734 -5.521613,-2.52661"
-         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-4-0)" />
-      <path
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         sodipodi:nodetypes="cc"
-         inkscape:connector-curvature="0"
-         id="path1216-6-8-3"
-         d="m 12.517636,436.77476 4.820706,2.19493"
-         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5-68)" />
-      <path
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         sodipodi:nodetypes="cc"
-         inkscape:connector-curvature="0"
-         id="path1216-6-8-2"
-         d="m 11.097786,436.7603 -0.513773,-3.50829"
-         style="fill:none;stroke:#0000ff;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5-1)" />
-      <path
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         sodipodi:nodetypes="cc"
-         inkscape:connector-curvature="0"
-         id="path1216-1-2-9"
-         d="m 11.000348,432.21912 0.451985,2.85506"
-         style="fill:#ff0000;stroke:#fa0000;stroke-width:0.16717599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-4-06)" />
-    </g>
+    <ellipse
+       ry="0.87075198"
+       rx="0.87075227"
+       inkscape:export-ydpi="200"
+       inkscape:export-xdpi="200"
+       style="fill:#0000ff;fill-opacity:1;stroke:#0000ff;stroke-width:0.03448002;stroke-opacity:1"
+       cy="437.65909"
+       cx="15.072197"
+       id="path12-2" />
+    <path
+       inkscape:export-ydpi="200"
+       inkscape:export-xdpi="200"
+       sodipodi:nodetypes="cc"
+       inkscape:connector-curvature="0"
+       id="path1216-6-8"
+       d="m 15.522898,437.08474 1.474853,-1.55708"
+       style="fill:none;stroke:#0000ff;stroke-width:0.1379201;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5-60)" />
+    <path
+       inkscape:export-ydpi="200"
+       inkscape:export-xdpi="200"
+       sodipodi:nodetypes="cc"
+       inkscape:connector-curvature="0"
+       id="path1216-1-2"
+       d="m 17.968886,435.09022 -1.791594,2.04101"
+       style="fill:#ff0000;stroke:#fa0000;stroke-width:0.1379201;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-4-9)" />
+    <path
+       inkscape:export-ydpi="200"
+       inkscape:export-xdpi="200"
+       sodipodi:nodetypes="cc"
+       inkscape:connector-curvature="0"
+       id="path1216-6-8-7"
+       d="m 14.830794,438.35812 -1.867609,2.05483"
+       style="fill:none;stroke:#0000ff;stroke-width:0.1379201;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5-5-7)" />
+    <path
+       inkscape:export-ydpi="200"
+       inkscape:export-xdpi="200"
+       sodipodi:nodetypes="cc"
+       inkscape:connector-curvature="0"
+       id="path1216-1-2-3"
+       d="m 12.45837,440.30753 1.617588,-1.85441"
+       style="fill:#ff0000;stroke:#fa0000;stroke-width:0.1379201;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-4-4-1)" />
+    <path
+       inkscape:export-ydpi="200"
+       inkscape:export-xdpi="200"
+       sodipodi:nodetypes="cc"
+       inkscape:connector-curvature="0"
+       id="path1216-1-2-8"
+       d="m 18.098149,440.85424 -2.298102,-2.16506"
+       style="fill:#ff0000;stroke:#fa0000;stroke-width:0.1379201;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-4-0-2)" />
+    <path
+       inkscape:export-ydpi="200"
+       inkscape:export-xdpi="200"
+       sodipodi:nodetypes="cc"
+       inkscape:connector-curvature="0"
+       id="path1216-6-8-3"
+       d="m 15.69364,437.97869 1.986505,1.84182"
+       style="fill:none;stroke:#0000ff;stroke-width:0.1379201;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5-68-5)" />
+    <path
+       inkscape:export-ydpi="200"
+       inkscape:export-xdpi="200"
+       sodipodi:nodetypes="cc"
+       inkscape:connector-curvature="0"
+       id="path1216-6-8-2"
+       d="m 14.522265,437.35904 -1.800144,-1.84942"
+       style="fill:none;stroke:#0000ff;stroke-width:0.1379201;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-3-5-1-5)" />
+    <path
+       inkscape:export-ydpi="200"
+       inkscape:export-xdpi="200"
+       sodipodi:nodetypes="cc"
+       inkscape:connector-curvature="0"
+       id="path1216-1-2-9"
+       d="m 12.562289,434.66981 1.827637,1.89526"
+       style="fill:#ff0000;stroke:#fa0000;stroke-width:0.1379201;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-2-4-06-3)" />
   </g>
 </svg>

BIN
figures/figure_4_paper_perlin/A_circular_morphology.pdf


+ 8 - 8
figures/figure_4_paper_perlin/A_circular_morphology.svg

@@ -15,8 +15,8 @@
    viewBox="0 0 181.60147 93.057755"
    version="1.1"
    id="svg26"
-   sodipodi:docname="panel_a_morphology.svg"
-   inkscape:version="0.92.1 r15371">
+   sodipodi:docname="A_circular_morphology.svg"
+   inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
   <defs
      id="defs20">
     <marker
@@ -80,15 +80,15 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="0.49497475"
-     inkscape:cx="327.66286"
+     inkscape:cx="-7.7077826"
      inkscape:cy="93.206936"
      inkscape:document-units="mm"
      inkscape:current-layer="layer1"
      showgrid="false"
-     inkscape:window-width="2558"
-     inkscape:window-height="1400"
+     inkscape:window-width="1920"
+     inkscape:window-height="1171"
      inkscape:window-x="0"
-     inkscape:window-y="38"
+     inkscape:window-y="0"
      inkscape:window-maximized="1"
      fit-margin-top="0"
      fit-margin-left="0"
@@ -102,7 +102,7 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title></dc:title>
+        <dc:title />
       </cc:Work>
     </rdf:RDF>
   </metadata>
@@ -120,7 +120,7 @@
        inkscape:export-ydpi="200" />
     <g
        id="g4623"
-       transform="translate(-8.9958336,120.95237)">
+       transform="matrix(0.8163359,0,0,0.8163359,23.00709,137.94403)">
       <g
          id="g4618">
         <circle

BIN
figures/figure_4_paper_perlin/A_polar_connectivity_rule.pdf


File diff suppressed because it is too large
+ 552 - 340
figures/figure_4_paper_perlin/A_polar_connectivity_rule.svg


BIN
figures/figure_4_paper_perlin/A_polar_morphology.pdf


+ 35 - 28
figures/figure_4_paper_perlin/A_polar_morphology.svg

@@ -15,8 +15,8 @@
    viewBox="0 0 181.60147 93.057755"
    version="1.1"
    id="svg26"
-   sodipodi:docname="panel_a_morphology.svg"
-   inkscape:version="0.92.1 r15371">
+   sodipodi:docname="A_polar_morphology.svg"
+   inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
   <defs
      id="defs20">
     <marker
@@ -80,15 +80,15 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="0.49497475"
-     inkscape:cx="327.66286"
+     inkscape:cx="-7.7077826"
      inkscape:cy="93.206936"
      inkscape:document-units="mm"
-     inkscape:current-layer="layer1"
+     inkscape:current-layer="g4623"
      showgrid="false"
-     inkscape:window-width="2558"
-     inkscape:window-height="1400"
+     inkscape:window-width="1920"
+     inkscape:window-height="1171"
      inkscape:window-x="0"
-     inkscape:window-y="38"
+     inkscape:window-y="0"
      inkscape:window-maximized="1"
      fit-margin-top="0"
      fit-margin-left="0"
@@ -102,7 +102,7 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title></dc:title>
+        <dc:title />
       </cc:Work>
     </rdf:RDF>
   </metadata>
@@ -120,26 +120,33 @@
        inkscape:export-ydpi="200" />
     <g
        id="g4596"
-       transform="translate(0,4.5356855)">
-      <ellipse
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         transform="matrix(0.93022945,-0.36697842,0.38180241,0.92424397,0,0)"
-         ry="43.850842"
-         rx="19.277784"
-         cy="257.36111"
-         cx="78.840866"
-         id="path1695-5"
-         style="opacity:0.39500002;fill:#008aff;fill-opacity:1;stroke-width:2.99697828;stroke-miterlimit:4;stroke-dasharray:none" />
-      <ellipse
-         inkscape:export-ydpi="200"
-         inkscape:export-xdpi="200"
-         ry="5.6696429"
-         rx="6.0476193"
-         cy="210.06548"
-         cx="173.1131"
-         id="path1913-3"
-         style="opacity:1;fill:#0000ff;fill-opacity:1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none" />
+       transform="matrix(0.8039065,0,0,0.8039065,33.649878,45.505807)">
+      <g
+         id="g4623"
+         transform="matrix(1.0154612,0,0,1.0154612,64.584979,103.71237)">
+        <ellipse
+           inkscape:export-ydpi="200"
+           inkscape:export-xdpi="200"
+           ry="5.6696429"
+           rx="6.0476193"
+           cy="129.59848"
+           cx="40.876835"
+           id="path1913"
+           style="opacity:1;fill:#0000ff;fill-opacity:1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none"
+           transform="rotate(-24.054048)" />
+        <g
+           transform="matrix(0.48512553,-0.21654038,0.76965089,1.7242849,-65.303579,-18.798768)"
+           id="g4618-3">
+          <circle
+             style="opacity:0.39500002;fill:#008aff;fill-opacity:1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none"
+             id="path1695-6"
+             cx="174.24702"
+             cy="92.514877"
+             r="29.104166"
+             inkscape:export-xdpi="200"
+             inkscape:export-ydpi="200" />
+        </g>
+      </g>
     </g>
     <image
        y="166.93837"

+ 1 - 2
graphics/fig4.sla

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<SCRIBUSUTF8NEW Version="1.4.6">
+<SCRIBUSUTF8NEW Version="1.4.8">
     <DOCUMENT ANZPAGES="1" PAGEWIDTH="323.149606299213" PAGEHEIGHT="340.157480314961" BORDERLEFT="0" BORDERRIGHT="0" BORDERTOP="0" BORDERBOTTOM="0" PRESET="0" BleedTop="0" BleedLeft="0" BleedRight="0" BleedBottom="0" ORIENTATION="0" PAGESIZE="Custom" FIRSTNUM="1" BOOK="0" AUTOSPALTEN="1" ABSTSPALTEN="0.3881" UNITS="4" DFONT="Carlito Bold" DSIZE="12" DCOL="1" DGAP="0" TabFill="" TabWidth="36" AUTHOR="" COMMENTS="" KEYWORDS="" PUBLISHER="" DOCDATE="" DOCTYPE="" DOCFORMAT="" DOCIDENT="" DOCSOURCE="" DOCLANGINFO="" DOCRELATION="" DOCCOVER="" DOCRIGHTS="" DOCCONTRIB="" TITLE="" SUBJECT="" VHOCH="33" VHOCHSC="66" VTIEF="33" VTIEFSC="66" VKAPIT="75" BASEGRID="14.4" BASEO="0" AUTOL="20" UnderlinePos="-1" UnderlineWidth="-1" StrikeThruPos="-1" StrikeThruWidth="-1" GROUPC="1" HCMS="0" DPSo="0" DPSFo="0" DPuse="0" DPgam="0" DPbla="1" DPMo="Apple RGB" DPPr="Artifex CMYK SWOP Profile" DPIn="Apple RGB" DPInCMYK="Artifex CMYK SWOP Profile" DPIn2="Apple RGB" DPIn3="Artifex CMYK SWOP Profile" DISc="1" DIIm="0" ALAYER="0" LANGUAGE="English (USA)" MINWORDLEN="3" HYCOUNT="2" AUTOMATIC="1" AUTOCHECK="0" GUIDELOCK="0" SnapToGuides="0" SnapToGrid="0" MINGRID="20.0012598425197" MAJGRID="100.00062992126" SHOWGRID="0" SHOWGUIDES="1" showcolborders="1" SHOWFRAME="1" SHOWLAYERM="0" SHOWMARGIN="1" SHOWBASE="0" SHOWPICT="1" SHOWControl="0" SHOWLINK="0" rulerMode="1" showrulers="1" showBleed="1" rulerXoffset="0" rulerYoffset="0" GuideRad="10" GRAB="4" POLYC="4" POLYF="0.707106781186548" POLYR="0" POLYCUR="0" POLYFD="0" POLYS="0" AutoSave="1" AutoSaveTime="120000" ScratchBottom="20.0012598425197" ScratchLeft="100.00062992126" ScratchRight="100.00062992126" ScratchTop="20.0012598425197" GapHorizontal="0" GapVertical="39.9996850393701" StartArrow="0" EndArrow="0" PEN="Black" BRUSH="None" PENLINE="Black" PENTEXT="Black" StrokeText="Black" TextBackGround="None" TextLineColor="None" TextBackGroundShade="100" TextLineShade="100" TextPenShade="100" TextStrokeShade="100" STIL="1" STILLINE="1" WIDTH="1" WIDTHLINE="1" PENSHADE="100" LINESHADE="100" BRUSHSHADE="100" MAGMIN="10" MAGMAX="3200" MAGSTEP="200" CPICT="None" PICTSHADE="100" PICTSCX="1" PICTSCY="1" PSCALE="1" PASPECT="1" EmbeddedPath="0" HalfRes="1" dispX="0" dispY="0" constrain="15" MINORC="#00ff00" MAJORC="#00ff00" GuideC="#000080" BaseC="#c0c0c0" GuideZ="10" BACKG="1" PAGEC="#ffffff" MARGC="#0000ff" RANDF="0" currentProfile="PostScript">
         <CheckProfile Name="PDF 1.3" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkResolution="1" checkTransparency="1" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkOffConflictLayers="0"/>
         <CheckProfile Name="PDF 1.4" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkResolution="1" checkTransparency="0" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkOffConflictLayers="0"/>
@@ -27,7 +27,6 @@
         <LAYERS NUMMER="0" LEVEL="0" NAME="Background" SICHTBAR="1" DRUCKEN="1" EDIT="1" FLOW="1" TRANS="1" BLEND="0" OUTL="0" LAYERC="#000000"/>
         <Printer firstUse="1" toFile="1" useAltPrintCommand="1" outputSeparations="1" useSpotColors="1" useColor="1" mirrorH="0" mirrorV="0" useICC="0" doGCR="1" doClip="1" setDevParam="1" useDocBleeds="1" cropMarks="1" bleedMarks="1" registrationMarks="0" colorMarks="0" includePDFMarks="1" PSLevel="-1794779104" PDLanguage="-1794779104" markOffset="4.64496030605941e-310" BleedTop="0" BleedLeft="0" BleedRight="0" BleedBottom="0" printer="" filename="" separationName="" printerCommand=""/>
         <PDF firstUse="0" Thumbnails="0" Articles="0" Bookmarks="0" Compress="1" CMethod="0" Quality="0" EmbedPDF="0" MirrorH="0" MirrorV="0" Clip="0" RotateDeg="0" PresentMode="0" RecalcPic="0" Grayscale="0" RGBMode="1" UseProfiles="0" UseProfiles2="0" Binding="0" PicRes="300" Resolution="300" Version="14" Intent="1" Intent2="0" SolidP="Apple RGB" ImageP="Apple RGB" PrintP="Artifex CMYK SWOP Profile" InfoString="" BTop="0" BLeft="0" BRight="0" BBottom="0" useDocBleeds="0" cropMarks="0" bleedMarks="0" registrationMarks="0" colorMarks="0" docInfoMarks="0" markOffset="0" ImagePr="0" PassOwner="" PassUser="" Permissions="-4" Encrypt="0" UseLayers="0" UseLpi="0" UseSpotColors="1" doMultiFile="0" displayBookmarks="0" displayFullscreen="0" displayLayers="0" displayThumbs="0" hideMenuBar="0" hideToolBar="0" fitWindow="0" PageLayout="0" openAction="">
-            <Subset Name="Carlito Bold"/>
             <Effekte pageEffectDuration="1" pageViewDuration="1" effectType="0" Dm="0" M="0" Di="0"/>
             <LPI Color="" Frequency="133" Angle="45" SpotFunction="3"/>
             <LPI Color="Black" Frequency="133" Angle="45" SpotFunction="3"/>

+ 19 - 7
notebooks/2020-08-12-max-entropy-rule-schematics-with-real-input-map.ipynb

@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 1,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -12,7 +12,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -29,9 +29,21 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 3,
    "metadata": {},
-   "outputs": [],
+   "outputs": [
+    {
+     "ename": "ModuleNotFoundError",
+     "evalue": "No module named 'scripts'",
+     "output_type": "error",
+     "traceback": [
+      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
+      "\u001b[0;32m<ipython-input-3-eec7f6728c0b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mscripts\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mspatial_network\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mperlin\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_entropy_maximisation_perlin_map\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mget_perlin_map\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mscripts\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mspatial_layout\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSpatialLayout\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mscripts\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minterneuron_placement\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mplot_neural_sheet\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'scripts'"
+     ]
+    }
+   ],
    "source": [
     "from scripts.spatial_network.perlin.run_entropy_maximisation_perlin_map import get_perlin_map\n",
     "from scripts.spatial_layout import SpatialLayout\n",
@@ -40,7 +52,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 4,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -438,9 +450,9 @@
  ],
  "metadata": {
   "kernelspec": {
-   "display_name": "Python 3",
+   "display_name": "subiculum_polar_interneurons_from_paul",
    "language": "python",
-   "name": "python3"
+   "name": "subiculum_polar_interneurons_from_paul"
   },
   "language_info": {
    "codemirror_mode": {

+ 2 - 0
scripts/spatial_maps/interneuron_orientation_correlation/orientation_difference_per_distance_perlin.py

@@ -18,8 +18,10 @@ n_inh = 100
 inhibitory_axon_long_axis = 100
 inhibitory_axon_short_axis = 25
 # corr_len = 800
+# corr_len_list = [50, 200, 800]
 corr_len_list = [50, 200, 800]
 
+
 fig, axes = plt.subplots(3, 4)
 
 for corr_len, axes_line in zip(corr_len_list, axes):

+ 284 - 0
scripts/spatial_maps/max_entropy_supplementary/figure_max_entropy_rule.py

@@ -0,0 +1,284 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+# In[1]:
+
+
+# get_ipython().run_line_magic('load_ext', 'autoreload')
+# get_ipython().run_line_magic('autoreload', '2')
+
+# In[2]:
+
+
+import matplotlib.pyplot as plt
+import numpy as np
+# from scripts.spatial_network.perlin.paper_figures_spatial_head_direction_network_perlin_map import FIGURE_SAVE_PATH
+FIGURE_SAVE_PATH = '../../../figures/figure_4_paper_perlin/'
+# ## Get input map
+
+# In[3]:
+
+
+from scripts.spatial_network.perlin.run_entropy_maximisation_perlin_map import get_perlin_map
+from scripts.spatial_layout import SpatialLayout
+from scripts.interneuron_placement import plot_neural_sheet
+
+# In[4]:
+
+
+seed = 1
+correlation_length = 200
+map_size = 900
+long_half = 100
+short_half = 25
+
+Ne = 3600
+Ni = 400
+
+Ne_per_row = int(np.sqrt(Ne))
+Ni_per_row = int(np.sqrt(Ni))
+
+# In[6]:
+
+
+input_map = get_perlin_map(correlation_length, seed, map_size, Ne)
+spatial_layout = SpatialLayout(input_map, Ne, Ni, long_half, short_half, map_size)
+
+# In[7]:
+
+
+plot_neural_sheet(spatial_layout.ex_positions, spatial_layout.ex_tunings)
+
+# ## Choose interneuron and get entropies
+
+# In[8]:
+
+
+from scripts.interneuron_placement import Pickle, get_excitatory_phases_in_inhibitory_axon, get_correct_position_mesh
+
+# In[9]:
+
+
+from scripts.spatial_layout import get_entropy
+
+# In[10]:
+
+
+in_idx = 144
+
+# In[11]:
+
+
+pos_x = spatial_layout.in_positions[in_idx][0]
+pos_y = spatial_layout.in_positions[in_idx][1]
+
+# In[12]:
+
+
+equivalent_radius = np.sqrt(long_half * short_half)
+circular_axon = Pickle(pos_x, pos_y, equivalent_radius, equivalent_radius, 0)
+
+# In[13]:
+
+
+neuron_positions = spatial_layout.ex_positions
+neuron_tunings = spatial_layout.ex_tunings
+
+# In[14]:
+
+
+number_of_phases = 36
+phases = np.linspace(-np.pi / 2, np.pi / 2, number_of_phases, endpoint=False)
+
+# In[15]:
+
+
+number_of_bins = 10
+tuning_bins = np.linspace(-np.pi, np.pi, number_of_bins + 1)
+tunings = []
+entropies = []
+for phase in phases:
+    axonal_cloud = Pickle(pos_x, pos_y, long_half, short_half, phase)
+    tunings.append(get_excitatory_phases_in_inhibitory_axon(neuron_positions, neuron_tunings, axonal_cloud))
+    entropies.append(get_entropy(axonal_cloud, neuron_positions, neuron_tunings, tuning_bins))
+
+# In[16]:
+
+
+circular_entropy = get_entropy(circular_axon, neuron_positions, neuron_tunings, tuning_bins)
+
+# In[17]:
+
+
+max_entropy = max(entropies)
+max_phase = phases[np.argmax(entropies)]
+max_id = np.argmax(entropies)
+
+min_entropy = min(entropies)
+min_phase = phases[np.argmin(entropies)]
+min_id = np.argmin(entropies)
+
+# In[18]:
+
+
+circular_tuning = get_excitatory_phases_in_inhibitory_axon(neuron_positions, neuron_tunings, circular_axon)
+
+# ## Figures
+
+# In[19]:
+
+
+import matplotlib
+
+# In[20]:
+
+
+plt.style.use('../../spatial_network/perlin/figures.mplstyle')
+
+# In[21]:
+
+
+width = 4.0 / 2.54
+height = 3.2 / 2.54
+
+detail_size = 2.5 * long_half
+
+detail_x_low = pos_x - detail_size / 2.0
+detail_x_high = pos_x + detail_size / 2.0
+detail_y_low = pos_y - detail_size / 2.0
+detail_y_high = pos_y + detail_size / 2.0
+
+colormap = matplotlib.cm.get_cmap('hsv')
+
+bar_colors = [colormap(value) for value in np.linspace(0, 1, number_of_bins)]
+
+X, Y = get_correct_position_mesh(spatial_layout.ex_positions)
+head_dir_preference = np.array(spatial_layout.ex_tunings).reshape((Ne_per_row, Ne_per_row))
+
+# ### Polar Interneuron
+
+# In[22]:
+
+
+fig = plt.figure(figsize=(width, height))
+
+ax_map = fig.add_axes([0.05, 0.1, 0.7 * height / width, 0.7])
+
+ax_map.pcolor(X, Y, head_dir_preference, vmin=-np.pi, vmax=np.pi, cmap=colormap)
+
+line_length = 1.2 * detail_size
+max_entropy_ell = Pickle(pos_x, pos_y, long_half, short_half, max_phase).get_ellipse()
+
+max_entropy_line = plt.Line2D(
+    [pos_x - np.cos(max_phase) * line_length / 2.0, pos_x + np.cos(max_phase) * line_length / 2.0],
+    [pos_y - np.sin(max_phase) * line_length / 2.0, pos_y + np.sin(max_phase) * line_length / 2.0])
+max_entropy_line.set_linestyle('dotted')
+max_entropy_line.set_clip_on(False)
+
+min_entropy_ell = Pickle(pos_x, pos_y, long_half, short_half, min_phase).get_ellipse()
+min_entropy_ell.set_linestyle('dashed')
+
+min_entropy_line = plt.Line2D(
+    [pos_x - np.cos(min_phase) * line_length / 2.0, pos_x + np.cos(min_phase) * line_length / 2.0],
+    [pos_y - np.sin(min_phase) * line_length / 2.0, pos_y + np.sin(min_phase) * line_length / 2.0])
+min_entropy_line.set_linestyle('dotted')
+min_entropy_line.set_clip_on(False)
+
+ax_map.add_artist(max_entropy_ell)
+ax_map.add_artist(max_entropy_line)
+ax_map.add_artist(min_entropy_ell)
+ax_map.add_artist(min_entropy_line)
+
+ax_map.set_xlim(detail_x_low, detail_x_high)
+ax_map.set_ylim(detail_y_low, detail_y_high)
+
+ax_map.spines["right"].set_visible(False)
+ax_map.spines["left"].set_visible(False)
+ax_map.spines["top"].set_visible(False)
+ax_map.spines["bottom"].set_visible(False)
+ax_map.xaxis.set_ticks([])
+ax_map.yaxis.set_ticks([])
+
+ax_map.text(pos_x - np.cos(max_phase) * line_length / 2.0, pos_y - np.sin(max_phase) * line_length / 2.0,
+            "$\\theta_{max}$", va='bottom', ha='left')
+ax_map.text(pos_x + np.cos(min_phase) * line_length / 2.0, pos_y + np.sin(min_phase) * line_length / 2.0,
+            "$\\theta_{min}$", va='center', ha='left')
+
+ax_dist_max = fig.add_axes(
+    [0.05 + 0.7 * height / width + 0.03, 0.1, 1 - 0.75 * height / width - 0.05 - 0.05 - 0.1, 0.27])
+n_max_entropy, _, bars = ax_dist_max.hist(tunings[max_id], bins=number_of_bins, range=(-np.pi, np.pi))
+for bar, bar_color in zip(bars, bar_colors):
+    bar.set_color(bar_color)
+ax_dist_max.text(0, 1.2, "$\\theta_{max}$\n" + "{:.2f}".format(entropies[max_id]), transform=ax_dist_max.transAxes,
+                 va='top')
+
+ax_dist_min = fig.add_axes(
+    [0.05 + 0.7 * height / width + 0.03, 0.48, 1 - 0.75 * height / width - 0.05 - 0.05 - 0.1, 0.27])
+n_min_entropy, _, bars = ax_dist_min.hist(tunings[min_id], bins=number_of_bins, range=(-np.pi, np.pi))
+for bar, bar_color in zip(bars, bar_colors):
+    bar.set_color(bar_color)
+ax_dist_min.text(0, 1.2, "$\\theta_{min}$\n" + "{:.2f}".format(entropies[min_id]), transform=ax_dist_min.transAxes,
+                 va='top')
+
+for ax in [ax_dist_max, ax_dist_min]:
+    ax.set_ylim(0, max(max(n_max_entropy), max(n_min_entropy)))
+    ax.spines["right"].set_visible(False)
+    ax.spines["left"].set_visible(False)
+    ax.spines["top"].set_visible(False)
+    ax.spines["bottom"].set_linewidth(0.5)
+    ax.xaxis.set_ticks([])
+    ax.yaxis.tick_right()
+
+fig.savefig(FIGURE_SAVE_PATH + "B_ii_max_entropy_rule_polar_ins.png")
+
+# ### Circular Interneuron
+
+# In[25]:
+
+
+from scripts.spatial_network.perlin.figure_utils import add_length_scale
+
+# In[36]:
+
+
+fig = plt.figure(figsize=(width, height))
+
+ax_map = fig.add_axes([0.05, 0.1, 0.7 * height / width, 0.7])
+
+ax_map.pcolor(X, Y, head_dir_preference, vmin=-np.pi, vmax=np.pi, cmap=colormap)
+
+circle = Pickle(pos_x, pos_y, equivalent_radius, equivalent_radius, 0).get_ellipse()
+
+ax_map.add_artist(circle)
+
+ax_map.set_xlim(detail_x_low, detail_x_high)
+ax_map.set_ylim(detail_y_low, detail_y_high)
+
+ax_map.spines["right"].set_visible(False)
+ax_map.spines["left"].set_visible(False)
+ax_map.spines["top"].set_visible(False)
+ax_map.spines["bottom"].set_visible(False)
+ax_map.xaxis.set_ticks([])
+ax_map.yaxis.set_ticks([])
+
+add_length_scale(ax_map, 100, detail_x_high + 30, detail_x_high + 10 + 100, detail_y_low + 40, detail_y_low + 40)
+
+ax_dist = fig.add_axes([0.05 + 0.7 * height / width + 0.03, 0.375, 1 - 0.75 * height / width - 0.05 - 0.05 - 0.1, 0.27])
+n_circle, _, bars = ax_dist.hist(circular_tuning, bins=number_of_bins, range=(-np.pi, np.pi))
+for bar, bar_color in zip(bars, bar_colors):
+    bar.set_color(bar_color)
+
+ax_dist.text(0, 1.2, "circ. \n{:.2f}".format(circular_entropy), transform=ax_dist.transAxes, va='top')
+
+for ax in [ax_dist]:
+    ax.set_ylim(0, max(max(n_max_entropy), max(n_min_entropy)))
+    ax.spines["right"].set_visible(False)
+    ax.spines["left"].set_visible(False)
+    ax.spines["top"].set_visible(False)
+    ax.spines["bottom"].set_linewidth(0.5)
+    ax.xaxis.set_ticks([])
+    ax.yaxis.tick_right()
+
+fig.savefig(FIGURE_SAVE_PATH + "B_ii_max_entropy_rule_circular_in.png")
+
+

+ 6 - 6
scripts/spatial_maps/simplex_algorithm_deconstruction.py

@@ -173,17 +173,17 @@ class OpenSimplex(object):
         dy1 = dy0 - 0 - SQUISH_CONSTANT_2D
         attn1 = 2 - dx1 * dx1 - dy1 * dy1
         extrapolate = self._extrapolate2d
-        # if attn1 > 0:
-        #     attn1 *= attn1
-        #     value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, dx1, dy1)
+        if attn1 > 0:
+            attn1 *= attn1
+            value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, dx1, dy1)
 
         # Contribution (0,1)
         dx2 = dx0 - 0 - SQUISH_CONSTANT_2D
         dy2 = dy0 - 1 - SQUISH_CONSTANT_2D
         attn2 = 2 - dx2 * dx2 - dy2 * dy2
-        # if attn2 > 0:
-        #     attn2 *= attn2
-        #     value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, dx2, dy2)
+        if attn2 > 0:
+            attn2 *= attn2
+            value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, dx2, dy2)
 
         if in_sum <= 1: # We're inside the triangle (2-Simplex) at (0,0)
             zins = 1 - in_sum

+ 89 - 0
scripts/spatial_maps/simplex_input_tuning_correlation/correlation_length_distance_perlin.py

@@ -0,0 +1,89 @@
+import os
+import matplotlib.pyplot as plt
+import numpy as np
+from pypet import Trajectory
+from pypet.brian2 import Brian2MonitorResult
+from scripts.spatial_network.perlin.run_entropy_maximisation_perlin_map import DATA_FOLDER
+from scripts.interneuron_placement import create_grid_of_excitatory_neurons
+from scripts.spatial_maps.uniform_perlin_map import UniformPerlinMap
+from scipy.optimize import curve_fit
+
+
+def filter_run_names_by_par_dict(traj, par_dict):
+    run_name_list = []
+    for run_idx, run_name in enumerate(traj.f_get_run_names()):
+        traj.f_set_crun(run_name)
+        paramters_equal = True
+        for key, val in par_dict.items():
+            if (traj.par[key] != val):
+                paramters_equal = False
+        if paramters_equal:
+            run_name_list.append(run_name)
+    traj.f_restore_default()
+
+    return run_name_list
+
+
+def correlation_length_fit_dict(traj, load=True):
+    def phi_diff(d_phi):
+        return (d_phi + np.pi) % (2 * np.pi) - np.pi
+
+    def exp_fit_func(x, corr_len):
+        return np.pi / 2. * np.exp(-corr_len * x)
+
+    corr_len_expl = traj.f_get('correlation_length').f_get_range()
+    corr_len_list = np.unique(corr_len_expl)
+
+    dim = 60
+    size = 900
+    n_exc = dim * dim
+
+    if not load:
+        fit_correlation_lengths_dict = {}
+
+        ex_positions = traj.results.runs[traj.f_get_run_names()[0]].ex_positions
+        for corr_len in corr_len_list:
+
+            par_dict = {'seed': 1, 'correlation_length': corr_len, 'long_axis': 100.0}
+
+            run_name = filter_run_names_by_par_dict(traj, par_dict)
+
+            ex_tunings = traj.results.runs[run_name].ex_tunings
+
+            bins = np.linspace(0.0, 800, 301)
+
+            dist_list = []
+            phi_list = []
+            d_phi_list = []
+            for i in range(n_exc):
+                phi_list.append(ex_tunings[i])
+                for j in range(n_exc):
+                    xi, yi = ex_positions[i]
+                    xj, yj = ex_positions[j]
+                    dist = np.sqrt((xi - xj) ** 2 + (yi - yj) ** 2)
+                    dist_list.append(dist)
+                    d_phi = np.abs(phi_diff(ex_tunings[i] - ex_tunings[j]))
+                    d_phi_list.append(d_phi)
+
+            binned_ids = np.digitize(dist_list, bins)
+            binned_d_phi = [[] for _ in range(len(bins))]
+            for id, bin_id in enumerate(binned_ids):
+                current_d_phi = d_phi_list[id]
+                binned_d_phi[bin_id - 1].append(current_d_phi)
+
+            binned_mean = np.array([np.mean(bin) for bin in binned_d_phi])
+
+            nan_ids = np.isnan(binned_mean)
+            binned_mean = binned_mean[~nan_ids]
+            bins = bins[~nan_ids]
+
+            params, _ = curve_fit(exp_fit_func, bins, np.pi / 2 - np.array(binned_mean), [1])
+            fit_corr_len = 1. / params[0]
+            print(corr_len, fit_corr_len)
+            fit_correlation_lengths_dict[corr_len] = fit_corr_len
+
+        np.save(DATA_FOLDER + 'fit_correlation_lengths_dict.npy', fit_correlation_lengths_dict)
+        return fit_correlation_lengths_dict
+    else:
+        fit_correlation_lengths_dict = np.load(DATA_FOLDER + 'fit_correlation_lengths_dict.npy')
+        return fit_correlation_lengths_dict.item()

+ 94 - 0
scripts/spatial_maps/simplex_input_tuning_correlation/correlation_length_with_circular_correlation_formula.py

@@ -0,0 +1,94 @@
+import os
+import matplotlib.pyplot as plt
+import numpy as np
+from pypet import Trajectory
+from pypet.brian2 import Brian2MonitorResult
+
+from scripts.interneuron_placement import create_grid_of_excitatory_neurons, get_correct_position_mesh
+from scripts.spatial_maps.uniform_perlin_map import UniformPerlinMap
+from scipy.optimize import curve_fit
+import pandas as pd
+
+def phi_diff(d_phi):
+    return (d_phi + np.pi) % (2*np.pi) - np.pi
+
+def exp_fit_func(x, corr_len):
+    return np.pi / 2. * np.exp(-corr_len * x)
+
+use_saved_array = False
+dim = 60
+size = 900
+n_exc = dim * dim
+
+corr_len_list = [200, 400, 800]
+
+fig, axes = plt.subplots(3, 2)
+
+for idx, (corr_len, axes_line) in enumerate(zip(corr_len_list, axes)):
+
+    bins = np.linspace(0.0, 800, 301)
+
+    perlin_map = UniformPerlinMap(dim, dim, corr_len, size, size, 3)
+
+    ex_positions, ex_tunings = create_grid_of_excitatory_neurons(perlin_map.sheet_x, perlin_map.sheet_y, perlin_map.x_dim,
+                                                                 perlin_map.get_tuning)
+
+    ex_tun_array = np.array(ex_tunings).reshape((dim, dim))
+    # TODO: Why was this transposed for plotting? (now changed)
+
+    x_index = [pos[0] for pos in ex_positions]
+    y_index = [pos[1] for pos in ex_positions]
+
+    x_displacements = range(-dim+1,dim)
+    y_displacements = range(-dim+1,dim)
+    r_c_array = np.ndarray((len(x_displacements),len(y_displacements)))
+
+    # For test purposes:
+    # for i in range(dim):
+    #     for j in range(dim):
+    #         ex_tun_array[i,j] = np.sin(2*np.pi*i/dim)
+
+    for id_dx in x_displacements:
+        for id_dy in y_displacements:
+            a_1 = ex_tun_array[max(0, id_dx): min(dim, dim + id_dx), max(0, id_dy): min(dim, dim + id_dy)]
+            C_11 = np.sum(np.cos(a_1)) / len(a_1)
+            S_11 = np.sum(np.sin(a_1)) / len(a_1)
+            T_11 = np.arctan2(S_11, C_11)
+
+            a_2 = ex_tun_array[max(0, -id_dx): min(dim, dim - id_dx), max(0, -id_dy): min(dim, dim - id_dy)]
+            C_21 = np.sum(np.cos(a_2)) / len(a_2)
+            S_21 = np.sum(np.sin(a_2)) / len(a_2)
+            T_21 = np.arctan2(S_21, C_21)
+
+            r_c_denominator = np.sin(a_1 - T_11) * np.sin(a_2 - T_21)
+            r_c_norm = np.sqrt(np.sum(np.sin(a_1 - T_11) ** 2) * np.sum(np.sin(a_2 - T_21) ** 2))
+            if r_c_norm != 0:
+                r_c = np.sum(r_c_denominator) / r_c_norm
+            else:
+                # TODO: Not sure which value to put here.
+                r_c = 0
+            r_c_array[id_dx + dim - 1, id_dy + dim - 1] = r_c
+    print(r_c_array)
+
+    X, Y = get_correct_position_mesh(ex_positions)
+
+    head_dir_preference = np.array(ex_tunings).reshape((dim, dim))
+    c = axes_line[0].pcolor(X, Y, head_dir_preference, vmin=-np.pi, vmax=np.pi, cmap='hsv')
+    axes_line[0].set_title('Scale factor: {}'.format(corr_len))
+    axes_line[0].set_aspect('equal')
+
+    xmin = np.min(x_displacements)
+    xmax = np.max(x_displacements)
+    dx = (xmax - xmin) / (len(x_displacements) - 1)
+
+    ymin = np.min(y_displacements)
+    ymax = np.max(y_displacements)
+    dy = (ymax - ymin) / (len(x_displacements) - 1)
+
+    DX, DY = np.meshgrid(np.arange(xmin, xmax + 2 * dx, dx) - dx / 2., np.arange(ymin, ymax + 2 * dy, dy) - dy / 2.)
+    d = axes_line[1].pcolor(DX, DY, r_c_array)
+    axes_line[1].set_aspect('equal')
+
+    fig.colorbar(d, ax=axes_line[1], label="correlation")
+
+plt.show()

+ 128 - 9
scripts/spatial_network/perlin/paper_figures_spatial_head_direction_network_perlin_map.py

@@ -13,6 +13,8 @@ from pypet.brian2 import Brian2MonitorResult
 
 from scripts.interneuron_placement import get_position_mesh, Pickle, get_correct_position_mesh
 from scripts.model_figure.plot_circular_colorbar import plot_colorbar
+from scripts.spatial_maps.simplex_input_tuning_correlation.correlation_length_distance_perlin import \
+    correlation_length_fit_dict
 from scripts.spatial_network.figures_spatial_head_direction_network_orientation_map import plot_hdi_in_space
 from scripts.spatial_network.perlin.figure_utils import remove_frame, remove_ticks, add_length_scale, cm_per_inch, \
     panel_size, head_direction_input_colormap
@@ -1117,7 +1119,7 @@ def filter_run_names_by_par_dict(traj, par_dict):
     return run_name_list
 
 
-def plot_exc_and_inh_hdi_over_corr_len(traj, plot_run_names):
+def plot_exc_and_inh_hdi_over_simplex_grid_scale(traj, plot_run_names):
     corr_len_expl = traj.f_get('correlation_length').f_get_range()
     seed_expl = traj.f_get('seed').f_get_range()
     label_expl = [traj.derived_parameters.runs[run_name].morphology.morph_label for run_name in traj.f_get_run_names()]
@@ -1161,6 +1163,8 @@ def plot_exc_and_inh_hdi_over_corr_len(traj, plot_run_names):
     # linestyles = ['solid', 'dashed', 'solid']
     # markers = [verts, '', 'o']
 
+    # corr_len_fit_dict = correlation_length_fit_dict(traj, load=True)
+
     width = 2 * panel_size
     height = 1.2 * panel_size
     fig, ax = plt.subplots(1, 1, figsize=(width, height))
@@ -1191,18 +1195,20 @@ def plot_exc_and_inh_hdi_over_corr_len(traj, plot_run_names):
         exc_col, exc_lin, exc_mar, exc_mar_size = exc_style_dict[label]
         inh_col, inh_lin, inh_mar, inh_mar_size = inh_style_dict[label]
 
-        ax.plot(corr_len_range, exc_hdi_mean, label='exc., ' + label, marker=exc_mar, color=exc_col, linestyle=exc_lin,
+        simplex_grid_scale = corr_len_range * np.sqrt(2)
+
+        ax.plot(simplex_grid_scale, exc_hdi_mean, label='exc., ' + label, marker=exc_mar, color=exc_col, linestyle=exc_lin,
                 markersize=exc_mar_size, alpha=0.5)
-        plt.fill_between(corr_len_range, exc_hdi_mean - exc_hdi_std,
+        plt.fill_between(simplex_grid_scale, exc_hdi_mean - exc_hdi_std,
                          exc_hdi_mean + exc_hdi_std, alpha=0.3, color=exc_col)
-        ax.plot(corr_len_range, inh_hdi_mean, label='inh., ' + label, marker=inh_mar, color=inh_col, linestyle=inh_lin,
+        ax.plot(simplex_grid_scale, inh_hdi_mean, label='inh., ' + label, marker=inh_mar, color=inh_col, linestyle=inh_lin,
                 markersize=inh_mar_size, alpha=0.5)
-        plt.fill_between(corr_len_range, inh_hdi_mean - inh_hdi_std,
+        plt.fill_between(simplex_grid_scale, inh_hdi_mean - inh_hdi_std,
                          inh_hdi_mean + inh_hdi_std, alpha=0.3, color=inh_col)
 
-    ax.set_xlabel('correlation length')
+    ax.set_xlabel('simplex grid scale')
     ax.set_ylabel('head direction index')
-    ax.axvline(get_closest_correlation_length(traj, 200.0), color='k', linewidth=0.5, zorder=0)
+    ax.axvline(get_closest_correlation_length(traj, 200.0) * np.sqrt(2), color='k', linewidth=0.5, zorder=0)
     ax.set_ylim(0.0, 1.0)
     # ax.set_xlim(0.0, np.max(corr_len_range))
     remove_frame(ax, ["right", "top"])
@@ -1218,6 +1224,111 @@ def plot_exc_and_inh_hdi_over_corr_len(traj, plot_run_names):
         plt.savefig(FIGURE_SAVE_PATH + 'F_hdi_over_corr_len_scaled.png')
         plt.close(fig)
 
+def plot_exc_and_inh_hdi_over_fit_corr_len(traj, plot_run_names):
+    corr_len_expl = traj.f_get('correlation_length').f_get_range()
+    seed_expl = traj.f_get('seed').f_get_range()
+    label_expl = [traj.derived_parameters.runs[run_name].morphology.morph_label for run_name in traj.f_get_run_names()]
+    label_range = set(label_expl)
+
+    exc_hdi_frame = pd.Series(index=[corr_len_expl, seed_expl, label_expl])
+    exc_hdi_frame.index.names = ["corr_len", "seed", "label"]
+    inh_hdi_frame = pd.Series(index=[corr_len_expl, seed_expl, label_expl])
+    inh_hdi_frame.index.names = ["corr_len", "seed", "label"]
+
+    for run_name, corr_len, seed, label in zip(plot_run_names, corr_len_expl, seed_expl, label_expl):
+        ex_tunings = traj.results.runs[run_name].ex_tunings
+        head_direction_indices = traj.results[run_name].head_direction_indices
+        # TODO: Actual correlation lengths
+        # actual_corr_len = get_correlation_length(ex_tunings.reshape((30,30)), 450, 30)
+        exc_hdi_frame[corr_len, seed, label] = np.mean(head_direction_indices)
+
+        inh_head_direction_indices = traj.results[run_name].inh_head_direction_indices
+        inh_hdi_frame[corr_len, seed, label] = np.mean(inh_head_direction_indices)
+
+    # TODO: Standard deviation also for the population
+    exc_hdi_n_and_seed_mean = exc_hdi_frame.groupby(level=[0, 2]).mean()
+    exc_hdi_n_and_seed_std_dev = exc_hdi_frame.groupby(level=[0, 2]).std()
+
+    inh_hdi_n_and_seed_mean = inh_hdi_frame.groupby(level=[0, 2]).mean()
+    inh_hdi_n_and_seed_std_dev = inh_hdi_frame.groupby(level=[0, 2]).std()
+
+    markersize = 4.
+    exc_style_dict = {
+        NO_SYNAPSES: ['dimgrey', 'dashed', '', 0],
+        POLARIZED: ['red', 'solid', '^', markersize],
+        CIRCULAR: ['lightsalmon', 'solid', '^', markersize]
+    }
+    inh_style_dict = {
+        NO_SYNAPSES: ['dimgrey', 'dashed', '', 0],
+        POLARIZED: ['blue', 'solid', 'o', markersize],
+        CIRCULAR: ['lightblue', 'solid', 'o', markersize]
+
+    }
+    # colors = ['blue', 'grey', 'lightblue']
+    # linestyles = ['solid', 'dashed', 'solid']
+    # markers = [verts, '', 'o']
+
+    corr_len_fit_dict = correlation_length_fit_dict(traj, load=True)
+
+    width = 2 * panel_size
+    height = 1.2 * panel_size
+    fig, ax = plt.subplots(1, 1, figsize=(width, height))
+
+    for label in sorted(label_range, reverse=True):
+        if label == NO_SYNAPSES:
+            no_conn_hdi = exc_hdi_n_and_seed_mean[1, label]
+            ax.axhline(no_conn_hdi, color='grey', linestyle='--')
+
+            ax.annotate(short_labels(label), xy=(1.0, no_conn_hdi), xytext=(0, -2), xycoords='axes fraction',
+                        textcoords="offset points",
+                        va="top", \
+                        ha="right",
+                        color="dimgrey")
+
+            continue
+        exc_hdi_mean = exc_hdi_n_and_seed_mean[:, label]
+        exc_hdi_std = exc_hdi_n_and_seed_std_dev[:, label]
+
+        inh_hdi_mean = inh_hdi_n_and_seed_mean[:, label]
+        inh_hdi_std = inh_hdi_n_and_seed_std_dev[:, label]
+
+        corr_len_range = exc_hdi_mean.keys().to_numpy()
+        print(label)
+        for corr_len, ex_hdi, in_hdi in zip(corr_len_range, exc_hdi_mean, inh_hdi_mean):
+            print("length: {:.2f} um, ex hdi: {:.2f} and in hdi {:.2f}".format(corr_len, ex_hdi, in_hdi))
+
+        exc_col, exc_lin, exc_mar, exc_mar_size = exc_style_dict[label]
+        inh_col, inh_lin, inh_mar, inh_mar_size = inh_style_dict[label]
+
+        fit_corr_len = [corr_len_fit_dict[corr_len] for corr_len in corr_len_range]
+        print(corr_len_range)
+        print(fit_corr_len)
+        ax.plot(fit_corr_len, exc_hdi_mean, label='exc., ' + label, marker=exc_mar, color=exc_col, linestyle=exc_lin,
+                markersize=exc_mar_size, alpha=0.5)
+        plt.fill_between(fit_corr_len, exc_hdi_mean - exc_hdi_std,
+                         exc_hdi_mean + exc_hdi_std, alpha=0.3, color=exc_col)
+        ax.plot(fit_corr_len, inh_hdi_mean, label='inh., ' + label, marker=inh_mar, color=inh_col, linestyle=inh_lin,
+                markersize=inh_mar_size, alpha=0.5)
+        plt.fill_between(fit_corr_len, inh_hdi_mean - inh_hdi_std,
+                         inh_hdi_mean + inh_hdi_std, alpha=0.3, color=inh_col)
+
+    ax.set_xlabel('correlation length')
+    ax.set_ylabel('head direction index')
+    ax.axvline(corr_len_fit_dict[get_closest_correlation_length(traj, 200.0)], color='k', linewidth=0.5, zorder=0)
+    ax.set_ylim(0.0, 1.0)
+    # ax.set_xlim(0.0, np.max(corr_len_range))
+    remove_frame(ax, ["right", "top"])
+
+    tablelegend(ax, ncol=2, bbox_to_anchor=(1.1, 1.1), loc="upper right",
+                row_labels=None,
+                col_labels=[short_labels(label) for label in sorted(label_range - {"no conn"}, reverse=True)],
+                title_label='', borderaxespad=0, handlelength=2, edgecolor='white')
+    fig.subplots_adjust(bottom=0.2, left=0.2)
+    # plt.legend()
+
+    if save_figs:
+        plt.savefig(FIGURE_SAVE_PATH + 'hdi_over_fit_corr_len.png')
+        plt.close(fig)
 
 def plot_in_degree_map(traj, plot_run_names):
     n_ex = int(np.sqrt(traj.N_E))
@@ -1436,6 +1547,12 @@ if __name__ == "__main__":
     map_seed = 1
     exemplary_head_direction = 0
 
+    # corr_len_fit_dict = correlation_length_fit_dict(traj, load=True)
+    # plt.plot(corr_len_fit_dict.keys(),corr_len_fit_dict.values())
+    # plt.show()
+    # abbrechen
+
+
     print("## Map specifications")
     print("\tcorrelation length: {:.1f} um".format(map_length_scale))
     print("\tmap seed: {:d}".format(map_seed))
@@ -1485,7 +1602,7 @@ if __name__ == "__main__":
         selected_inhibitory_neuron,
         cut_off_dist=100.)
     #
-    number_of_suggestions = 30
+    number_of_suggestions = 20
     representative_excitatory_neuron_indices = get_neurons_with_given_hdi(hdi_means["polar_exc"], hdi_means[
         "circular_exc"],
                                                                           number_of_suggestions, plot_run_names,
@@ -1527,7 +1644,9 @@ if __name__ == "__main__":
 
     plot_orientation_maps_diff_scales_with_ellipse(traj)
 
-    plot_exc_and_inh_hdi_over_corr_len(traj, traj.f_get_run_names())
+    plot_exc_and_inh_hdi_over_simplex_grid_scale(traj, traj.f_get_run_names())
+
+    plot_exc_and_inh_hdi_over_fit_corr_len(traj, traj.f_get_run_names())
 
     if not save_figs:
         plt.show()

+ 1 - 1
scripts/spatial_network/perlin/run_entropy_maximisation_perlin_map.py

@@ -31,7 +31,7 @@ def get_local_data_folder():
     return data_folder
 
 
-DATA_FOLDER = "/groups/susanne/moritz/share/"
+DATA_FOLDER = "../../../data/"
 LOG_FOLDER = "../../../logs/"
 
 TRAJ_NAME = "full_figure_perlin_map"