Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revised content in the "Introduction to PyNEST" #661

Merged
merged 15 commits into from Mar 13, 2017

Conversation

@steffengraber
Copy link
Collaborator

@steffengraber steffengraber commented Feb 14, 2017

Content update reflecting the status per October 2016.

I suggest @abigailm and @jougs as reviewers.

Copy link
Member

@Silmathoron Silmathoron left a comment

Hit @steffengraber,
in python_interface.png, could you replace "iaf_neuron" by "iaf_psc_alpha", since we're in the process of removing it?

@@ -79,9 +79,14 @@ populations and will also be returned by the function `Models()`.
ipop1 = nest.Create("inh_iaf_neuron", 30)
ipop2 = nest.Create("inh_iaf_neuron", 30)

Once you have set up your populations of neurons, the function `PrintNetwork()`
Copy link
Member

@Silmathoron Silmathoron Feb 15, 2017

Why remove the part about PrintNetwork?

Copy link
Contributor

@heplesser heplesser Feb 16, 2017

In this case, users might perceive the output of PrintNetwork() as confusing rather than helpful, since the two populations of 30 neurons each would show up as one range of 60 neurons. With subnet removal in NEST3, PrintNetwork() will become even less useful. So I think we might as well drop it here and rather add new suggestions when we revise documentation for NEST3.

Copy link
Contributor

@abigailm abigailm Feb 20, 2017

I agree with @heplesser


nest.Connect(pop1, pop2, syn_spec={"weight":20.0})

Alternatively, the neurans can be connected with the `one\_to\_one`. This
Copy link
Member

@Silmathoron Silmathoron Feb 15, 2017

neurons

requiring the specification of further parameters, such as in-degree or
connection probabilities, must be defined in a dictionary containing the key
`rule` and the key for parameters associated to the rule. Please see
<http://www.nest-simulator.org/connection_management/> for an illustrated
Copy link
Member

@Silmathoron Silmathoron Feb 15, 2017

Since connection_management is referred to several times, maybe it would be a good idea to use [Connection management][cm] everywhere and set it as [cm]: connection_management.md "Connection management" at the end of the file...
This way if we want to change it at some point it will be easier...

same population simultaneously in the role of `pre` and `post`.

For more information on connecting neurons, please read the documentation of
the `Connect` function and consult the guide at [Connection Management](connection-management.md).
Copy link
Member

@Silmathoron Silmathoron Feb 15, 2017

see above

@@ -230,30 +270,46 @@ These are the new functions we introduced for the examples in this handout.

### Getting information about NEST

`PrintNetwork(depth=1, subnet=None)`:
Copy link
Member

@Silmathoron Silmathoron Feb 15, 2017

Same question as before: I don't think PrintNetwork is deprecated, only subnet

Copy link
Contributor

@abigailm abigailm Feb 20, 2017

but not especially useful anymore, so I would rather remove it.

- `GetKernelStatus(keys=none)`:

Obtain parameters of the simulation kernel.
Returns:
Copy link
Member

@Silmathoron Silmathoron Feb 15, 2017

This does not bring more information compared to nest.GetKernelStatus in ipython... I think example code for each case would be more suited here.

Copy link
Contributor

@heplesser heplesser Feb 16, 2017

Maybe a compact table/list of methods would be useful, leaving all details to the docstrings.


Parameters:

`source` - list of source GIDs
Copy link
Member

@Silmathoron Silmathoron Feb 15, 2017

this is not easily readable (no linebreak). I don't know if it's supposed to be formatted at some point, but otherwise could you add double spaces at the end of each lines to force linebreak?

or, if available, a NumPy array with the following five entries:
source-gid, target-gid, target-thread, synapse-id, port

Note: Only connections with targets on the MPI process executing the
Copy link
Member

@Silmathoron Silmathoron Feb 15, 2017

let's make Note: bold ^^

changed "neurans" to "neurons"  (line 143)
introducing [Connection management][cm]
a list for linebreaks (line 303)
make bold for highlighting (line 318)
@steffengraber
Copy link
Collaborator Author

@steffengraber steffengraber commented Feb 16, 2017

@Silmathoron Thank your for reviewing.
The small changes are done.

Regarding your questions and comments about 'PrintNetwork' and 'nest.GetKernelStatus' @abigailm is better suited to give the right answer.

Copy link
Contributor

@abigailm abigailm left a comment

many minor changes but otherwise good. Also, can you please turn the syntax highlighting back on?

@@ -17,26 +17,38 @@ discusses in this primer, please visit [nest-initiative.org/](http://nest-initia
or have a look at the source directory of your NEST installation in the
Copy link
Contributor

@abigailm abigailm Feb 20, 2017

For more information on the usage of PyNEST, please see the other sections of this primer [links to other sections]. More advanced examples can be found at [link to example listing], or have a look at...

@@ -17,26 +17,38 @@ discusses in this primer, please visit [nest-initiative.org/](http://nest-initia
or have a look at the source directory of your NEST installation in the
subdirectory:
`pynest/examples/`. For the internals of the NEST simulator you may refer
to the [publications](publications.md).
to the [\[1\]](#1),[\[2\]](#2).
Copy link
Contributor

@abigailm abigailm Feb 20, 2017

I would remove this last sentence altogether, given this primer is now online with all the other documentation

in$$ C++$$ to obtain highest possible performance for the simulation.
with an interface to Python [\[5\]](#5). [Fig. 1](#figure-1) illustrates the
interaction between the user’s simulation script (`mysimulation.py`) and the
NEST simulator. [\[2]\](#2) contains a technically detailed description of the
Copy link
Contributor

@abigailm abigailm Feb 20, 2017

The citation is mangled in my view - I see [2].

Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

I guess @abigailm meant [[2]], because the correct code is [\[2\]](#2) and not [\[2]\](#2)

Copy link
Contributor

@abigailm abigailm Feb 20, 2017

I will try again. For me it displays, literally, as: [[2]](#2) with no link

Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

Yes, that's what I meant, it's just that your previous message was disturbing because GitHub automatically converted it to a link with only one bracket showing

called \*id\*s. Many PyNEST functions expect or return a list of ids (see ).
Thus it is easy to apply functions to large sets of nodes with a single function
call.
called \*id\*s. Many PyNEST functions expect or return a list of ids (see
Copy link
Contributor

@abigailm abigailm Feb 20, 2017

bold of ids is not working for me. Maybe italics would be better anyway, for consistency.

Thus it is easy to apply functions to large sets of nodes with a single function
call.
called \*id\*s. Many PyNEST functions expect or return a list of ids (see
[Sec.8](#command-overview)). Thus it is easy to apply functions to large sets
Copy link
Contributor

@abigailm abigailm Feb 20, 2017

Sec. 8 is unhelpful as the sections are un-numbered. Name would be better.

@@ -293,20 +295,25 @@ These are the new functions we introduced for the examples in this handout.

Copy link
Contributor

@abigailm abigailm Feb 20, 2017

there is a 'See Part 2' above, which should be a link

source-gid, target-gid, target-thread, synapse-id, port
Note: Only connections with targets on the MPI process executing the command are
returned.
- `GetConnections(neuron, synapse_model="None"))`
Copy link
Contributor

@abigailm abigailm Feb 20, 2017

should be a link

@@ -290,7 +334,8 @@ listed in NTUM Section 4.1, are:

## References

\[1\] Hans Ekkehard Plesser and Håkon Enger NEST Topology User Manual
\[1\]<a id="1"></a> Hans Ekkehard Plesser and Håkon Enger NEST Topology User
Manual

Copy link
Contributor

@abigailm abigailm Feb 20, 2017

reference seems slightly mangled, should contain link

@@ -290,7 +334,8 @@ listed in NTUM Section 4.1, are:

Copy link
Contributor

@abigailm abigailm Feb 20, 2017

function names should be links

@@ -290,7 +334,8 @@ listed in NTUM Section 4.1, are:

## References

\[1\] Hans Ekkehard Plesser and Håkon Enger NEST Topology User Manual
\[1\]<a id="1"></a> Hans Ekkehard Plesser and Håkon Enger NEST Topology User
Manual

## Acknowledgments

Copy link
Contributor

@abigailm abigailm Feb 20, 2017

remove this section please

Copy link
Member

@Silmathoron Silmathoron left a comment

After 2nd reading.
Regarding @abigailm comment on syntax highlighting, I think this is processed automatically in html, so using ```python ``` would only make a difference on GitHub.

returns a list of the ids of all the created neurons, in this case only one,
which we store in a variable called `neuron`.
After having imported NEST and also the Pylab interface to Matplotlib [\[3\]]
(#3), which we will use to display the results, we can start to create nodes.
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

"we can start creating nodes"

which we store in a variable called `neuron`.
After having imported NEST and also the Pylab interface to Matplotlib [\[3\]]
(#3), which we will use to display the results, we can start to create nodes.
For a first example, we will create a neuron of type `iaf_psc_alpha`. This
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

"As a first"


import pylab
import nest
neuron = nest.Create("iaf_psc_alpha")

We can now use the id to access the properties of this neuron. Properties of
nodes in NEST are generally accessed via Python dictionaries of key-value pairs
of the form $$$texttt{{key : value}}$$$. In order to see which properties a
of the form `{key : value}`. In order to see which properties a
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

{key: value} (let's abide by pep8 ^^)

@@ -120,7 +132,7 @@ dimension of the outer tuple is the length of the node list, and the dimension
of the inner tuples is the number of keys specified.

To modify the properties in the dictionary, we use `SetStatus`. In the following
example, the background current is set to $$$376.0pA$$$, a value causing the
example, the background current is set to 376.0pA, a value causing the
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

why not keep the inline latex? $376.0 pA$

The slicing with strides is done in line 23-24 and 26-28. Additional
information can be found
at. <http://docs.scipy.org/doc/numpy-1.10.0/reference/arrays.indexing.html>
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

additional dot after "at ."


If no connectivity pattern is specified, the populations are connected via
the default rule, namely `all\_to\_all`. Each neuron of `pop1` is connected
to every neuron in `pop2`, resulting in $10^2$ connections.
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

@abigailm: do you mean on GitHub or when you generate the html? GitHub does not use mathjax...

the value of `origin` (default: $$0$$). For example, the following example
creates a `poisson_generator` which is only active between $$100$$ and $$150 
ms$$:
(default $0$) determines the beginning of the device’s activity and the
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

same question as before (html or github?); also it should be "device ' s"

## Distributing synapse parameters

The synapse parameters are specified in the synapse dictionary which is
passed to the Connect-function. If the parameter is set to a scalar all
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

"to the Connect-function. If the parameter is set to a scalar , all"

an example where the parameters `alpha` and `weight` of the stdp synapse are
uniformly distributed.

syn_dict = {"model": "stdp_synapse",
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

make a working example (correct alpha values: these are random):

alpha_min = 0.1
alpha_max = 2.
w_min = 0.5 
w_max = 5.

syn_dict = {"model": "stdp_synapse", 
            "alpha": {"distribution": "uniform", "low": alpha_min, "high": alpha_max},
            "weight": {"distribution": "uniform", "low": w_min, "high": w_max},
            "delay": 1.0}

connections will be drawn using the same parameter. Parameters can be
randomly distributed by assigning a dictionary to the parameter. The
dictionary has to contain the key `distribution` setting the target
distribution of the parameters (for example `normal`). Optionally parameters
Copy link
Member

@Silmathoron Silmathoron Feb 20, 2017

optionally ,

@jougs
Copy link
Contributor

@jougs jougs commented Feb 21, 2017

I'm removing myself from the list of reviewers as this is documentation only and there are already three reviewers without me.

@jougs jougs removed their request for review Feb 21, 2017
correcting text, linking all parts together, linking  function names
@steffengraber
Copy link
Collaborator Author

@steffengraber steffengraber commented Feb 22, 2017

Thank you @abigailm and @Silmathoron for reviewing.

I did all the minor changes that were mentioned in the last comments.

For easier reading and writing of markdown we decided for indented code blocks. They do not support syntax highlighting on Github.

Inline-Mathjax is used as least as possible, also for better reading and writing.

Copy link
Member

@Silmathoron Silmathoron left a comment

Ok, this looks almost good, a few details left to correct and it should be great ;)

For more information on the usage of PyNEST, please see the other sections of
this primer:

- [Part 1: Neurons and simple neural networkss](part-1-neurons-and-simple-neural-networks.md)
Copy link
Member

@Silmathoron Silmathoron Mar 8, 2017

"networks" (one "s")

@@ -335,9 +351,4 @@ listed in NTUM Section 4.1, are:
## References

\[1\]<a id="1"></a> Hans Ekkehard Plesser and Håkon Enger NEST Topology User
Manual

## Acknowledgments
Copy link
Member

@Silmathoron Silmathoron Mar 8, 2017

I don't know who Sarah Jarvis is, but I don't think keeping this acknowledgement costs much, does it?
Maybe you can add a "revised by" and the date at the end...

Copy link
Contributor

@abigailm abigailm Mar 10, 2017

No, I removed this on purpose. Many people have contributed to this documentation now (although it's still mostly me ;) ), there is no particular reason to single out Sarah.

Copy link
Contributor

@heplesser heplesser Mar 11, 2017

I concur with @abigailm.

"alpha": {"distribution": "uniform", "low": Min_alpha, "high": Max_alpha},
"weight": {"distribution": "uniform", "low": Wmin, "high": Wmax},
"delay": 1.0 }
"alpha": {"distribution": "uniform", "low": alpha_min, "high": alpha_max},
Copy link
Member

@Silmathoron Silmathoron Mar 8, 2017

define alpha_min & co. so that the examples work if you copy-paste them

For more information on the usage of PyNEST, please see the other sections of
this primer:

- [Part 1: Neurons and simple neural networkss](part-1-neurons-and-simple-neural-networks.md)
Copy link
Member

@Silmathoron Silmathoron Mar 8, 2017

only one "s" to "networks"

For more information on the usage of PyNEST, please see the other sections of
this primer:

- [Part 1: Neurons and simple neural networkss](part-1-neurons-and-simple-neural-networks.md)
Copy link
Member

@Silmathoron Silmathoron Mar 8, 2017

one "s"

@abigailm abigailm self-assigned this Mar 10, 2017
@abigailm abigailm removed their assignment Mar 10, 2017
@abigailm
Copy link
Contributor

@abigailm abigailm commented Mar 10, 2017

I agree with @Silmathoron 's suggestions except for the acknowledgment, so a conditional 👍

@steffengraber
Copy link
Collaborator Author

@steffengraber steffengraber commented Mar 13, 2017

Thank you again for reviewing.
I made all the changes.

Copy link
Member

@Silmathoron Silmathoron left a comment

All good, thanks! 👍

@abigailm
Copy link
Contributor

@abigailm abigailm commented Mar 13, 2017

approving 👍 and merging

@abigailm abigailm merged commit 4ea4b4c into nest:master Mar 13, 2017
1 check passed
@steffengraber steffengraber deleted the doc-pynest branch Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants