Skip to content

Commit

Permalink
Merge pull request #2781 from jessica-mitchell/fix-sphinx-warnings
Browse files Browse the repository at this point in the history
Fix typos in spatial docs to render code
  • Loading branch information
jessica-mitchell authored Jun 1, 2023
2 parents 236e167 + 0694b58 commit 3086b0f
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 124 deletions.
2 changes: 1 addition & 1 deletion doc/htmldoc/networks/scripts/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def pn_fig(fig, loc, spatial_nodes, cdict,

plt.savefig('../user_manual_figures/conn6.png', bbox_inches='tight')

#{ conn7 #}
# { conn7 #}
cdict_random_in = {'rule': 'fixed_indegree',
'p': nest.spatial_distributions.gaussian(nest.spatial.distance, std=0.5),
'mask': {'circular': {'radius': 1.0}},
Expand Down
64 changes: 32 additions & 32 deletions doc/htmldoc/networks/scripts/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,

nest.ResetKernel()

#{ layer1 #}
# { layer1 #}
layer = nest.Create('iaf_psc_alpha',
positions=nest.spatial.grid(shape=[5, 5]))
#{ end #}
# { end #}

fig = nest.PlotLayer(layer, nodesize=50)
beautify_layer(layer, fig, xlabel='x-axis (columns)', ylabel='y-axis (rows)')
Expand All @@ -90,28 +90,28 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,
# plt.savefig('../user_manual_figures/layer1.png', bbox_inches='tight',
# bbox_extra_artists=tx)

print("#{ layer1s.log #}")
#{ layer1s #}
print("# { layer1s.log #}")
# { layer1s #}
print(layer.spatial)
#{ end #}
print("#{ end.log #}")
# { end #}
print("# { end.log #}")

print("#{ layer1p.log #}")
#{ layer1p #}
print("# { layer1p.log #}")
# { layer1p #}
nest.PrintNodes()
#{ end #}
print("#{ end.log #}")
# { end #}
print("# { end.log #}")

# --------------------------------------------------

nest.ResetKernel()

#{ layer2 #}
# { layer2 #}
layer = nest.Create('iaf_psc_alpha',
positions=nest.spatial.grid(
shape=[5, 5],
extent=[2.0, 0.5]))
#{ end #}
# { end #}

fig = nest.PlotLayer(layer, nodesize=50)
beautify_layer(layer, fig, xlabel='x-axis (columns)', ylabel='y-axis (rows)')
Expand All @@ -134,7 +134,7 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,

nest.ResetKernel()

#{ layer3 #}
# { layer3 #}
layer1 = nest.Create('iaf_psc_alpha',
positions=nest.spatial.grid(shape=[5, 5]))
layer2 = nest.Create('iaf_psc_alpha',
Expand All @@ -145,7 +145,7 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,
positions=nest.spatial.grid(
shape=[5, 5],
center=[1.5, 0.5]))
#{ end #}
# { end #}

fig = nest.PlotLayer(layer1, nodesize=50)
nest.PlotLayer(layer2, nodesize=50, nodecolor='g', fig=fig)
Expand All @@ -161,15 +161,15 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,

nest.ResetKernel()

#{ layer3a #}
# { layer3a #}
nx, ny = 5, 3
d = 0.1
layer = nest.Create('iaf_psc_alpha',
positions=nest.spatial.grid(
shape=[nx, ny],
extent=[nx * d, ny * d],
center=[nx * d / 2., 0.]))
#{ end #}
# { end #}

fig = nest.PlotLayer(layer, nodesize=100)
plt.plot(0, 0, 'x', markersize=20, c='k', mew=3)
Expand All @@ -186,12 +186,12 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,

nest.ResetKernel()

#{ layer4 #}
# { layer4 #}
pos = nest.spatial.free(pos=nest.random.uniform(min=-0.5, max=0.5),
num_dimensions=2)
layer = nest.Create('iaf_psc_alpha', 50,
positions=pos)
#{ end #}
# { end #}

fig = nest.PlotLayer(layer, nodesize=50)
beautify_layer(layer, fig, xlabel='x-axis (columns)', ylabel='y-axis (rows)',
Expand All @@ -204,10 +204,10 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,

nest.ResetKernel()

#{ layer4b #}
# { layer4b #}
pos = nest.spatial.free(pos=[[-0.5, -0.5], [-0.25, -0.25], [0.75, 0.75]])
layer = nest.Create('iaf_psc_alpha', positions=pos)
#{ end #}
# { end #}

fig = nest.PlotLayer(layer, nodesize=50)
beautify_layer(layer, fig, xlabel='x-axis (columns)', ylabel='y-axis (rows)',
Expand All @@ -221,11 +221,11 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,

nest.ResetKernel()

#{ layer4_3d #}
# { layer4_3d #}
pos = nest.spatial.free(nest.random.uniform(min=-0.5, max=0.5),
num_dimensions=3)
layer = nest.Create('iaf_psc_alpha', 200, positions=pos)
#{ end #}
# { end #}

fig = nest.PlotLayer(layer, nodesize=50)

Expand All @@ -235,10 +235,10 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,

nest.ResetKernel()

#{ layer4_3d_b #}
# { layer4_3d_b #}
pos = nest.spatial.grid(shape=[4, 5, 6])
layer = nest.Create('iaf_psc_alpha', positions=pos)
#{ end #}
# { end #}

fig = nest.PlotLayer(layer, nodesize=50)

Expand All @@ -248,13 +248,13 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,

nest.ResetKernel()

#{ player #}
# { player #}
layer = nest.Create('iaf_psc_alpha',
positions=nest.spatial.grid(
shape=[5, 1],
extent=[5., 1.],
edge_wrap=True))
#{ end #}
# { end #}

# fake plot with layer on line and circle
clist = [(0, 0, 1), (0.35, 0, 1), (0.6, 0, 1), (0.8, 0, 1), (1.0, 0, 1)]
Expand Down Expand Up @@ -307,22 +307,22 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,

nest.ResetKernel()

#{ layer6 #}
# { layer6 #}
layer1 = nest.Create('iaf_cond_alpha',
positions=nest.spatial.grid(shape=[2, 1]))
layer2 = nest.Create('poisson_generator',
positions=nest.spatial.grid(shape=[2, 1]))
#{ end #}
# { end #}

print("#{ layer6 #}")
print("# { layer6 #}")
nest.PrintNodes()
print("#{ end #}")
print("# { end #}")

# --------------------------------------------------

nest.ResetKernel()

#{ vislayer #}
# { vislayer #}
layer = nest.Create('iaf_psc_alpha',
positions=nest.spatial.grid(shape=[21, 21]))
probability_param = nest.spatial_distributions.gaussian(nest.spatial.distance, std=0.15)
Expand All @@ -337,5 +337,5 @@ def beautify_layer(layer, fig=plt.gcf(), xlabel=None, ylabel=None,
mask=conndict['mask'], probability_parameter=probability_param,
src_size=250, tgt_color='red', tgt_size=20, mask_color='red',
probability_cmap='Greens')
#{ end #}
# { end #}
plt.savefig('../user_manual_figures/vislayer.png', bbox_inches='tight')
Loading

0 comments on commit 3086b0f

Please sign in to comment.