{"action":"created","issue":{"url":"https://api.github.com/repos/nengo/nengo/issues/681","labels_url":"https://api.github.com/repos/nengo/nengo/issues/681/labels{/name}","comments_url":"https://api.github.com/repos/nengo/nengo/issues/681/comments","events_url":"https://api.github.com/repos/nengo/nengo/issues/681/events","html_url":"https://github.com/nengo/nengo/pull/681","id":60555026,"number":681,"title":"Simplified signal logic","user":{"login":"drasmuss","id":1952220,"avatar_url":"https://avatars.githubusercontent.com/u/1952220?v=3","gravatar_id":"","url":"https://api.github.com/users/drasmuss","html_url":"https://github.com/drasmuss","followers_url":"https://api.github.com/users/drasmuss/followers","following_url":"https://api.github.com/users/drasmuss/following{/other_user}","gists_url":"https://api.github.com/users/drasmuss/gists{/gist_id}","starred_url":"https://api.github.com/users/drasmuss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drasmuss/subscriptions","organizations_url":"https://api.github.com/users/drasmuss/orgs","repos_url":"https://api.github.com/users/drasmuss/repos","events_url":"https://api.github.com/users/drasmuss/events{/privacy}","received_events_url":"https://api.github.com/users/drasmuss/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-10T19:27:24Z","updated_at":"2015-03-10T20:34:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nengo/nengo/pulls/681","html_url":"https://github.com/nengo/nengo/pull/681","diff_url":"https://github.com/nengo/nengo/pull/681.diff","patch_url":"https://github.com/nengo/nengo/pull/681.patch"},"body":"I was looking into implementing advanced indexing for probing, which prompted me to dig through the Signal code a bit.  And it struck me that we were basically doing a lot of work there in order to manually recreate numpy's indexing/slicing.  So what this PR does is strip all that out, and put the load back on numpy.  It's functionally equivalent (unless I've screwed up somewhere), but hopefully the additions/deletions ratio is convincing that it's a lot simpler.\r\n\r\nThis also made it easy to implement advanced indexing for signals (I separated that into its own commit).  So now you can do neat things like\r\n```python\r\na = nengo.Ensemble(10, 1, encoders=np.random.choice([1, -1], size=(10, 1)))\r\nindices = (a.encoders == 1).squeeze()\r\np = nengo.Probe(a.neurons[indices], \"voltage\")\r\n```\r\n\r\nSince this touches the core of the simulator, we should be really sure that it doesn't break anything.  It passes all the unit tests, and I ran a few of my models on it, but if anyone else has some other complicated models they could test with, that'd be great.\r\n\r\nAlso, I'm not sure if NengoOCL was depending on something specific in SignalView that this will cause to break?  I think it really is basically equivalent, so hopefully not, but perhaps @hunse can comment."},"comment":{"url":"https://api.github.com/repos/nengo/nengo/issues/comments/78142142","html_url":"https://github.com/nengo/nengo/pull/681#issuecomment-78142142","issue_url":"https://api.github.com/repos/nengo/nengo/issues/681","id":78142142,"user":{"login":"tbekolay","id":203709,"avatar_url":"https://avatars.githubusercontent.com/u/203709?v=3","gravatar_id":"","url":"https://api.github.com/users/tbekolay","html_url":"https://github.com/tbekolay","followers_url":"https://api.github.com/users/tbekolay/followers","following_url":"https://api.github.com/users/tbekolay/following{/other_user}","gists_url":"https://api.github.com/users/tbekolay/gists{/gist_id}","starred_url":"https://api.github.com/users/tbekolay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbekolay/subscriptions","organizations_url":"https://api.github.com/users/tbekolay/orgs","repos_url":"https://api.github.com/users/tbekolay/repos","events_url":"https://api.github.com/users/tbekolay/events{/privacy}","received_events_url":"https://api.github.com/users/tbekolay/received_events","type":"User","site_admin":false},"created_at":"2015-03-10T20:34:09Z","updated_at":"2015-03-10T20:34:09Z","body":"I have a perhaps naive question about advanced indexing. Is it ever the case that something with advanced indexing could instead be done with multiple calls with simple indexing or slicing?\r\n\r\nMy impression is that the main use cases are to 1) send a single dimension's value to multiple dimensions in the post and to 2) probe irregularly spaced dimensions. But both of these can be done with multiple calls.\r\n\r\nUse case 1:\r\n\r\n```python\r\npre = nengo.Ensemble(10, 1)\r\npost = nengo.Ensemble(20, 2)\r\n# Advanced indexing\r\nnengo.Connection(pre[[0, 0]], post)\r\n# Simple indexing\r\nnengo.Connection(pre, post[0])\r\nnengo.Connection(pre, post[1])\r\n```\r\n\r\nUse case 2:\r\n\r\n```python\r\n# Advanced indexing\r\nnengo.Probe(ten_d_ensemble[[3, 6, 7]])\r\n# Simple indexing\r\nnengo.Probe(ten_d_ensemble[3])\r\nnengo.Probe(ten_d_ensemble[6:8])\r\n```\r\n\r\nIs this correct or am I missing use cases? If no, I might be inclined to just not do advanced indexing if it means we get speedups and/or it makes backend code simpler."}}