{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/5233","repository_url":"https://api.github.com/repos/astropy/astropy","labels_url":"https://api.github.com/repos/astropy/astropy/issues/5233/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/5233/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/5233/events","html_url":"https://github.com/astropy/astropy/issues/5233","id":170643527,"number":5233,"title":"indexing of astropy coordinate object is 25 times slower than indexing the cartesian representation","user":{"login":"dsavransky","id":4950841,"avatar_url":"https://avatars.githubusercontent.com/u/4950841?v=3","gravatar_id":"","url":"https://api.github.com/users/dsavransky","html_url":"https://github.com/dsavransky","followers_url":"https://api.github.com/users/dsavransky/followers","following_url":"https://api.github.com/users/dsavransky/following{/other_user}","gists_url":"https://api.github.com/users/dsavransky/gists{/gist_id}","starred_url":"https://api.github.com/users/dsavransky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsavransky/subscriptions","organizations_url":"https://api.github.com/users/dsavransky/orgs","repos_url":"https://api.github.com/users/dsavransky/repos","events_url":"https://api.github.com/users/dsavransky/events{/privacy}","received_events_url":"https://api.github.com/users/dsavransky/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/astropy/astropy/labels/Affects-release","name":"Affects-release","color":"0052cc"},{"url":"https://api.github.com/repos/astropy/astropy/labels/coordinates","name":"coordinates","color":"c7def8"},{"url":"https://api.github.com/repos/astropy/astropy/labels/Performance","name":"Performance","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-08-11T13:18:10Z","updated_at":"2016-08-11T14:08:19Z","closed_at":null,"body":"Basic issue:  I have skycoord objects containing arrays of coordinates and need to extract the Cartesian coordinates for a subset of these objects.  It turns out that indexing the skycoord object and then converting to Cartesian coordinates takes at least 25 times longer than converting the entire array of coordinates to Cartesian representation and then indexing.\r\n\r\nSample code to reproduce:\r\n\r\n    from astropy.coordinates import SkyCoord\r\n    from astropy import units as u\r\n    import numpy as np\r\n\r\n    c = SkyCoord(ra=np.random.uniform(size=100)*u.rad, dec=np.random.uniform(size=100)*u.rad,distance=np.random.uniform(size=100)*u.pc)\r\n\r\n    ind = 50\r\n\r\n    %timeit res = c[ind].cartesian.xyz\r\n    %timeit res = c.cartesian[ind].xyz\r\n    %timeit res = c.cartesian.xyz[:,ind]\r\n\r\nOn Mac OS 10.10.5, python 2.7.12, ipython 5.0.0, astropy v1.2, results are:\r\n\r\n100 loops, best of 3: 14.9 ms per loop\r\n1000 loops, best of 3: 636 µs per loop\r\n1000 loops, best of 3: 566 µs per loop"},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/239171503","html_url":"https://github.com/astropy/astropy/issues/5233#issuecomment-239171503","issue_url":"https://api.github.com/repos/astropy/astropy/issues/5233","id":239171503,"user":{"login":"pllim","id":2090236,"avatar_url":"https://avatars.githubusercontent.com/u/2090236?v=3","gravatar_id":"","url":"https://api.github.com/users/pllim","html_url":"https://github.com/pllim","followers_url":"https://api.github.com/users/pllim/followers","following_url":"https://api.github.com/users/pllim/following{/other_user}","gists_url":"https://api.github.com/users/pllim/gists{/gist_id}","starred_url":"https://api.github.com/users/pllim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pllim/subscriptions","organizations_url":"https://api.github.com/users/pllim/orgs","repos_url":"https://api.github.com/users/pllim/repos","events_url":"https://api.github.com/users/pllim/events{/privacy}","received_events_url":"https://api.github.com/users/pllim/received_events","type":"User","site_admin":false},"created_at":"2016-08-11T14:08:19Z","updated_at":"2016-08-11T14:08:19Z","body":"I think the info above should be able to get `coordinates` maintainers started on a solution, if possible."}}
{"actor":{"display_login":"pllim"}}