{"action":"created","issue":{"url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/1081","repository_url":"https://api.github.com/repos/MDAnalysis/mdanalysis","labels_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/1081/labels{/name}","comments_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/1081/comments","events_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/1081/events","html_url":"https://github.com/MDAnalysis/mdanalysis/issues/1081","id":190666674,"number":1081,"title":"Support sliced iteration for all Readers","user":{"login":"kain88-de","id":4302678,"avatar_url":"https://avatars.githubusercontent.com/u/4302678?v=3","gravatar_id":"","url":"https://api.github.com/users/kain88-de","html_url":"https://github.com/kain88-de","followers_url":"https://api.github.com/users/kain88-de/followers","following_url":"https://api.github.com/users/kain88-de/following{/other_user}","gists_url":"https://api.github.com/users/kain88-de/gists{/gist_id}","starred_url":"https://api.github.com/users/kain88-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kain88-de/subscriptions","organizations_url":"https://api.github.com/users/kain88-de/orgs","repos_url":"https://api.github.com/users/kain88-de/repos","events_url":"https://api.github.com/users/kain88-de/events{/privacy}","received_events_url":"https://api.github.com/users/kain88-de/received_events","type":"User","site_admin":false},"labels":[{"id":221183363,"url":"https://api.github.com/repos/MDAnalysis/mdanalysis/labels/Component-Readers","name":"Component-Readers","color":"0052cc","default":false},{"id":195620655,"url":"https://api.github.com/repos/MDAnalysis/mdanalysis/labels/usability","name":"usability","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-21T09:52:38Z","updated_at":"2016-11-22T22:35:56Z","closed_at":null,"body":"### Expected behaviour\r\n\r\n`for ts in u.trajectory[start:stop:step]` should always work.\r\n\r\n### Actual behaviour\r\n\r\nThis only works for readers that implement random access\r\n\r\n### Solution\r\n\r\nI know that this is only efficiently to implement for a random access reader. But we should still be able to iterate through the trajectory with a sliced iterator, it's just that we need to pay the iteration cost for the full trajectory. There is nothing stopping us from yielding only the requested frames.  To notify the user that his action are slow because of the trajectory format we can just print a warning telling him that computations can be speed up by switching to a random access reader.\r\n\r\nI'm stumbling on this right now because we are writing a library on top of MDAnalysis at work which plans to use sliced iterators. We don't support this for all readers though so I'm left with writing MDAnalysis wrapper to support sliced iteration for all trajectory types."},"comment":{"url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/comments/262386693","html_url":"https://github.com/MDAnalysis/mdanalysis/issues/1081#issuecomment-262386693","issue_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/1081","id":262386693,"user":{"login":"kain88-de","id":4302678,"avatar_url":"https://avatars.githubusercontent.com/u/4302678?v=3","gravatar_id":"","url":"https://api.github.com/users/kain88-de","html_url":"https://github.com/kain88-de","followers_url":"https://api.github.com/users/kain88-de/followers","following_url":"https://api.github.com/users/kain88-de/following{/other_user}","gists_url":"https://api.github.com/users/kain88-de/gists{/gist_id}","starred_url":"https://api.github.com/users/kain88-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kain88-de/subscriptions","organizations_url":"https://api.github.com/users/kain88-de/orgs","repos_url":"https://api.github.com/users/kain88-de/repos","events_url":"https://api.github.com/users/kain88-de/events{/privacy}","received_events_url":"https://api.github.com/users/kain88-de/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T22:35:56Z","updated_at":"2016-11-22T22:35:56Z","body":"yeah we would rewind (cheap) and then forward to frame. It is a bit costly but would increase usability. I would then also add a warning that slices will be slow with that trajectory and suggest conversion to a random access format."}}
{"actor":{"display_login":"kain88-de"}}