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

Use shape as argument instead of columns/rows/depth and update topology examples to NEST3 #1287

Merged
merged 9 commits into from
Sep 16, 2019

Conversation

jhnnsnk
Copy link
Contributor

@jhnnsnk jhnnsnk commented Sep 12, 2019

This PR replaces the arguments columns/rows/depth used previously for creating grid layers with a single array named shape. shape can be of length 2 or 3 for 2D or 3D layers, respectively. The grid mask and its anchor are also adapted.

Topology examples are now updated to NEST3 and moved to pynest/examples/spatial.

@stinebuu stinebuu added this to the NEST 3.0 milestone Sep 12, 2019
Copy link
Contributor

@stinebuu stinebuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks so much better! I just have a tiny comment, but otherwise I definitely approve.

# generate list of 12 (x,y) pairs
pos = [[random.uniform(-0.75, 0.75), random.uniform(-0.5, 0.5)]
for j in range(12)]
pos = nest.spatial.free([[random.uniform(-0.75, 0.75), random.uniform(-0.5, 0.5)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use nest.random.uniform here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numpy.random.uniform?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Silmathoron with the new NEST-3 we have made random distributions from NEST accessible from PyNEST, and seeing as this is an example I think we should use the NEST version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that we want different distributions for different dimensions, which currently can't be done when passing nest.random functions to nest.spatial.free(). But it shouldn't be difficult to add this, maybe after this PR is merged, then we can update this example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yesterday, I asked @hakonsbm about this and he recommended to use numpy.random.uniform in this case because with nest.random.uniform it is apparently not possible, yet, to define different min and max for the two dimensions. If there is a better solution, please let me know and I will adjust it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, passing a nest.random function to nest.spatial.free() will currently use the same distribution in all dimensions. But it shouldn't be difficult to add the possibility to have different distributions for different dimensions. Maybe after this PR is merged, then we can update this example?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhnnsnk @hakonsbm Ah, I missed that. I think we should be able to have different distributions for different dimensions, but I agree that we can do it after this PR is merged. I will add a note on the project page, and merge this PR into the NEST-3 branch.

@stinebuu stinebuu added ZC: PyNEST DO NOT USE THIS LABEL I: User Interface Users may need to change their code due to changes in function calls ZP: PR Created DO NOT USE THIS LABEL S: Normal Handle this with default priority T: Enhancement New functionality, model or documentation labels Sep 13, 2019
# generate list of 12 (x,y) pairs
pos = [[random.uniform(-0.75, 0.75), random.uniform(-0.5, 0.5)]
for j in range(12)]
pos = nest.spatial.free([[random.uniform(-0.75, 0.75), random.uniform(-0.5, 0.5)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that we want different distributions for different dimensions, which currently can't be done when passing nest.random functions to nest.spatial.free(). But it shouldn't be difficult to add this, maybe after this PR is merged, then we can update this example.

@stinebuu stinebuu merged commit 25c1e7f into nest:nest-3 Sep 16, 2019
@jhnnsnk jhnnsnk deleted the nest-3_new_shape branch September 20, 2019 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: User Interface Users may need to change their code due to changes in function calls S: Normal Handle this with default priority T: Enhancement New functionality, model or documentation ZC: PyNEST DO NOT USE THIS LABEL ZP: PR Created DO NOT USE THIS LABEL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants