{"id":17949641,"url":"https://github.com/nsarrazin/astropynamics","last_synced_at":"2025-09-02T08:30:39.703Z","repository":{"id":68192953,"uuid":"105313038","full_name":"nsarrazin/AstroPynamics","owner":"nsarrazin","description":"A pure Python library to solve common orbital mechanics problem","archived":false,"fork":false,"pushed_at":"2017-10-01T18:32:43.000Z","size":19,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-17T07:51:53.131Z","etag":null,"topics":["numpy","orbital-mechanics","plotly","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nsarrazin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-29T20:12:58.000Z","updated_at":"2024-08-28T19:42:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"1465c045-d306-48e6-8443-41a8ed89ef00","html_url":"https://github.com/nsarrazin/AstroPynamics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsarrazin%2FAstroPynamics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsarrazin%2FAstroPynamics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsarrazin%2FAstroPynamics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsarrazin%2FAstroPynamics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nsarrazin","download_url":"https://codeload.github.com/nsarrazin/AstroPynamics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231763947,"owners_count":18423110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["numpy","orbital-mechanics","plotly","python3"],"created_at":"2024-10-29T09:30:04.346Z","updated_at":"2024-12-29T17:24:18.467Z","avatar_url":"https://github.com/nsarrazin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AstroPynamics\nA pure Python library to solve common orbital mechanics problem\n\n## Orbit definition\n### Basic class methods\nThe Orbit class includes a few class methods which allows for fast and easy Orbit generation.\nRegardless of the input elements all orbits requires the following inputs :\n* primBody  = a Body object used to determine the gravitational parameter\n* name      = Every orbit created needs a name\n#### fromElements\nThis uses the basic set of keplerian elements :\n* Semi-major Axis (a)\n* Eccentricity (e)\n* Inclination (i)\n* Longitude of the ascending node (lAn)\n* Argument of Periapsis (aPe)\n* True Anomaly (tAn)\n```python\nfrom orbits.orbit import Orbit\nfrom examples import Sun\nimport numpy as np\nearthOrbit = Orbit.fromElements(a=149597887.1558, e=0.01671022, i = np.radians(0.00005), lAn = np.radians(348.7394), primBody=Sun, aPe=np.radians(114.2078), tAn=6.23837308813, name=\"Earth Orbit\")\n\nprint(earthOrbit)\n```\nWhich prints :\n```\n    ID       - Earth Orbit\n    primBody - Sun\n\n    a    - 149597887.1558\n    e    - 0.01671022\n    i    - 8.726646259971648e-07\n    lAn  - 6.086650761429513\n    aPe  - 1.99330214145918\n    tAn  - 6.23837308813\n\n    epoch - 2000-01-01 00:00:00.000\n````\n#### fromApsis\nfromApsis replaces the semimajor axis and the eccentricity by the height of the Apoapsis (hPa) and Periapsis (hPe)\n```python\nmarsOrbit = Orbit.fromApsis(hPa = 247644270.465, hPe=220120745.788,  i = np.radians(1.85061), lAn = np.radians(49.57854), primBody=Sun, aPe=np.radians(286.4623), tAn=0.40848952017, name=\"Mars Orbit\")\n\nprint(marsOrbit)\n```\nWhich prints :\n```\n    ID       - Mars Orbit\n    primBody - Sun\n\n    a    - 233882508.1265\n    e    - 0.05884049409567938\n    i    - 0.03229923767033226\n    lAn  - 0.8653087613317094\n    aPe  - 4.999710317835753\n    tAn  - 0.40848952017\n\n    epoch - 2000-01-01 00:00:00.000\n```\n#### fromStateVector\nThis replaces the set of keplerian elements by a position 3D vector and a velocity 3D vector\n```python\nfrom examples import Earth\n\ntestOrbit = Orbit.fromStateVector((-6045, -3490, 2500), (-3.457, 6.618, 2.533), primBody=Earth, name = \"State Vector Demo\")\n\nprint(testOrbit)\n```\nWhich prints :\n```\n    ID       - State Vector Demo\n    primBody - Earth\n\n    a    - 8788.081767279667\n    e    - 0.17121118195416898\n    i    - 2.6747036137846094\n    lAn  - 4.455464041223287\n    aPe  - 0.35025511728002945\n    tAn  - 0.496472955354359\n\n    epoch - 2000-01-01 00:00:00.000\n```\n### Universal multi-rev Lambert solver\nOrbits can also be generated using a multi revolution universal Lambert solver. It uses the following inputs:\n\n* r1 - 3D position vector\n* r2 - 3D position vector\n* tof - Time of flight between r1 and r2 in seconds\n\nAnd the following are optional :\n\n* nRev - The number of full revolution completed (default is 0)\n* DM - The direction of motion, if left empty the solver will determine the optimal one\n\n```python\nlambertDemo = Orbit.fromLambert((5000,10000,2100), (-14600,2500,7000), 3600, primBody=Earth, name=\"Lambert Demo\")\nprint(lambertDemo)\n```\nWhich will output :\n```\nID       - Lambert Demo\nprimBody - Earth\n\na    - 20002.884935993607\ne    - 0.4334874513211504\ni    - 0.5269331332631371\nlAn  - 0.7784202841672524\naPe  - 0.535923312928038\ntAn  - 6.123135458171056\n\nepoch - 2000-01-01 00:00:00.000\n```\nThe universal solver also supports hyperbolic trajectory :\n```python\nfrom orbits.hyperbola import Hyperbola\nlambertDemo = Hyperbola.fromLambert((5000,10000,2100), (-14600,2500,7000), 1500, primBody=Earth, name=\"Lambert Hyperbola\")\nprint(\"SMA - {}, eccentricity - {}\".format(lambertDemo.a, lambertDemo.e))\n```\nWill output :\n```\nSMA - -2918.7342956582274, eccentricity - 4.215326772456562\n```\nIt also supports multi-rev generation :\n![0-rev](https://i.imgur.com/LWYBQ2X.gif)\n![1-rev](https://i.imgur.com/ZXUqvlM.gif)\n![2-rev](https://i.imgur.com/lpLI3nQ.gif)\n## Plotting\n### plotlyManager\nTODO\n### Plotting body\nTODO\n### Plotting orbits\nTODO\n### Plotting points\nTODO\n### Animation\nTODO\n## Maneuvers\n\n## Trajectory optimization\n### getC3\n\n### Porkchop Generator\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsarrazin%2Fastropynamics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnsarrazin%2Fastropynamics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsarrazin%2Fastropynamics/lists"}