{"action":"created","issue":{"url":"https://api.github.com/repos/jobovy/galpy/issues/363","repository_url":"https://api.github.com/repos/jobovy/galpy","labels_url":"https://api.github.com/repos/jobovy/galpy/issues/363/labels{/name}","comments_url":"https://api.github.com/repos/jobovy/galpy/issues/363/comments","events_url":"https://api.github.com/repos/jobovy/galpy/issues/363/events","html_url":"https://github.com/jobovy/galpy/pull/363","id":385024789,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0MDkwNzg4","number":363,"title":"Add python and C implementation of dop853","user":{"login":"henrysky","id":28623434,"node_id":"MDQ6VXNlcjI4NjIzNDM0","avatar_url":"https://avatars1.githubusercontent.com/u/28623434?v=4","gravatar_id":"","url":"https://api.github.com/users/henrysky","html_url":"https://github.com/henrysky","followers_url":"https://api.github.com/users/henrysky/followers","following_url":"https://api.github.com/users/henrysky/following{/other_user}","gists_url":"https://api.github.com/users/henrysky/gists{/gist_id}","starred_url":"https://api.github.com/users/henrysky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrysky/subscriptions","organizations_url":"https://api.github.com/users/henrysky/orgs","repos_url":"https://api.github.com/users/henrysky/repos","events_url":"https://api.github.com/users/henrysky/events{/privacy}","received_events_url":"https://api.github.com/users/henrysky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-11-27T22:57:23Z","updated_at":"2018-12-15T05:00:20Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/jobovy/galpy/pulls/363","html_url":"https://github.com/jobovy/galpy/pull/363","diff_url":"https://github.com/jobovy/galpy/pull/363.diff","patch_url":"https://github.com/jobovy/galpy/pull/363.patch"},"body":"This PR adds python and C implementation of DOP853 integrator to galpy and test. DOP853 is an explicit Runge-Kutta method of order 8(5,3) by Dormand & Prince with dense output.\r\n\r\nHere is a simple testing I have done so far to see the performance and accuracy of `leapfrog` and `dop853` in galpy\r\n\r\n```\r\nfrom galpy.potential import MWPotential2014\r\nfrom galpy.orbit import Orbit\r\nimport numpy as np\r\nimport time\r\nfrom astropy import units as u\r\n\r\n# Orbit Integration using galpy for the Sun\r\nop = Orbit([0., 0., 0., 0., 0., 0.], radec=True, ro=8., vo=220.)\r\nts = np.linspace(0, 20, 10000) * u.Gyr\r\nstart_time = time.time()\r\nop.integrate(ts, MWPotential2014, method=\"method_here\")\r\nprint(time.time() - start_time, \"s\")\r\nE = op.E(ts)\r\nprint(\"Energy accurancy: \", np.std(E)/np.fabs(np.median(E)))\r\n```\r\n\r\nFor `leapfrog`:\r\n```\r\n27.408s\r\nEnergy accurancy: 4.894e-09\r\n```\r\n\r\nFor `dop853`:\r\n```\r\n8.446s\r\nEnergy accurancy: 1.361e-13\r\n```\r\n\r\nFor `dop853_c`:\r\n```\r\n0.082s\r\nEnergy accurancy: 1.177e-12\r\n```\r\n\r\nFor `dopr54_c`:\r\n```\r\n0.199s\r\nEnergy accurancy: 2.625e-10\r\n```\r\n\r\nFor `symplec4_c`:\r\n```\r\n0.220s\r\nEnergy accurancy: 4.528e-12\r\n```"},"comment":{"url":"https://api.github.com/repos/jobovy/galpy/issues/comments/447537804","html_url":"https://github.com/jobovy/galpy/pull/363#issuecomment-447537804","issue_url":"https://api.github.com/repos/jobovy/galpy/issues/363","id":447537804,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzUzNzgwNA==","user":{"login":"jobovy","id":1044876,"node_id":"MDQ6VXNlcjEwNDQ4NzY=","avatar_url":"https://avatars2.githubusercontent.com/u/1044876?v=4","gravatar_id":"","url":"https://api.github.com/users/jobovy","html_url":"https://github.com/jobovy","followers_url":"https://api.github.com/users/jobovy/followers","following_url":"https://api.github.com/users/jobovy/following{/other_user}","gists_url":"https://api.github.com/users/jobovy/gists{/gist_id}","starred_url":"https://api.github.com/users/jobovy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jobovy/subscriptions","organizations_url":"https://api.github.com/users/jobovy/orgs","repos_url":"https://api.github.com/users/jobovy/repos","events_url":"https://api.github.com/users/jobovy/events{/privacy}","received_events_url":"https://api.github.com/users/jobovy/received_events","type":"User","site_admin":false},"created_at":"2018-12-15T05:00:20Z","updated_at":"2018-12-15T05:00:20Z","author_association":"OWNER","body":"Started looking at this again and this all looks quite good to me now (I also did an explicit test of the Python DOP853 implementation with a differential equation with an analytical solution, which passed). But I did one more tests that gives somewhat odd results (although may be nothing...):\r\n```\r\nimport numpy\r\nfrom galpy.potential import MWPotential2014\r\nfrom galpy.orbit import Orbit\r\n%pylab inline\r\no= Orbit([1.3,-0.5,1.,0.])\r\nts= numpy.linspace(0.,300.,1001)\r\no.integrate(ts,[MWPotential2014],method='dop853')\r\nod= o()\r\nod.integrate(ts,[MWPotential2014],method='dop853_c')\r\nod.plotE()\r\no.plotE(overplot=True)\r\n```\r\ngives\r\n![dop853-test2](https://user-images.githubusercontent.com/1044876/50039199-df1e9e00-fffb-11e8-8980-b3a61248290a.png)\r\nApologies for the lack of labels, but the green line is the Python implementation of DOP853 and the blue line the C implementation: the Python version has a much more stable energy error. Do you understand why this is?\r\n\r\nFinally, could you add an entry in HISTORY.txt about this addition and add yourself in the ``Direct contributions to the code base:`` section of AUTHORS.txt about this as well?\r\n"}}
{"actor":{"display_login":"jobovy"}}