diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index cb216ee1c..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,104 +0,0 @@ -version: 2.1 - -jobs: - quality: &test-template - description: Code style - docker: - - image: python:3.8 - environment: - PIP_PREFER_BINARY: true - PIP_PROGRESS_BAR: "off" - TOXENV: style - steps: - - checkout - - run: python -m pip install tox - - run: tox - - tests38-fast: - <<: *test-template - description: Tests fast - Python 3.8 - environment: - TOXENV: tests38-fast - - tests38-online: - <<: *test-template - description: Tests online - Python 3.8 - environment: - TOXENV: tests38-online - - tests38-slow: - <<: *test-template - description: Tests slow - Python 3.8 - environment: - TOXENV: tests38-slow - - tests38-images: - <<: *test-template - description: Tests images - Python 3.8 - environment: - TOXENV: tests38-images - - tests38-coverage: - <<: *test-template - description: Tests coverage - Python 3.8 - environment: - TOXENV: tests38-coverage - steps: - - checkout - - run: python -m pip install tox - - run: tox - - run: python -m pip install codecov && codecov - - tests39: - <<: *test-template - description: Tests - Python 3.9 - docker: - - image: python:3.9 - environment: - TOXENV: tests39 - - tests310: - <<: *test-template - description: Tests - Python 3.10 - docker: - - image: python:3.10 - environment: - TOXENV: tests310 - - tests311: - <<: *test-template - description: Tests - Python 3.11 - docker: - - image: python:3.11 - environment: - TOXENV: tests311 - -workflows: - version: 2 - build_and_test: - jobs: - - quality - - tests38-fast: - requires: - - quality - - tests38-online: - requires: - - quality - - tests38-slow: - requires: - - quality - - tests38-images: - requires: - - quality - - tests38-coverage: - requires: - - quality - - tests39: - requires: - - quality - - tests310: - requires: - - quality - - tests311: - requires: - - quality diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 6bae7e024..000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,4 +0,0 @@ -# These are supported funding model platforms - -open_collective: poliastro -github: [numfocus, astrojuanlu] diff --git a/.github/ISSUE_TEMPLATE/new_release.md b/.github/ISSUE_TEMPLATE/new_release.md index 6efb97d3c..c63d2487a 100644 --- a/.github/ISSUE_TEMPLATE/new_release.md +++ b/.github/ISSUE_TEMPLATE/new_release.md @@ -11,9 +11,9 @@ assignees: astrojuanlu * [ ] Rerun all notebooks (pay special attention to new features) * [ ] Review documentation, optionally improving the user guide or adding new notebooks showcasing new functionality * [ ] Write the changelog and list of contributors - - Commits since last release branch https://github.com/poliastro/poliastro/compare/X.Y.Z...main - - Issues closed in this milestone https://github.com/poliastro/poliastro/milestone/N?closed=1 (note that there might be issues without milestone!) - - Pull requests merged since last branching https://github.com/poliastro/poliastro/pulls?q=is%3Apr+is%3Amerged+merged%3A%3E%3D2019-02-09+sort%3Aupdated-asc + - Commits since last release branch https://github.com/hapsira/hapsira/compare/X.Y.Z...main + - Issues closed in this milestone https://github.com/hapsira/hapsira/milestone/N?closed=1 (note that there might be issues without milestone!) + - Pull requests merged since last branching https://github.com/hapsira/hapsira/pulls?q=is%3Apr+is%3Amerged+merged%3A%3E%3D2019-02-09+sort%3Aupdated-asc - List of contributors: `git shortlog --summary --email ${BRANCHING_COMMIT}..` ## Before the beta release @@ -57,6 +57,6 @@ assignees: astrojuanlu * [ ] Check Read the Docs * [ ] Create GitHub release * [ ] Add Zenodo badge to GitHub release -* [ ] Send announcement email with subject "ANN: poliastro X.Y.Z released 🚀" +* [ ] Send announcement email with subject "ANN: hapsira X.Y.Z released 🚀" * [ ] Cherry pick release date to main * [ ] Close milestone diff --git a/.github/no-response.yml b/.github/no-response.yml index c873ad7c9..a9d5ad7a0 100644 --- a/.github/no-response.yml +++ b/.github/no-response.yml @@ -10,5 +10,5 @@ closeComment: > to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Moreover, the problems discussed in the issue may not be - directly from poliastro. If you still face this problem, reopen the issue or + directly from hapsira. If you still face this problem, reopen the issue or comment on it. We would be happy to help again! diff --git a/.github/workflows/documentation-links.yaml b/.github/workflows/documentation-links.yaml index 342d3ac37..a30b45d65 100644 --- a/.github/workflows/documentation-links.yaml +++ b/.github/workflows/documentation-links.yaml @@ -13,4 +13,4 @@ jobs: steps: - uses: readthedocs/actions/preview@v1 with: - project-slug: "poliastro" + project-slug: "hapsira" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 000000000..2dbd3a27b --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,67 @@ +name: hapsira test suite + +on: + push: {} + schedule: + - cron: '30 9 7 * *' + +jobs: + + specifics: + strategy: + matrix: + tox-env: [ + "fast", + "online", + "slow", + "images" + ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.8" + - name: Update Python infrastructure + run: | + python -m pip install --upgrade pip + pip install -U tox + - name: Versions + run: + python --version + tox --version + - name: Run tests + run: | + tox -e tests38-${{ matrix.tox-env }} + + build: + strategy: + matrix: + python-version: [ + "3.8", + "3.9", + "3.10", + "3.11" + ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install pandoc + run: | + sudo apt-get install -y pandoc + - name: Install Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Update Python infrastructure + run: | + python -m pip install --upgrade pip + pip install -U tox + - name: Versions + run: + python --version + tox --version + - name: Run tests + run: | + tox diff --git a/.github/workflows/validation_trigger.yml b/.github/workflows/validation_trigger.yml index 95711c421..2a89c5daa 100644 --- a/.github/workflows/validation_trigger.yml +++ b/.github/workflows/validation_trigger.yml @@ -1,5 +1,5 @@ -# This workflow triggers poliastro/validation CI from poliastro/poliastro -# everytime a new commit is introduced in poliastro:main branch +# This workflow triggers hapsira/validation CI from pleiszenburg/hapsira +# everytime a new commit is introduced in hapsira:main branch name: Validation test cases on: @@ -12,18 +12,18 @@ on: workflow_dispatch: jobs: - - # Validate poliastro's new features + + # Validate hapsira's new features validation: runs-on: ubuntu-latest environment: validation-env # Steps to be followed during validation job steps: - - name: Trigger poliastro/validation + - name: Trigger hapsira/validation run: | curl -XPOST -u "${{ secrets.VALIDATION_USER }}:${{ secrets.VALIDATION_PASS }}" \ -H "Accept: application/vnd.github.v3+json" \ - -H "Content-Type: application/json" https://api.github.com/repos/poliastro/validation/actions/workflows/ci_actions.yml/dispatches \ + -H "Content-Type: application/json" https://api.github.com/repos/hapsira/validation/actions/workflows/ci_actions.yml/dispatches \ --data '{"ref": "main"}' \ --fail diff --git a/.gitignore b/.gitignore index d3db135be..0f665555d 100644 --- a/.gitignore +++ b/.gitignore @@ -79,6 +79,7 @@ coverage.xml # Sphinx documentation docs/_build/ +docs/source/autoapi/hapsira/ # PyBuilder target/ @@ -127,6 +128,9 @@ dmypy.json .idea .cache .venv +env*/ # General .DS_Store + +todo.md diff --git a/AUTHORS.md b/AUTHORS.md index 2c081f445..4a47f8b08 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,11 +1,13 @@ # Authors -Originally devised and implemented by [Juan Luis Cano Rodríguez](mailto:hello@juanlu.space). +Core developer: +- [Sebastian M. Ernst](mailto:ernst@pleiszenburg.de) -# Maintainers +Contributors, in alphabetical order: -poliastro is maintained thanks to: +- (TBD) -* [Juan Luis Cano Rodríguez](mailto:hello@juanlu.space) -* [Jorge Martinez Garrido](mailto:contact@jorgemartinez.space) +## Original Authors 2012 - 2023 + +This project began as a fork of `poliastro`, which was implemented and maintained by [Juan Luis Cano Rodríguez](mailto:hello@juanlu.space) and [Jorge Martinez Garrido](mailto:contact@jorgemartinez.space). diff --git a/CITATION.cff b/CITATION.cff deleted file mode 100644 index cd9cd8f42..000000000 --- a/CITATION.cff +++ /dev/null @@ -1,33 +0,0 @@ -# This CITATION.cff file was generated with cffinit. -# Visit https://bit.ly/cffinit to generate yours today! - -cff-version: 1.2.0 -title: poliastro -message: Please cite this software using these metadata. -type: software -authors: - - given-names: Juan Luis - family-names: Cano Rodriguez - email: hello@juanlu.space - orcid: 'https://orcid.org/0000-0002-2187-161X' - - given-names: Jorge - family-names: Martínez Garrido - email: contact@jorgemartinez.space - orcid: 'https://orcid.org/0000-0001-9622-2369' -identifiers: - - type: doi - value: 10.5281/zenodo.6817189 - description: poliastro v0.17.0 -repository-code: 'https://github.com/poliastro/poliastro/' -url: 'https://www.poliastro.space/' -abstract: >- - poliastro is a pure Python library for interactive - astrodynamics. -keywords: - - astrodynamics - - orbital mechanics - - physics - - celestial mechanics -license: MIT -version: v0.17.0 -date-released: '2022-07-10' diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 524eae8da..000000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,58 +0,0 @@ -# Code of Conduct for the poliastro community - -The community of participants in poliastro is made up of members from -around the globe with a diverse set of skills, personalities, and -experiences. It is through these differences that our community -experiences success and continued growth. We expect everyone in our -community to follow these guidelines when interacting with others both -inside and outside of our community. Our goal is to keep ours a -positive, inclusive, successful, and growing community. - -As members of the community, - -- We pledge to treat all people with respect and provide a harassment- - and bullying-free environment, regardless of sex, sexual orientation - and/or gender identity, disability, physical appearance, body size, - race, nationality, ethnicity, and religion. In particular, sexual - language and imagery, sexist, racist, or otherwise exclusionary - jokes are not appropriate. -- We pledge to respect the work of others by recognizing - acknowledgment/citation requests of original authors. As authors, we - pledge to be explicit about how we want our own work to be cited or - acknowledged. -- We pledge to welcome those interested in joining the community, and - realize that including people with a variety of opinions and - backgrounds will only serve to enrich our community. In particular, - discussions relating to pros/cons of various technologies, - programming languages, and so on are welcome, but these should be - done with respect, taking proactive measure to ensure that all - participants are heard and feel confident that they can freely - express their opinions. -- We pledge to welcome questions and answer them respectfully, paying - particular attention to those new to the community. We pledge to - provide respectful criticisms and feedback in forums, especially in - discussion threads resulting from code contributions. -- We pledge to be conscientious of the perceptions of the wider - community and to respond to criticism respectfully. We will strive - to model behaviors that encourage productive debate and - disagreement, both within our community and where we are criticized. - We will treat those outside our community with the same respect as - people within our community. -- We pledge to help the entire community follow the code of conduct, - and to not remain silent when we see violations of the code of - conduct. We will take action when members of our community violate - this code such as contacting - (all emails sent to this address will be treated with the strictest - confidence) or talking privately with the person. - -This code of conduct applies to all community situations online and -offline, including mailing lists, forums, social media, conferences, -meetings, associated social events, and one-to-one interactions. - -Parts of this code of conduct have been adapted from the Astropy code of -conduct. - -The Code of Conduct for the poliastro community is licensed under a -Creative Commons Attribution 4.0 International License. We encourage -other communities related to ours to use or adapt this code as they see -fit. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d70a9197e..341b6813f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,87 +1,50 @@ # Contributing -poliastro is a community project, all contributions are more than welcome! +`hapsira` is a community project, all contributions are more than welcome! ## What you can do ### Report bugs -Not only things can break, but also different people have -different use cases for the project. If you find anything that doesn't -work as expected or have suggestions, please open a new issue on our -[issue tracker](https://github.com/poliastro/poliastro/issues). +Not only things can break, but also different people have different use cases for the project. If you find anything that doesn't work as expected or have suggestions, please open a new issue on our [issue tracker](https://github.com/pleiszenburg/hapsira/issues). ### Participate in the chat -Most of the project discussions happen in [the project chat](http://chat.poliastro.space/), -where announcements are first made, newcomers ask questions, -and in general project users exchange all sorts of information. -[Join today!](http://chat.poliastro.space/) +Most of the project discussions happen in [the project chat](https://matrix.to/#/#hapsira:matrix.org), where announcements are first made, newcomers ask questions, and in general project users exchange all sorts of information. [Join today!](https://matrix.to/#/#hapsira:matrix.org) ### Improve the Documentation -Documentation can always be expanded and improved. -The docs are stored in text files under the `docs/source` directory, -and the Python classes and methods also feature inline docs -in the form of docstrings. +Documentation can always be expanded and improved. The docs are stored in text files under the `docs/source` directory, and the Python classes and methods also feature inline docs in the form of docstrings. ### Contribute your research scripts -We would love to give your Astrodynamics scripts a home! -Please head to [our `contrib/` directory](https://github.com/poliastro/poliastro/tree/main/contrib) -for further information. +We would love to give your Astrodynamics scripts a home! Please head to [our `contrib/` directory](https://github.com/pleiszenburg/hapsira/tree/main/contrib) for further information. ### Fix bugs and add new features -Code contributions are welcome! If you are looking for a place to start, -check out the ["good-first-issue" label](https://github.com/poliastro/poliastro/labels/good%20first%20issue) -on our issue tracker. Those tasks should be easier to fix than the others -and require less knowledge about the library. +Code contributions are welcome! If you are looking for a place to start, check out the ["good-first-issue" label](https://github.com/pleiszenburg/hapsira/labels/good%20first%20issue) on our issue tracker. Those tasks should be easier to fix than the others and require less knowledge about the library. ## How to contribute ### Work from GitHub -GitHub makes it very easy to make small contributions -directly from your browser, without having to install any additional software. -To get familiar with the process, you can do -[this interactive GitHub training](https://lab.github.com/githubtraining/introduction-to-github). -Once you have finished it, you can edit the poliastro source files -straight from GitHub and open pull requests from your browser. +GitHub makes it very easy to make small contributions directly from your browser, without having to install any additional software. To get familiar with the process, you can do [this interactive GitHub training](https://lab.github.com/githubtraining/introduction-to-github). Once you have finished it, you can edit the `hapsira` source files straight from GitHub and open pull requests from your browser. ### Work locally -For more complex contributions, it will be more effective -to set up a local development environment and work from your own computer. +For more complex contributions, it will be more effective to set up a local development environment and work from your own computer. -The most important thing is to understand how Git works. Git is a decentralized -version control system that preserves the history of the software, helps -tracking changes and allows for multiple versions of the code to exist -at the same time. To learn more, you can have a look at -[this Getting Started guide](https://docs.github.com/en/get-started/getting-started-with-git). +The most important thing is to understand how Git works. Git is a decentralized version control system that preserves the history of the software, helps tracking changes and allows for multiple versions of the code to exist at the same time. To learn more, you can have a look at [this Getting Started guide](https://docs.github.com/en/get-started/getting-started-with-git). -Finally, you might want to have an Integrated Development Environment (IDE) -that makes editing the source files easier. -If you are hesitant on what IDE or editor to use, -have a look at [PyCharm](https://www.jetbrains.com/pycharm/), -[Visual Studio Code](https://code.visualstudio.com/), -or [Spyder](https://www.spyder-ide.org/). +Finally, you might want to have an Integrated Development Environment (IDE) that makes editing the source files easier. If you are hesitant on what IDE or editor to use, have a look at [PyCharm](https://www.jetbrains.com/pycharm/), [Visual Studio Code](https://code.visualstudio.com/), or [Spyder](https://www.spyder-ide.org/). ### Work from a cloud environment -There are some cloud options that give you -the flexibility of a powerful IDE with a terminal, -all from your web browser so you don't have to install anything. -Two popular cloud environments for development are -[the GitHub web editor](https://github.dev/poliastro/poliastro) -and [Gitpod](https://gitpod.io/#https://github.com/poliastro/poliastro/). +There are some cloud options that give you the flexibility of a powerful IDE with a terminal, all from your web browser so you don't have to install anything. Two popular cloud environments for development are [the GitHub web editor](https://github.dev/pleiszenburg/hapsira) and [Gitpod](https://gitpod.io/#https://github.com/pleiszenburg/hapsira/). ## Command line instructions -In the sections below you can read step-by-step guides to -perform common development tasks on the command line. -All these instructions are meant for UNIX-like operating systems, -for example: +In the sections below you can read step-by-step guides to perform common development tasks on the command line. All these instructions are meant for UNIX-like operating systems, for example: - Linux (any distribution will work) - macOS @@ -89,18 +52,15 @@ for example: ### Set up a development environment -To set up a development environment you will need Git and Python -up and running. You should only need to do this once! +To set up a development environment you will need Git and Python up and running. You should only need to do this once! Start by setting up Git: 1. [Install Git](https://git-scm.com/) on your computer. 2. [Sign up to GitHub](https://github.com/). -3. [Fork poliastro](https://help.github.com/articles/fork-a-repo/). -4. [Clone your fork](https://help.github.com/articles/cloning-a-repository/) - (remote name will be `origin`) -5. Add an `upstream` remote with `git remote add upstream https://github.com/poliastro/poliastro.git` - and fetch its information with `git fetch upstream` +3. [Fork hapsira](https://help.github.com/articles/fork-a-repo/). +4. [Clone your fork](https://help.github.com/articles/cloning-a-repository/) (remote name will be `origin`) +5. Add an `upstream` remote with `git remote add upstream https://github.com/pleiszenburg/hapsira.git` and fetch its information with `git fetch upstream` 6. Set your `main` branch to track `upstream` using `git branch --set-upstream-to=upstream/main` Next, configure your Python environment: @@ -109,16 +69,13 @@ Next, configure your Python environment: 7. Create a Python virtual environment using `python -m venv .venv` 8. Activate it using `source .venv/bin/activate` 9. Upgrade the development dependencies using `python -m pip install -U pip setuptools wheel flit tox` -10. Install the code in development mode using `python -m pip install -e .` - (this means that the installed code will change as soon as you change it in the - download location). +10. Install the code in development mode using `python -m pip install -e .` (this means that the installed code will change as soon as you change it in the download location). And with this, you will be ready to start contributing! ### Pull request workflow -Every time you want to contribute some code or documentation to poliastro, -you will need to follow these steps: +Every time you want to contribute some code or documentation to `hapsira`, you will need to follow these steps: 1. Make sure that your `main` branch is up to date: `git switch main` (or `git checkout main`) and `git pull --rebase upstream main` @@ -128,9 +85,7 @@ you will need to follow these steps: 5. [Push to your fork](https://help.github.com/articles/pushing-to-a-remote/). 6. [Open a pull request!](https://help.github.com/articles/creating-a-pull-request/) -One branch corresponds to one pull request. This means that, -if you keep committing and pushing changes to the same branch, -the pull request will update automatically (you don't need to open a new one!). +One branch corresponds to one pull request. This means that, if you keep committing and pushing changes to the same branch, the pull request will update automatically (you don't need to open a new one!). When your pull request is merged, you can: @@ -138,14 +93,11 @@ When your pull request is merged, you can: 8. Delete your local branch: `git branch --delete descriptive-name-of-my-change` 9. Refresh your fork: `git fetch --prune origin` and `git push origin main` -Remember that, whenever you want to start a new pull request, -you need to start from step 1. +Remember that, whenever you want to start a new pull request, you need to start from step 1. ### Build the documentation -To build the docs, you will need some system dependencies. -On Debian-like systems (Ubuntu, Linux Mint, etc), -they can be installed running: +To build the docs, you will need some system dependencies. On Debian-like systems (Ubuntu, Linux Mint, etc), they can be installed running: ```console $ sudo apt-get update && sudo apt-get install \ @@ -166,8 +118,7 @@ or, alternatively: (.venv) $ make html ``` -After this, the new docs will be inside `build/html`. You can open them -by running an HTTP server: +After this, the new docs will be inside `build/html`. You can open them by running an HTTP server: ```console $ cd build/html @@ -179,22 +130,12 @@ And point your browser to . ### Make code changes -You want to contribute new features or fix existing behavior? You are awesome! -Before rushing out though, make sure if the new feature you propose -is within the scope of the library (best thing is to ask in -[the chat](http://chat.poliastro.space/)) -or that the fix you want to apply has a corresponding issue in the issue tracker. +You want to contribute new features or fix existing behavior? You are awesome! Before rushing out though, make sure if the new feature you propose is within the scope of the library (best thing is to ask in [the chat](https://matrix.to/#/#hapsira:matrix.org)) or that the fix you want to apply has a corresponding issue in the issue tracker. Apart from all the steps described above, you need to have these extra things in mind: -1. Add tests to your code. You have lots of examples in the `tests/` directory - to get inspiration from. All new features and fixes should be tested, - and in the ideal case the coverage rate should increase or stay the same. -2. To check if your code is correct, run `tox`. This command runs the code - style, the tests and build the documentation of the project. -3. Notice that you can run a subset of the tests by - passing extra arguments to pytest, for example running - `tox -e tests-fast -- -k "anomaly"` - -Automatic services will ensure your code works -on all the supported operating systems and Python versions. +1. Add tests to your code. You have lots of examples in the `tests/` directory to get inspiration from. All new features and fixes should be tested, and in the ideal case the coverage rate should increase or stay the same. +2. To check if your code is correct, run `tox`. This command runs the code style, the tests and build the documentation of the project. +3. Notice that you can run a subset of the tests by passing extra arguments to pytest, for example running `tox -e tests-fast -- -k "anomaly"` + +Automatic services will ensure your code works on all the supported operating systems and Python versions. diff --git a/COPYING b/LICENSE similarity index 87% rename from COPYING rename to LICENSE index b52df60ae..8178a1fa1 100644 --- a/COPYING +++ b/LICENSE @@ -1,6 +1,7 @@ The MIT License (MIT) -Copyright (c) 2012 Juan Luis Cano Rodríguez, Jorge Martínez Garrido, and the poliastro development team +Copyright (c) 2023-2024 Sebastian M. Ernst +Copyright (c) 2012-2023 Juan Luis Cano Rodríguez, Jorge Martínez Garrido, and the poliastro development team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MANIFEST.in b/MANIFEST.in index bd6a0cb4a..48a408f91 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ -include COPYING -include AUTHORS +include LICENSE +include AUTHORS.md recursive-include tests *.py *.html diff --git a/Makefile b/Makefile index e65508160..56f66fad4 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,22 @@ -DOCKER_BASE_IMAGE := "poliastro:dev" -DOCKER_CONTAINER_NAME := "poliastro-dev" +DOCKER_BASE_IMAGE := "hapsira:dev" +DOCKER_CONTAINER_NAME := "hapsira-dev" +docs: + tox -e docs image: Dockerfile pyproject.toml docker build \ - -t poliastro:dev \ - . + -t hapsira:dev \ + . docker: docker run \ - -it \ - --rm \ - --name ${DOCKER_CONTAINER_NAME} \ - --volume $(shell pwd):/code \ - --user $(shell id -u):$(shell id -g) \ - ${DOCKER_BASE_IMAGE} \ - bash + -it \ + --rm \ + --name ${DOCKER_CONTAINER_NAME} \ + --volume $(shell pwd):/code \ + --user $(shell id -u):$(shell id -g) \ + ${DOCKER_BASE_IMAGE} \ + bash -.PHONY: docker image +.PHONY: docs docker image diff --git a/README.md b/README.md index 7fe5a127c..5b04698a4 100644 --- a/README.md +++ b/README.md @@ -1,246 +1,99 @@ -> This project is intended to be a fork of [poliastro](https://github.com/poliastro/poliastro), project setup & rebranding are work in progress. +[![hapsira Logo](docs/source/_static/logo_readme.png)](https://hapsira.readthedocs.io/) -[![poliastro Logo](https://raw.githubusercontent.com/poliastro/poliastro/main/docs/source/_static/logo_readme.png)](https://docs.poliastro.space/en/stable/) -| **Name** | **Website** | **Authors** | **Maintainers** | **Version** | -|:---------:|:----------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------:|:----------------------------------------------------:| -| poliastro | [https://www.poliastro.space](https://www.poliastro.space) | [Juan Luis Cano Rodriguez](https://orcid.org/0000-0002-2187-161X) [Jorge Martinez](https://orcid.org/0000-0001-9622-2369) | [poliastro development team](https://github.com/poliastro/poliastro/blob/main/AUTHORS.md) | [0.18.dev0](https://github.com/poliastro/poliastro/) | +# hapsira -[![poliastro_badge]](https://github.com/poliastro/poliastro) -[![ci_badge]](https://circleci.com/gh/poliastro/poliastro/?branch=main) -[![docs_badge]](https://docs.poliastro.space/en/latest/?badge=latest) -[![coverage_badge]](https://codecov.io/github/poliastro/poliastro?branch=main) -[![pre_commit_badge]](https://results.pre-commit.ci/latest/github/poliastro/poliastro/main) -[![python_badge]](https://pypi.org/project/poliastro) -[![pypi_badge]](https://pypi.org/project/poliastro) -[![license_badge]](https://opensource.org/licenses/MIT) -[![doi_badge]](https://zenodo.org/badge/latestdoi/11178845) -[![astropy_badge]](https://zenodo.org/badge/latestdoi/11178845) -[![mailing_badge]](https://groups.io/g/poliastro-dev) -[![chat_badge]](http://chat.poliastro.space/) -[![backers_badge]](https://opencollective.com/poliastro/) -[![sponsors_badge]](https://opencollective.com/poliastro/) -[![binder_badge]](https://mybinder.org/v2/gh/poliastro/poliastro/main?labpath=index.ipynb) -[![code_badge]]() +**🚀 Astrodynamics in Python - a `poliastro` fork** +[![ci_badge](https://github.com/pleiszenburg/hapsira/actions/workflows/test.yaml/badge.svg?branch=main "Build Status: main / release")](https://github.com/pleiszenburg/hapsira/actions/workflows/test.yaml) +[![docs_badge](https://readthedocs.org/projects/hapsira/badge/?version=latest "Build Status: Docs")](https://hapsira.readthedocs.io/en/latest/?badge=latest) +[![pre_commit_badge](https://results.pre-commit.ci/badge/github/pleiszenburg/hapsira/main.svg "pre-commit badge")](https://results.pre-commit.ci/latest/github/pleiszenburg/hapsira/main) +[![python_badge](https://img.shields.io/pypi/pyversions/hapsira?logo=pypi&logoColor=white "python badge")](https://pypi.org/project/hapsira) +[![pypi_badge](https://img.shields.io/pypi/v/hapsira.svg?logo=Python&logoColor=white?labelColor=blue "pypi badge")](https://pypi.org/project/hapsira) +[![license_badge](https://img.shields.io/badge/license-MIT-blue.svg?logo=open%20source%20initiative&logoColor=white "license badge")](https://opensource.org/licenses/MIT) +[![mailing_badge](https://img.shields.io/badge/mailing%20list-groups.io-8cbcd1.svg "mailing badge")](https://groups.io/g/hapsira-dev) +[![chat_badge](https://img.shields.io/matrix/hapsira:matrix.org.svg?logo=Matrix&logoColor=white "chat badge")](https://matrix.to/#/#hapsira:matrix.org) -poliastro is an open source ([MIT](#License)) pure Python library for interactive -Astrodynamics and Orbital Mechanics, with a focus on ease of use, speed, and -quick visualization. It provides a simple and intuitive API, and handles -physical quantities with units. -Some features include orbit propagation, solution of the Lambert\'s problem, -conversion between position and velocity vectors and classical orbital elements -and orbit plotting, among others. It focuses on interplanetary applications, -but can also be used to analyze artificial satellites in Low-Earth Orbit (LEO). +## Synopsis -If you use poliastro on your project, please [let us know]. Use the DOI to cite -poliastro in your publications: +`hapsira` is an open source ([MIT](https://opensource.org/licenses/MIT)) pure Python library for interactive Astrodynamics and Orbital Mechanics, with a focus on ease of use, speed, and quick visualization. It provides a simple and intuitive API, and handles physical quantities with units. Its features include orbit propagation, solution of Lambert\'s problem, conversion between position and velocity vectors and classical orbital elements and orbit plotting, among others. It focuses on interplanetary applications, but can also be used to analyze artificial satellites in Low-Earth Orbit (LEO). - Juan Luis Cano Rodríguez, Jorge Martinez, et al.. (2023). poliastro: poliastro 0.17.0. Zenodo. 10.5281/zenodo.6817189 +![Multiple examples image](docs/source/_static/examples.png) -![Multiple examples image](https://github.com/poliastro/poliastro/raw/main/docs/source/_static/examples.png) - - -## Requirements - -poliastro requires the following Python packages: - -- [numpy](https://numpy.org/) for basic numerical routines -- [astropy](https://www.astropy.org/) for physical units and time handling -- [numba](https://numba.pydata.org/) for accelerating the code -- [jplephem](https://github.com/brandon-rhodes/python-jplephem) for the planetary ephemerides using SPICE kernels -- [matplotlib](https://matplotlib.org/) for orbit plotting -- [plotly](https://plotly.com/) for 2D and 3D interactive orbit plotting -- [scipy](https://scipy.org/) for root finding and numerical propagation - -poliastro is supported on Linux, macOS and Windows on Python 3.8 to 3.10. +This project is a fork of the as of October 2023 unmaintained & archived [poliastro](https://github.com/poliastro/poliastro) package. ## Installation -Multiple installation methods are supported by poliastro, including: +`hapsira` is supported on Linux, macOS and Windows on Python 3.8 to 3.11. Python 3.8 support will be dropped and Python 3.12 support will be added as soon as [numba 0.59 gets released](https://github.com/numba/numba/issues/9197). + +Multiple installation methods are supported by `hapsira`, including: | **Logo** | **Platform** | **Command** | |:-----------------------------------------------------------------:|:------------:|:---------------------------------------------------------------------------------:| -| ![PyPI logo](https://simpleicons.org/icons/pypi.svg) | PyPI | ``python -m pip install poliastro`` | -| ![Conda Forge logo](https://simpleicons.org/icons/condaforge.svg) | Conda Forge | ``conda install poliastro --channel conda-forge`` | -| ![GitHub logo](https://simpleicons.org/icons/github.svg) | GitHub | ``python -m pip install https://github.com/poliastro/poliastro/archive/main.zip`` | - -For other installation methods, see the [alternative installation methods]. - - -## Documentation - -Complete documentation, including a [quickstart guide] and an [API reference], can -be read on the wonderful [Read the Docs]. Multi-version documentation includes: - -* [Development documentation](https://docs.poliastro.space/en/latest/) -* [Stable documentation](https://docs.poliastro.space/en/stable/) - +| ![PyPI logo](https://simpleicons.org/icons/pypi.svg) | PyPI | ``python -m pip install hapsira`` | +| ![Conda Forge logo](https://simpleicons.org/icons/condaforge.svg) | Conda Forge | ``conda install hapsira --channel conda-forge`` | +| ![GitHub logo](https://simpleicons.org/icons/github.svg) | GitHub | ``python -m pip install https://github.com/pleiszenburg/hapsira/archive/main.zip`` | -## Examples, background and talks +For other installation methods, see the [alternative installation methods](https://hapsira.readthedocs.io/en/stable/installation.html#alternative-installation-methods). -There is a great variety of examples demostrating the capabilities of -poliastro. Examples can be accessed in various ways: -* Examples source code collected in the [examples directory] -* Rendered [gallery of examples] presented in the documentation -* Interactive examples powered by [binder] so users can try poliastro without installing it +## Migrating from `poliastro` to `hapsira` -poliastro is also promoted through conferences and talks. These are the latest -talks in some of the most popular conferences about scientific software: +Currently, both packages are near-identical and should therefore be fully compatible. Potentially breaking changes will be added here and in the documentation. -| **Conference** | **Talk** | -|:---------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| -| SciPy 2022 | [Per Python ad astra: Interactive Astrodynamics with poliastro](https://www.youtube.com/watch?v=0GqdIRdDe9c) | -| OSCW 2019 | [Interplanetary mission analysis with poliastro](https://www.youtube.com/watch?v=0GqdIRdDe9c) | -| EuroSciPy 2019 | [Can we make Python fast without sacrificing readability? numba for Astrodynamics](https://pyvideo.org/euroscipy-2019/can-we-make-python-fast-without-sacrificing-readability-numba-for-astrodynamics.html) | -| EuroPython 2016 | [Per Python ad Astra](https://pyvideo.org/europython-2016/per-python-ad-astra.html) | +## Documentation -## License - -poliastro is released under the MIT license, hence allowing commercial use of -the library. Please refer to the [COPYING] file. - - The MIT License (MIT) - - Copyright (c) 2012-2023 Juan Luis Cano Rodríguez, Jorge Martínez Garrido, and the poliastro development team +Complete documentation, including a [quickstart guide](https://hapsira.readthedocs.io/en/stable/quickstart.html) and an [API reference](https://hapsira.readthedocs.io/en/latest/api.html) can be read on [Read the Docs](https://readthedocs.org). - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. +## Examples - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. +There is a great variety of examples demonstrating the capabilities of `hapsira`. Examples can be accessed in various ways: -If you are planning to use poliastro with commercial purposes consider -[sponsoring the project](#Backers-and-sponsors). +* Examples source code collected in the [examples directory](https://github.com/pleiszenburg/hapsira/tree/main/docs/source/examples) +* Rendered [gallery of examples](https://hapsira.readthedocs.io/en/latest/gallery.html) presented in the documentation ## Problems and suggestions -If for any reason you get an unexpected error message or an incorrect result, -or you want to let the developers know about your use case, please open a new -issue in the [issue tracker] and we will try to answer promptly. +If for any reason you get an unexpected error message or an incorrect result, or you want to let the developers know about your use case, please open a new issue in the [issue tracker](https://github.com/pleiszenburg/hapsira/issues) and we will try to answer promptly. ## Contributing and community support -This project exists thanks to all the people who contribute! poliastro is a -community project, hence all contributions are more than welcome! For more -information, head to the [CONTRIBUTING.md] file. - -Release announcements and general discussion take place on our [mailing list]. - -For further clarifications and discussions, feel free to join poliastro's [chat -room]. - -![Contributors image](https://opencollective.com/poliastro/contributors.svg?width=890&button=false) +This project exists thanks to all the people who contribute! `hapsira` is a community project, hence all contributions are more than welcome! For more information, head to the [CONTRIBUTING.md](https://github.com/pleiszenburg/hapsira/blob/main/CONTRIBUTING.md) file. +Release announcements and general discussion take place on our [mailing list](https://groups.io/g/hapsira-dev). -## Backers and sponsors +For further clarifications, feature suggestions and discussions, feel free to join `hapsira`'s [chat room](https://matrix.to/#/#hapsira:matrix.org). -poliastro requires finnacial support to mantain its high quality standars. The -money is used to renew the web domain and updating the documentation hosting -subscription among others. -If you would like to support poliastro, consider [becoming a backer] or -[becoming a sponsor]. +## Commercial support -**Thanks to all our backers!** - -[![Backers](https://opencollective.com/poliastro/backers.svg?width=890)](https://opencollective.com/poliastro#backer) - - -**Thanks to all our sponsors!** - -[![Sponsors](https://opencollective.com/poliastro/sponsor/0/avatar.svg)](https://opencollective.com/poliastro/sponsor/0/website) -[![Sponsors](https://opencollective.com/poliastro/sponsor/1/avatar.svg)](https://opencollective.com/poliastro/sponsor/0/website) +Commercial support is provided by [pleiszenburg.de - Independent Scientific Services](https://pleiszenburg.de). ## Frequently asked questions * **What's up with the name?** - poliastro comes from Polimi, which is the shortened name of the Politecnico di - Milano, see the [acknowledgement from the original author]. *Grazie mille!* + "hapsira" is a shorthand for "[hapësira kozmike](https://sq.wikipedia.org/wiki/Hap%C3%ABsira_kozmike)", which is Albanian for "space". Why Albanian? Other than virtually every reasonable English (and German for that matter) package name related to this topic already taken, [Wag the Dog](https://en.wikipedia.org/wiki/Wag_the_Dog) is a film definitely worth watching. + +* **Why a fork of poliastro?** + + See [here](https://github.com/poliastro/poliastro/issues/1640). -* **Is poliastro validated?** +* **Is hapsira validated?** - Yes! poliastro is a community project that strives to be easy to use, while at - the same time producing correct results [that are validated] against other - [commonly used Astrodynamics software] such as GMAT and Orekit. + `hapsira` is a fork of `poliastro`, [which was validated](https://github.com/poliastro/validation/) against other [commonly used Astrodynamics software](https://hapsira.readthedocs.io/en/stable/related.html) such as GMAT and Orekit. Currently, `hapsira`'s results are matching those of `poliastro`. -* **Can I suggest new features for poliastro?** +* **Can I suggest new features for hapsira?** - Sure, we encourage you to [open an issue] so we can discuss future feature - additions! + Sure, we encourage you to [open an issue](https://github.com/pleiszenburg/hapsira/issues) so we can discuss future feature additions! * **What's the future of the project?** - poliastro is actively maintained and receiving an influx of new contributors - thanks to the generous sponsorship of Google, the European Space Agency, and - NumFOCUS. The best way to get an idea of the roadmap is to see the - [milestones] of the project. - - - - -[quickstart guide]: https://docs.poliastro.space/en/stable/quickstart.html -[API reference]: https://docs.poliastro.space/en/latest/api.html -[Read the docs]: https://readthedocs.org -[binder]: https://mybinder.org/ -[alternative installation methods]: https://docs.poliastro.space/en/stable/installation.html#alternative-installation-methods -[issue tracker]: https://github.com/poliastro/poliastro/issues -[CONTRIBUTING.md]: https://github.com/poliastro/poliastro/blob/main/CONTRIBUTING.md -[COPYING]: https://github.com/poliastro/poliastro/blob/main/COPYING -[mailing list]: https://groups.io/g/poliastro-dev -[chat room]: http://chat.poliastro.space/ -[let us know]: mailto:hello@juanlu.space -[examples directory]: https://github.com/poliastro/poliastro/tree/main/docs/source/examples -[become a sponsor]: https://opencollective.com/poliastro/sponsor/0/website -[docs_stable]: https://docs.poliastro.space/en/stable/ -[docs_latest]: https://docs.poliastro.space/en/latest/ -[that are validated]: https://github.com/poliastro/validation/ -[commonly used Astrodynamics software]: https://docs.poliastro.space/en/stable/related.html -[open an issue]: https://github.com/poliastro/validation/issues/new -[milestones]: https://github.com/poliastro/poliastro/milestones -[Want to be a backer]: https://opencollective.com/poliastro#backer -[gallery of examples]: https://docs.poliastro.space/en/latest/gallery.html -[becoming a backer]: https://opencollective.com/poliastro#backer -[becoming a sponsor]: https://opencollective.com/poliastro#sponsor -[acknowledgement from the original author]: https://docs.poliastro.space/en/stable/history.html#acknowledgement-from-the-original-author - - - - -[poliastro_badge]: https://img.shields.io/badge/poliastro-gray.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAbxJREFUOE+Vk79LAmEYx7/njzulHKLQQIKwiyLuohykxqJBaHMNwvorcmltbG6LhnBqrMiWlmYl0SydaoqgwbLz9DS/B++heUI98A73vs/zfZ7n8zwndXsGF6tUKojFYvD7/W7Pzp00SiCXyyGTySCZTCKVSiEej7sKjRSgdzqdRq1WQzabRTQa/b8Ag8vlMsLhMBKJxN8F2u02LMtyAur1OqqFe+jaEsYi6oDQUAuGYcDn89nHsR7nq+N9zKxsQdvcGS3QbDYhyzJYQafTGSzZMvBQeoau61AUZXgKLJkTZaDX64XH40Gr1bIdKWqaJorFIjRNs995aE4LIjsdOXsGK9YT0HqHoawjEAggf3OJ2eUVBCcmnSoGBEQ2BsteA6juAY08unNn+HgN4fboEItqDAsHR6MF2B+rkMnwcRtov6E7fwGzM42781PEdQ2h1TV3AZInB6nX/8l1AbsbixhXJBgmUCqV7GWKRCJguwKk0wLhESQnEAwGcVd8wZTnE9+NLxuoqqo2B0mSHMgDEPnB0kmXDPp3gfesjHCZgFMRNrRIdKYxq9hGESgg9y+I68/EdsQOCGeKUPS3/QDL/fnRmszmsAAAAABJRU5ErkJggg== "poliastro" -[orcid_badge]: https://img.shields.io/badge/id-0000--0002--2187--161X-a6ce39.svg "orcid badge" -[ci_badge]: https://img.shields.io/circleci/build/gh/poliastro/poliastro/main?logo=CircleCi "ci badge" -[docs_badge]: https://img.shields.io/readthedocs/poliastro/stable.svg?logo=read%20the%20docs&logoColor=white&label=docs&version=stable "docs badge" -[coverage_badge]: https://img.shields.io/codecov/c/github/poliastro/poliastro.svg?logo=Codecov&logoColor=white "coverage badge" -[pre_commit_badge]: https://results.pre-commit.ci/badge/github/poliastro/poliastro/main.svg "pre-commit badge" -[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg?logo=open%20source%20initiative&logoColor=white "license badge" -[doi_badge]: https://zenodo.org/badge/11178845.svg "doi badge" -[astropy_badge]: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg "astropy badge" -[mailing_badge]: https://img.shields.io/badge/mailing%20list-groups.io-8cbcd1.svg -[chat_badge]: https://img.shields.io/matrix/poliastro:matrix.org.svg?logo=Matrix&logoColor=white "chat badge" -[backers_badge]: https://img.shields.io/opencollective/backers/poliastro?logo=open%20collective&logoColor=white "backers badge" -[sponsors_badge]: https://img.shields.io/opencollective/sponsors/poliastro?logo=open%20collective&logoColor=white "sponsors badge" -[python_badge]: https://img.shields.io/pypi/pyversions/poliastro?logo=pypi&logoColor=white "python badge" -[pypi_badge]: https://img.shields.io/pypi/v/poliastro.svg?logo=Python&logoColor=white?labelColor=blue "pypi badge" -[code_badge]: https://img.shields.io/badge/Code%20style-black%20isort%20flake8-black "code badge" -[binder_badge]: https://img.shields.io/badge/Binder-examples-green.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R4m7F5nLB6jbh7jbiDirOEibOGnKaMhq+PnaCVg6qWg6qegKaff6WhnpKofKGtnomxeZy3noG6dZi+n3vCcpPDcpPGn3bLb4/Mb47UbIrVa4rYoGjdaIbeaIXhoWHmZYHobXvpcHjqdHXreHLroVrsfG/uhGnuh2bwj2Hxk17yl1vzmljzm1j0nlX1olL3AJXWAAAAbXRSTlMAEBAQHx8gICAuLjAwMDw9PUBAQEpQUFBXV1hgYGBkcHBwcXl8gICAgoiIkJCQlJicnJ2goKCmqK+wsLC4usDAwMjP0NDQ1NbW3Nzg4ODi5+3v8PDw8/T09PX29vb39/f5+fr7+/z8/Pz9/v7+zczCxgAABC5JREFUeAHN1ul3k0UUBvCb1CTVpmpaitAGSLSpSuKCLWpbTKNJFGlcSMAFF63iUmRccNG6gLbuxkXU66JAUef/9LSpmXnyLr3T5AO/rzl5zj137p136BISy44fKJXuGN/d19PUfYeO67Znqtf2KH33Id1psXoFdW30sPZ1sMvs2D060AHqws4FHeJojLZqnw53cmfvg+XR8mC0OEjuxrXEkX5ydeVJLVIlV0e10PXk5k7dYeHu7Cj1j+49uKg7uLU61tGLw1lq27ugQYlclHC4bgv7VQ+TAyj5Zc/UjsPvs1sd5cWryWObtvWT2EPa4rtnWW3JkpjggEpbOsPr7F7EyNewtpBIslA7p43HCsnwooXTEc3UmPmCNn5lrqTJxy6nRmcavGZVt/3Da2pD5NHvsOHJCrdc1G2r3DITpU7yic7w/7Rxnjc0kt5GC4djiv2Sz3Fb2iEZg41/ddsFDoyuYrIkmFehz0HR2thPgQqMyQYb2OtB0WxsZ3BeG3+wpRb1vzl2UYBog8FfGhttFKjtAclnZYrRo9ryG9uG/FZQU4AEg8ZE9LjGMzTmqKXPLnlWVnIlQQTvxJf8ip7VgjZjyVPrjw1te5otM7RmP7xm+sK2Gv9I8Gi++BRbEkR9EBw8zRUcKxwp73xkaLiqQb+kGduJTNHG72zcW9LoJgqQxpP3/Tj//c3yB0tqzaml05/+orHLksVO+95kX7/7qgJvnjlrfr2Ggsyx0eoy9uPzN5SPd86aXggOsEKW2Prz7du3VID3/tzs/sSRs2w7ovVHKtjrX2pd7ZMlTxAYfBAL9jiDwfLkq55Tm7ifhMlTGPyCAs7RFRhn47JnlcB9RM5T97ASuZXIcVNuUDIndpDbdsfrqsOppeXl5Y+XVKdjFCTh+zGaVuj0d9zy05PPK3QzBamxdwtTCrzyg/2Rvf2EstUjordGwa/kx9mSJLr8mLLtCW8HHGJc2R5hS219IiF6PnTusOqcMl57gm0Z8kanKMAQg0qSyuZfn7zItsbGyO9QlnxY0eCuD1XL2ys/MsrQhltE7Ug0uFOzufJFE2PxBo/YAx8XPPdDwWN0MrDRYIZF0mSMKCNHgaIVFoBbNoLJ7tEQDKxGF0kcLQimojCZopv0OkNOyWCCg9XMVAi7ARJzQdM2QUh0gmBozjc3Skg6dSBRqDGYSUOu66Zg+I2fNZs/M3/f/Grl/XnyF1Gw3VKCez0PN5IUfFLqvgUN4C0qNqYs5YhPL+aVZYDE4IpUk57oSFnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC "binder badge" + The best way to get an idea of the roadmap is to see the [milestones](https://github.com/pleiszenburg/hapsira/milestones) of the project. diff --git a/binder/environment.yml b/binder/environment.yml deleted file mode 100644 index b50af1b33..000000000 --- a/binder/environment.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: python 3.10 -dependencies: -- python=3.10 -- jupytext>=1.13.3 \ No newline at end of file diff --git a/binder/labconfig/default_setting_overrides.json b/binder/labconfig/default_setting_overrides.json deleted file mode 100644 index f175b9367..000000000 --- a/binder/labconfig/default_setting_overrides.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "@jupyterlab/docmanager-extension:plugin": { - "defaultViewers": { - "markdown": "Jupytext Notebook", - "myst": "Jupytext Notebook" - } - } -} - diff --git a/binder/postBuild b/binder/postBuild deleted file mode 100644 index 34ef85fd8..000000000 --- a/binder/postBuild +++ /dev/null @@ -1,6 +0,0 @@ -# Stop everything if one command fails -set -e - -# See https://github.com/mwouts/jupytext/issues/803#issuecomment-982170660 -mkdir -p ${HOME}/.jupyter/labconfig -cp binder/labconfig/* ${HOME}/.jupyter/labconfig diff --git a/codemeta.json b/codemeta.json deleted file mode 100644 index 4463b1524..000000000 --- a/codemeta.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "@context": "https://doi.org/10.5063/schema/codemeta-2.0", - "@type": "SoftwareSourceCode", - "license": "https://spdx.org/licenses/MIT", - "codeRepository": "https://github.com/poliastro/poliastro", - "datePublished": "2013-07-07", - "dateModified": "2020-05-08", - "downloadUrl": "https://github.com/poliastro/poliastro.git", - "issueTracker": "https://github.com/poliastro/poliastro/issues", - "name": "poliastro", - "version": "0.14.0", - "description": "poliastro is an open-source pure Python package dedicated to problems arising in Astrodynamics and Orbital Mechanics, such as orbit propagation, solution of Lambert's problem, conversion between position and velocity vectors, and classical orbital elements and orbit plotting, focusing on interplanetary applications.", - "releaseNotes": "https://docs.poliastro.space/en/v0.14.0/changelog.html#poliastro-0-14-0-2020-05-08", - "programmingLanguage": [ - "Python3" - ], - "softwareRequirements": [ - "NumPy", - "Astropy", - "numba", - "jplephem", - "matplotlib", - "plotly", - "SciPy" - ], - "author": [ - { - "@type": "Person", - "givenName": "Juan Luis", - "familyName": "Cano Rodr\\u00edguez", - "affiliation": { - "@type": "Organization", - "name": "Satellogic" - } - }, - { - "@type": "Person", - "givenName": "Antonio", - "familyName": "Hidalgo" - }, - { - "@type": "Person", - "givenName": "Shreyas", - "familyName": "Bapat", - "affiliation": { - "@type": "Organization", - "name": "IIT Mandi" - } - }, - { - "@type": "Person", - "givenName": "Jorge", - "affiliation": { - "@type": "Organization", - "name": "poliastro" - } - }, - { - "@type": "Person", - "givenName": "Nikita", - "familyName": "Astrakhantsev", - "affiliation": { - "@type": "Organization", - "name": "University of Zurich" - } - }, - { - "@type": "Person", - "givenName": "Chatziargyriou", - "familyName": "Eleftheria" - }, - { - "@type": "Person", - "givenName": "Daniel", - "familyName": "Lubi\\u00e1n" - }, - { - "@type": "Person", - "givenName": "Alberto Lorenzo ", - "familyName": "M\\u00e1rquez", - "affiliation": { - "@type": "Organization", - "name": "Dassault Syst\\u00e8mes" - } - }, - { - "@type": "Person", - "givenName": "Abhishek ", - "familyName": "Chaurasia" - }, - { - "@type": "Person", - "givenName": "Emily", - "familyName": "Selwood" - }, - { - "@type": "Person", - "givenName": "Meu" - }, - { - "@type": "Person", - "givenName": "Pablo Rodr\\u00edguez ", - "familyName": "Robles", - "affiliation": { - "@type": "Organization", - "name": "Technical University of Munich (TUM)" - } - }, - { - "@type": "Person", - "givenName": "Tomek", - "familyName": "Mrugalski", - "affiliation": { - "@type": "Organization", - "name": "Internet Systems Consortium" - } - }, - { - "@type": "Person", - "givenName": "Helge", - "familyName": "Eichhorn" - }, - { - "@type": "Person", - "givenName": "Greg", - "familyName": "Lindahl" - }, - { - "@type": "Person", - "givenName": "Andrej", - "familyName": "Rode" - }, - { - "@type": "Person", - "givenName": "Himanshu ", - "familyName": "Garg" - }, - { - "@type": "Person", - "givenName": "aOrionis" - }, - { - "@type": "Person", - "givenName": "Ian", - "familyName": "DesJardin" - }, - { - "@type": "Person", - "givenName": "Hrishikesh", - "familyName": "Goyal" - }, - { - "@type": "Person", - "givenName": "priyanshu", - "familyName": "rohilla" - }, - { - "@type": "Person", - "givenName": "AntoniiaK" - }, - { - "@type": "Person", - "givenName": "Angala" - }, - { - "@type": "Person", - "givenName": "Ahmada", - "familyName": "Yusril" - }, - { - "@type": "Person", - "givenName": "Sarthak", - "familyName": "Jain", - "affiliation": { - "@type": "Organization", - "name": "IIT Indore" - } - }, - { - "@type": "Person", - "givenName": "Syed Osama Hussain" - }, - { - "@type": "Person", - "givenName": "Ole Streicher", - "affiliation": { - "@type": "Organization", - "name": "Leibniz Institute for Astrophysics" - } - }, - { - "@type": "Person", - "givenName": "Iv\\u00e1n Castro Fern\\u00e1ndez" - }, - { - "@type": "Person", - "givenName": "Fabian P. Schmidt" - }, - { - "@type": "Person", - "givenName": "Divyansh", - "familyName": "Raina" - } - ] -} \ No newline at end of file diff --git a/contrib/CR3BP/CR3BP.py b/contrib/CR3BP/CR3BP.py index 12f3d5de8..1b93cabc4 100644 --- a/contrib/CR3BP/CR3BP.py +++ b/contrib/CR3BP/CR3BP.py @@ -32,7 +32,7 @@ from numba import njit as jit import numpy as np -from poliastro._math.ivp import DOP853, solve_ivp +from hapsira._math.ivp import DOP853, solve_ivp @jit @@ -138,22 +138,10 @@ def getUdiff_CR3BP(r_, mu): # computing the double derivates with position Uxx = 1 - (1 - mu) / r13**3 - mu / r23**3 - ( - +3 * (1 - mu) * (rx + mu) ** 2 / r13**5 - + 3 * mu * (rx + mu - 1) ** 2 / r23**5 - ) - Uyy = ( - 1 - - (1 - mu) / r13**3 - - mu / r23**3 - + 3 * (1 - mu) * ry**2 / r13**5 - ) + (+3 * (1 - mu) * (rx + mu) ** 2 / r13**5 + 3 * mu * (rx + mu - 1) ** 2 / r23**5) + Uyy = 1 - (1 - mu) / r13**3 - mu / r23**3 + 3 * (1 - mu) * ry**2 / r13**5 +3 * mu * ry**2 / r23**5 - Uzz = ( - -(1 - mu) / r13**3 - - mu / r23**3 - + 3 * (1 - mu) * rz**2 / r13**5 - ) + Uzz = -(1 - mu) / r13**3 - mu / r23**3 + 3 * (1 - mu) * rz**2 / r13**5 +3 * mu * rz**2 / r23**5 Uxy = ( 3 * ry * (1 - mu) * (rx + mu) / r13**5 diff --git a/contrib/CR3BP/README.md b/contrib/CR3BP/README.md index ffd32dbca..a6a1794a1 100644 --- a/contrib/CR3BP/README.md +++ b/contrib/CR3BP/README.md @@ -22,7 +22,7 @@ ## Functionality I Required Help With - Integration of code with astropy constants and units without breaking JIT Compilation -- Integration of ploting with existing poliastro interactive plotter (currently in the test file I use matplotlib and mplot3d) +- Integration of ploting with existing hapsira interactive plotter (currently in the test file I use matplotlib and mplot3d) ## About Me I am Kevin, a Space Engineering graduate from Politecnico di Milano. I love working with mission design, flight dynamics and simulations. Most of my work was done with MATLAB and I have some experience with C++, but I am quite a noob with Python. So in case you find any error in my implementation, discussion of new functionality to add and improvement to my code, feel free to contact me through my email. diff --git a/contrib/CR3BP/test_run_CR3BP.py b/contrib/CR3BP/test_run_CR3BP.py index 92797a901..ffab728b9 100644 --- a/contrib/CR3BP/test_run_CR3BP.py +++ b/contrib/CR3BP/test_run_CR3BP.py @@ -22,7 +22,7 @@ import matplotlib.pyplot as plt import numpy as np -from poliastro.bodies import Earth, Moon +from hapsira.bodies import Earth, Moon # Earth-Moon system properties k1 = Earth.k.to(u.km**3 / u.s**2).value diff --git a/contrib/README.md b/contrib/README.md index 52bdeb924..81103f83f 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -1,7 +1,7 @@ # Community contributions The `contrib` directory contains community contributions -that are not yet ready to be part of the poliastro API, +that are not yet ready to be part of the hapsira API, but are nonetheless useful for Astrodynamics Python users. If you have a small script or set of them @@ -28,8 +28,8 @@ please follow these steps: specifying any required dependencies. And if you have any questions, -please [join our chat](http://chat.poliastro.space) -or [open an issue](https://github.com/poliastro/poliastro/issues/new)! +please [join our chat](http://chat.hapsira.space) +or [open an issue](https://github.com/hapsira/hapsira/issues/new)! Note that: @@ -40,6 +40,6 @@ Note that: so either they should be pure Python or be written in a compiled language with a Python wrapper. - All contributions will be permissively licensed with the MIT license, - the one that poliastro uses. + the one that hapsira uses. If you don't agree with this, we ask you to find a different place to share your contribution. diff --git a/contrib/cr3bp_DhruvJ/cr3bp_PO_master.py b/contrib/cr3bp_DhruvJ/cr3bp_PO_master.py index e66d86873..396bd698f 100644 --- a/contrib/cr3bp_DhruvJ/cr3bp_PO_master.py +++ b/contrib/cr3bp_DhruvJ/cr3bp_PO_master.py @@ -221,9 +221,7 @@ def single_shooter( # Update Free variable vector, include PALC constraint if PALC is being used if palc_args is None: - self.xfree = self.newton_raphson_update( - self.xfree, FX, self.DF - ) + self.xfree = self.newton_raphson_update(self.xfree, FX, self.DF) else: DG[:-1, :] = self.DF DG[-1, :] = palc_args[ @@ -343,9 +341,7 @@ def __free_vars_setup_update(self, free_vars, purpose="update"): else: self.ic[self.stm_col_index] = self.xfree - def __constraints_setup_update( - self, constraints, results_stm, purpose="update" - ): + def __constraints_setup_update(self, constraints, results_stm, purpose="update"): """Computes intial xconstraint and xdesired Vector and Updates the two after computing a new xfree Parameters ---------- @@ -383,15 +379,11 @@ def __constraints_setup_update( # Setup/Update Constraint Vector and Desired vector, xconstraint where FX = xconstraint - xdesired if "jc" in constraints: - self.xconstraint[:-1] = results_stm["states"][ - -1, self.stm_row_index - ] + self.xconstraint[:-1] = results_stm["states"][-1, self.stm_row_index] self.xconstraint[-1] = self.JC(self.ic) # JC of IC self.xdesired[-1] = self.JCd # Desired JC else: - self.xconstraint = results_stm["states"][ - -1, self.stm_row_index - ] + self.xconstraint = results_stm["states"][-1, self.stm_row_index] # Updated desired to be inital state of orbit if self.sym_period_targ == 1: @@ -550,9 +542,7 @@ def __compute_DF( ) # Account for Phase constraint with PALC if palc_args is not None: - self.DF[-1, : len(palc_args["dx/dtheta"])] = palc_args[ - "dx/dtheta" - ] + self.DF[-1, : len(palc_args["dx/dtheta"])] = palc_args["dx/dtheta"] def newton_raphson_update(self, xfree, FX, DG): """Multi-dimensional Newton-Raphson Method to update inital guess. @@ -763,9 +753,7 @@ def local_manifold_gen( if get_initial_states is False: local_manifold_states = np.zeros((teval_len, 6)) - self.teval = np.linspace(0, abs(prop_time), teval_len) * np.sign( - prop_time - ) + self.teval = np.linspace(0, abs(prop_time), teval_len) * np.sign(prop_time) int_method_orig = self.int_method self.int_method = "DOP853" @@ -829,9 +817,7 @@ def global_manifold_gen( # Obtain states at dififerent times along PO and STM(tf,0) int_method_orig = self.int_method self.int_method = "boost" - result_stm = self.propagate( - ic=po_ic, tf=tf_po_state[count_po_states] - ) + result_stm = self.propagate(ic=po_ic, tf=tf_po_state[count_po_states]) # eigenvect of nth invariant curve = STM(tf_i,0)*eigenvector of the first invar curve eigvector_tfi = np.real( @@ -843,9 +829,7 @@ def global_manifold_gen( self.int_method = int_method_orig - global_manifold_states[ - count_po_states, :, : - ] = self.local_manifold_gen( + global_manifold_states[count_po_states, :, :] = self.local_manifold_gen( dist=dist, eigenvect_manifold=eigvector_tfi, prop_time=prop_time, diff --git a/contrib/cr3bp_DhruvJ/cr3bp_model_master.py b/contrib/cr3bp_DhruvJ/cr3bp_model_master.py index 7d20d5b2e..99a874747 100644 --- a/contrib/cr3bp_DhruvJ/cr3bp_model_master.py +++ b/contrib/cr3bp_DhruvJ/cr3bp_model_master.py @@ -155,7 +155,9 @@ def propagate( (ic, np.identity(6).flatten()) ) # Appends the IC for STM: IC[6x1] + I_6x6 elif len(ic) == 42: - self.stm_bool = 1 # To make sure stm_bool is set to 1 if all 42 states are passed + self.stm_bool = ( + 1 # To make sure stm_bool is set to 1 if all 42 states are passed + ) if len(ic) == 6: stm_bool == 0 elif len(ic) != 6 and len(ic) != 42: @@ -182,9 +184,7 @@ def xcross(t, y): ): # Terminates integration when event encountered, solution is hit from from either direction: crossising -y to +y region or +y to -y region, that is crossing XZ or XY plane xcross.terminal = True xcross.direction = 0 - elif ( - self.xcross_cond == 2 - ): # Track events when crossing -y to +y region + elif self.xcross_cond == 2: # Track events when crossing -y to +y region xcross.terminal = True xcross.direction = 1 else: # Does not track any events @@ -192,10 +192,7 @@ def xcross(t, y): # Numerical Integration # Uses a custom events function during propagation - if ( - self.custom_events_func is not None - and use_custom_events_func is True - ): + if self.custom_events_func is not None and use_custom_events_func is True: fun = solve_ivp( self.__Nondim_DE_CR3BP_STM, [t0, tf], @@ -372,9 +369,7 @@ def rel_dist_cr3bp(self, state=None): if state is None: state = self.ic - dist_p1_p3 = ( - (state[0] + self.mu) ** 2 + state[1] ** 2 + state[2] ** 2 - ) ** 0.5 + dist_p1_p3 = ((state[0] + self.mu) ** 2 + state[1] ** 2 + state[2] ** 2) ** 0.5 dist_p2_p3 = ( (state[0] - 1 + self.mu) ** 2 + state[1] ** 2 + state[2] ** 2 ) ** 0.5 @@ -467,9 +462,7 @@ def ui_partials_acc_cr3bp(self, state=None): x_plus_mu = state[0] + self.mu # x+mu x_minus_1_plus_mu = state[0] - 1 + self.mu # x-1+mu - one_minus_mu_dist_p1_p3_3 = ( - one_minus_mu / dist_p1_p3**3 - ) # (1-mu)/d13^3 + one_minus_mu_dist_p1_p3_3 = one_minus_mu / dist_p1_p3**3 # (1-mu)/d13^3 mu_dist_p2_p3_3 = self.mu / dist_p2_p3**3 # mu/d23^3 # Calculate Ux, Uy, Uz, ax, ay, az @@ -479,9 +472,7 @@ def ui_partials_acc_cr3bp(self, state=None): - mu_dist_p2_p3_3 * x_minus_1_plus_mu ) Uy = ( - state[1] - - one_minus_mu_dist_p1_p3_3 * state[1] - - mu_dist_p2_p3_3 * state[1] + state[1] - one_minus_mu_dist_p1_p3_3 * state[1] - mu_dist_p2_p3_3 * state[1] ) Uz = -one_minus_mu_dist_p1_p3_3 * state[2] - mu_dist_p2_p3_3 * state[2] ax = 2 * state[4] + Ux diff --git a/contrib/cr3bp_DhruvJ/cr3bp_po_fam_continuation.py b/contrib/cr3bp_DhruvJ/cr3bp_po_fam_continuation.py index 01f90e043..f494ecc19 100644 --- a/contrib/cr3bp_DhruvJ/cr3bp_po_fam_continuation.py +++ b/contrib/cr3bp_DhruvJ/cr3bp_po_fam_continuation.py @@ -371,9 +371,7 @@ def palc_po_fam( DF = np.zeros((len(free_vars) - 1, len(free_vars))) DF[:-1, :] = retargeted_orbit["DF"] - DF[-1, :-1] = palc_args[ - "dx/dtheta" - ] # Time phase constraint part is 0 + DF[-1, :-1] = palc_args["dx/dtheta"] # Time phase constraint part is 0 retargeted_orbit["DF"] = copy.deepcopy(DF) # Compute null vector and palc constraint components @@ -567,9 +565,7 @@ def palc_po_phase_constraint(self, free_vars, results, palc_args): The default is None """ # Phase constraint = dxi/dtheta = dxi/dt*(Period/2pi) - _, _, _, ax, ay, az = self.ui_partials_acc_cr3bp( - results["states"][0, :] - ) + _, _, _, ax, ay, az = self.ui_partials_acc_cr3bp(results["states"][0, :]) palc_args["dx/dtheta"] = ( np.array( [ @@ -586,9 +582,7 @@ def palc_po_phase_constraint(self, free_vars, results, palc_args): ) free_vars_index = self.map_vars_index_cr3bp(free_vars) stm_col_index = [ - free_vars_index[i] - for i in range(len(free_vars)) - if free_vars_index[i] < 6 + free_vars_index[i] for i in range(len(free_vars)) if free_vars_index[i] < 6 ] palc_args["dx/dtheta"] = palc_args["dx/dtheta"][stm_col_index] @@ -654,8 +648,7 @@ def line_search( # Check if step size is bigger than a given fraction of the initial step size if abs(step_size) < abs( - line_search_params["step_size0"] - * line_search_params["lower_lim_factor"] + line_search_params["step_size0"] * line_search_params["lower_lim_factor"] ): print( "Updated step size is too small compared to given step size. Rerun with smaller step size, attenuation factor or allowable lower limit" @@ -682,9 +675,7 @@ def save_targeted_po_char(self, results): self.targeted_po_char["conv_tol"] = self.conv_tol self.targeted_po_char["int_tol"] = self.int_tol - self.targeted_po_char["ic"].append( - copy.deepcopy(results["states"][0, :]) - ) + self.targeted_po_char["ic"].append(copy.deepcopy(results["states"][0, :])) self.targeted_po_char["tf"].append(copy.deepcopy(results["t"][-1])) self.targeted_po_char["jc"].append( copy.deepcopy(self.JC(results["states"][0, :])) diff --git a/contrib/cr3bp_DhruvJ/cr3bp_po_plot_orbits.py b/contrib/cr3bp_DhruvJ/cr3bp_po_plot_orbits.py index c8261e47f..c827d1f5a 100644 --- a/contrib/cr3bp_DhruvJ/cr3bp_po_plot_orbits.py +++ b/contrib/cr3bp_DhruvJ/cr3bp_po_plot_orbits.py @@ -62,9 +62,7 @@ def plot_orbits( colour_range = [min(colourby), max(colourby)] cmap = matplotlib.cm.get_cmap(colourmap) - norm = matplotlib.colors.Normalize( - vmin=colour_range[0], vmax=colour_range[1] - ) + norm = matplotlib.colors.Normalize(vmin=colour_range[0], vmax=colour_range[1]) colours = [] for i in colourby: colours.append(cmap(norm(i))) diff --git a/contrib/cr3bp_DhruvJ/example.py b/contrib/cr3bp_DhruvJ/example.py index 162cac3ad..fdee72053 100644 --- a/contrib/cr3bp_DhruvJ/example.py +++ b/contrib/cr3bp_DhruvJ/example.py @@ -39,9 +39,7 @@ plt.figure(pltnum) ax = plt.axes(projection="3d") ax.set_title("CR3BP EM, trajectory, T = 10[nd], tol = 1e-12") -ax.plot3D( - results["states"][:, 0], results["states"][:, 1], results["states"][:, 2] -) +ax.plot3D(results["states"][:, 0], results["states"][:, 1], results["states"][:, 2]) ax.scatter( results["states"][0, 0], results["states"][0, 1], @@ -52,9 +50,7 @@ ax.scatter(li[:, 0], li[:, 1], li[:, 2], color="red", label="Li") ax.scatter(-mu, 0, 0, color="blue", label="Earth") ax.scatter(1 - mu, 0, 0, color="grey", label="Moon") -ax.set_box_aspect( - [ub - lb for lb, ub in (getattr(ax, f"get_{a}lim")() for a in "xyz")] -) +ax.set_box_aspect([ub - lb for lb, ub in (getattr(ax, f"get_{a}lim")() for a in "xyz")]) ax.set_ylabel("y [nd]") ax.set_xlabel("x [nd]") ax.set_zlabel("z [nd]") diff --git a/contrib/cr3bp_DhruvJ/example_3D_orb_fam.py b/contrib/cr3bp_DhruvJ/example_3D_orb_fam.py index 18f43501e..0a67e7b8a 100644 --- a/contrib/cr3bp_DhruvJ/example_3D_orb_fam.py +++ b/contrib/cr3bp_DhruvJ/example_3D_orb_fam.py @@ -22,9 +22,7 @@ lib_loc = lib_pt_loc(sys_p1p2) li = lib_loc[1, :] # 0 for L1 and 1 for L2 -ig = np.array( - [1.021881345465263, 0, 0.182000000000000, 0, -0.102950816739606, 0] -) +ig = np.array([1.021881345465263, 0, 0.182000000000000, 0, -0.102950816739606, 0]) tf_guess = 1.509263667286943 free_vars = ["x", "vy", "t"] @@ -59,9 +57,7 @@ ) plt.plot(li[0], li[1], "ro", label="L1") ax.scatter(li[0], li[1], li[2], color="red") -ax.set_box_aspect( - [ub - lb for lb, ub in (getattr(ax, f"get_{a}lim")() for a in "xyz")] -) +ax.set_box_aspect([ub - lb for lb, ub in (getattr(ax, f"get_{a}lim")() for a in "xyz")]) ax.set_ylabel("y [nd]") ax.set_xlabel("x [nd]") ax.set_zlabel("z [nd]") diff --git a/contrib/cr3bp_DhruvJ/example_L4_vertical_orb_fam.py b/contrib/cr3bp_DhruvJ/example_L4_vertical_orb_fam.py index 37004e840..22ae3b1c1 100644 --- a/contrib/cr3bp_DhruvJ/example_L4_vertical_orb_fam.py +++ b/contrib/cr3bp_DhruvJ/example_L4_vertical_orb_fam.py @@ -92,14 +92,10 @@ ) # Add Earth data_trace.append( - go.Scatter3d( - x=[-sys_p1p2.mu], y=[0], z=[0], marker=dict(color="blue", size=10) - ) + go.Scatter3d(x=[-sys_p1p2.mu], y=[0], z=[0], marker=dict(color="blue", size=10)) ) data_trace.append( - go.Scatter3d( - x=[1 - sys_p1p2.mu], y=[0], z=[0], marker=dict(color="grey", size=7) - ) + go.Scatter3d(x=[1 - sys_p1p2.mu], y=[0], z=[0], marker=dict(color="grey", size=7)) ) diff --git a/contrib/cr3bp_DhruvJ/example_L4_vertical_orb_fam_palc.py b/contrib/cr3bp_DhruvJ/example_L4_vertical_orb_fam_palc.py index 0f83ed541..8fcdeab61 100644 --- a/contrib/cr3bp_DhruvJ/example_L4_vertical_orb_fam_palc.py +++ b/contrib/cr3bp_DhruvJ/example_L4_vertical_orb_fam_palc.py @@ -76,14 +76,10 @@ ) # Add Earth data_trace.append( - go.Scatter3d( - x=[-sys_p1p2.mu], y=[0], z=[0], marker=dict(color="blue", size=10) - ) + go.Scatter3d(x=[-sys_p1p2.mu], y=[0], z=[0], marker=dict(color="blue", size=10)) ) data_trace.append( - go.Scatter3d( - x=[1 - sys_p1p2.mu], y=[0], z=[0], marker=dict(color="grey", size=7) - ) + go.Scatter3d(x=[1 - sys_p1p2.mu], y=[0], z=[0], marker=dict(color="grey", size=7)) ) plot_orbits( diff --git a/contrib/cr3bp_DhruvJ/example_lyapunov_orb_fam.py b/contrib/cr3bp_DhruvJ/example_lyapunov_orb_fam.py index 57cf21514..6ea397f98 100644 --- a/contrib/cr3bp_DhruvJ/example_lyapunov_orb_fam.py +++ b/contrib/cr3bp_DhruvJ/example_lyapunov_orb_fam.py @@ -36,9 +36,7 @@ "vx", ] # All constraints, 'jc' can be added explicity or will be added in npc_fam_fam_cr3bp if to be continued in 'jc' -orb_fam_obj = periodic_orbit_fam_continuation( - sys_p1p2, initial_guess, tf=tf_guess -) +orb_fam_obj = periodic_orbit_fam_continuation(sys_p1p2, initial_guess, tf=tf_guess) # Target Lyapunov orbit using Single Shooter Variable Time setup # Exploits XZ plane symmetry(sym_perioid_targ set to 1/2) diff --git a/contrib/relative.py b/contrib/relative.py index 9c49ad9a9..04637fabd 100644 --- a/contrib/relative.py +++ b/contrib/relative.py @@ -8,7 +8,7 @@ ## FILE DESCRIPTION: ## ## ## ## This file is a prototype file for a newly proposed "Relative Orbit" ## -## object in poliastro. The class 'relative' is defined by 02x instances ## +## object in hapsira. The class 'relative' is defined by 02x instances ## ## of the 'twobody' object - one chief, and one deputy spacecraft, and ## ## it takes in the classical elements from each of them. The class then ## ## automatically computes the states of relative motion by linearizing ## @@ -52,7 +52,7 @@ ############################################################################## ############################################################################## -# Import matplotlib (possibly change to plotly for poliastro?) +# Import matplotlib (possibly change to plotly for hapsira?) # Import the relevant AstroPy libraries. from astropy import units as u @@ -64,9 +64,9 @@ import numpy as np # Import the relevant PoliAstro libraries -from poliastro.bodies import Earth -from poliastro.twobody import Orbit -from poliastro.twobody.angles import E_to_M, nu_to_E +from hapsira.bodies import Earth +from hapsira.twobody import Orbit +from hapsira.twobody.angles import E_to_M, nu_to_E # Below is the definition of the relative orbits class (RelativeOrb). # For the actual example script of how to use the class, scroll to the bottom! @@ -84,7 +84,7 @@ # Let us define a relative orbits class that can be defined by two orbits! class RelativeOrb: def __init__(self, satC, satD): - """When this class is initialized, it requires two poliastro twobody + """When this class is initialized, it requires two hapsira twobody objects: a chief orbiter (satC) and a deputy orbiter (satD). After initialisation, a number of computations must be made. @@ -251,9 +251,7 @@ def _solve_posn(self, a, e, i, w, R, M, mu): # need perform the 313 Euler angle rotation in the following sequence: # Right Angle of Ascending Node -> Inclination -> Argument of Latitude. # Now, let us get us the DCM that converts to the hill-frame. - DCM_HN = np.matmul( - self._dcmZ(w), np.matmul(self._dcmX(i), self._dcmZ(R)) - ) + DCM_HN = np.matmul(self._dcmZ(w), np.matmul(self._dcmX(i), self._dcmZ(R))) # Notice that the hill frame computation does not include a rotation # of the true anomaly, and that's because the true anomaly has already @@ -273,9 +271,7 @@ def _solve_posn(self, a, e, i, w, R, M, mu): ) vel = np.matmul( DCM_NH, - np.array( - [vel_X.to_value(u.km / u.s), vel_Y.to_value(u.km / u.s), 0.0] - ), + np.array([vel_X.to_value(u.km / u.s), vel_Y.to_value(u.km / u.s), 0.0]), ) # Finally, let us not forget to compute the true anomaly. diff --git a/contrib/rv2tle.py b/contrib/rv2tle.py index 37b3c654f..cb9818c0d 100755 --- a/contrib/rv2tle.py +++ b/contrib/rv2tle.py @@ -17,9 +17,9 @@ import numpy as np from sgp4.api import SGP4_ERRORS, WGS84, Satrec -from poliastro.bodies import Earth -from poliastro.examples import iss -from poliastro.twobody import Orbit, angles +from hapsira.bodies import Earth +from hapsira.examples import iss +from hapsira.twobody import Orbit, angles def unitv(v): @@ -121,9 +121,7 @@ def rvel(r, v): x3thm1 = 3 * theta2 - 1 x1mth2 = 1 - theta2 x7thm1 = 7 * theta2 - 1 - r = (rk - 0.5 * temp1 * x1mth2 * cos2u) / ( - 1 - 1.5 * temp2 * betal * x3thm1 - ) + r = (rk - 0.5 * temp1 * x1mth2 * cos2u) / (1 - 1.5 * temp2 * betal * x3thm1) u = uk + 0.25 * temp2 * x7thm1 * sin2u xnodeo = xnodek - 1.5 * temp2 * cosio * sin2u xincl = xinck - 1.5 * temp2 * cosio * sinio * cos2u @@ -283,7 +281,7 @@ def rv2el(rr, vv, epoch): if __name__ == "__main__": # Display some initial data print(f" Orbit: {iss}") - print(" State vector [poliastro]") + print(" State vector [hapsira]") print(f" r = {iss.r}") print(f" v = {iss.v}") print() @@ -291,7 +289,7 @@ def rv2el(rr, vv, epoch): # Reference epoch epoch = Time(iss.epoch, format="datetime", scale="utc") - # Store poliastro orbital elements (osculating) + # Store hapsira orbital elements (osculating) ecc_anomaly = angles.nu_to_E(iss.nu, iss.ecc) mean_anomaly = angles.E_to_M(ecc_anomaly, iss.ecc) @@ -349,7 +347,7 @@ def rv2el(rr, vv, epoch): print(f" v = {sv.v}") print() - print("State vector differences [poliastro - rv2el]") + print("State vector differences [hapsira - rv2el]") print(f" dr = {iss.r - sv.r}") print(f" dv = {iss.v - sv.v}") print() diff --git a/docs/Makefile b/docs/Makefile index 9b94a90e1..121f131ad 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -93,17 +93,17 @@ qthelp: @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/poliastro.qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/hapsira.qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/poliastro.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/hapsira.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/poliastro" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/poliastro" + @echo "# mkdir -p $$HOME/.local/share/devhelp/hapsira" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/hapsira" @echo "# devhelp" epub: diff --git a/docs/source/_static/logo_readme.png b/docs/source/_static/logo_readme.png index 1da916076..17cdda793 100644 Binary files a/docs/source/_static/logo_readme.png and b/docs/source/_static/logo_readme.png differ diff --git a/docs/source/_static/logo_text.png b/docs/source/_static/logo_text.png index 719d23baf..584e8c096 100644 Binary files a/docs/source/_static/logo_text.png and b/docs/source/_static/logo_text.png differ diff --git a/docs/source/_static/logo_text_transp.png b/docs/source/_static/logo_text_transp.png index 786abd8f1..10f5801ea 100644 Binary files a/docs/source/_static/logo_text_transp.png and b/docs/source/_static/logo_text_transp.png differ diff --git a/docs/source/api.md b/docs/source/api.md index b558c94be..a8a07bf51 100644 --- a/docs/source/api.md +++ b/docs/source/api.md @@ -2,32 +2,24 @@ # API reference -This page holds poliastro's API documentation, which might be helpful for final -users or developers to create their own poliastro-based utilities. Among the -different sub-packages and modules, we might differentiate two big categories: -core utilities and high-level ones. +This page holds `hapsira`'s API documentation, which might be helpful for final users or developers to create their own `hapsira`-based utilities. Among the different sub-packages and modules, we might differentiate two big categories: core utilities and high-level ones. ## High level API -The high level API of poliastro allows you to do most common tasks -(propagate an osculating orbit, sampling an ephemerides, compute maneuvers) -in a straightforward way. All the methods expect Astropy units. +The high level API of `hapsira` allows you to do most common tasks (propagate an osculating orbit, sampling an ephemerides, compute maneuvers) in a straightforward way. All the methods expect Astropy units. -The most important high level objects and methods are -{py:class}`poliastro.twobody.Orbit`, {py:class}`poliastro.ephem.Ephem`, and -{py:class}`poliastro.maneuver.Maneuver`. -Here is a summarized reference of commonly used methods: +The most important high level objects and methods are {py:class}`hapsira.twobody.Orbit`, {py:class}`hapsira.ephem.Ephem`, and {py:class}`hapsira.maneuver.Maneuver`. Here is a summarized reference of commonly used methods: ```{eval-rst} -.. autoapiclass:: poliastro.twobody.Orbit +.. autoapiclass:: hapsira.twobody.Orbit :members: from_classical, from_vectors, from_sbdb, propagate, to_ephem :noindex: -.. autoapiclass:: poliastro.ephem.Ephem +.. autoapiclass:: hapsira.ephem.Ephem :members: from_body, from_orbit, from_horizons, sample, rv :noindex: -.. autoapiclass:: poliastro.maneuver.Maneuver +.. autoapiclass:: hapsira.maneuver.Maneuver :members: impulse, hohmann, bielliptic, lambert :noindex: @@ -48,21 +40,18 @@ You can read the complete reference of the high level API here: maxdepth: 1 glob: --- -/autoapi/poliastro/[!c_]*/index -/autoapi/poliastro/czml/index -/autoapi/poliastro/constants/index +/autoapi/hapsira/[!c_]*/index +/autoapi/hapsira/czml/index +/autoapi/hapsira/constants/index ``` ## Core API -The core API is a low level layer that contains simple functions. -They are accelerated using Numba, a Just-in-Time compiler for Python, -to achieve good performance. However, they take raw NumPy arrays and Python scalars, -so they will not protect you from dimensional errors. +The core API is a low level layer that contains simple functions. They are accelerated using Numba, a Just-in-Time compiler for Python, to achieve good performance. However, they take raw NumPy arrays and Python scalars, so they will not protect you from dimensional errors. ```{toctree} --- maxdepth: 3 --- -/autoapi/poliastro/core/index +/autoapi/hapsira/core/index ``` diff --git a/docs/source/background.md b/docs/source/background.md index 8d9293214..d31376ab6 100644 --- a/docs/source/background.md +++ b/docs/source/background.md @@ -1,9 +1,6 @@ # Background -These notebooks contain more theoretical explanations -about the Astrodynamics concepts used in poliastro. -For further information, -have a look at the books we recommend in the {ref}`bibliography`. +These notebooks contain more theoretical explanations about the Astrodynamics concepts used in `hapsira`. For further information, have a look at the books we recommend in the {ref}`bibliography`. ```{eval-rst} .. nbgallery:: diff --git a/docs/source/bibliography.md b/docs/source/bibliography.md index 7f97131ce..b85799ad4 100644 --- a/docs/source/bibliography.md +++ b/docs/source/bibliography.md @@ -5,9 +5,7 @@ ## Books and papers -Several books and articles are mentioned across the documentation and -the source code itself. Here is the complete list in no particular -order: +Several books and articles are mentioned across the documentation and the source code itself. Here is the complete list in no particular order: - Vallado, David A., and Wayne D. McClain. *Fundamentals of astrodynamics and applications*. Vol. 12. Springer Science & @@ -27,13 +25,7 @@ order: ## Software -poliastro wouldn\'t be possible without the tremendous, often unpaid and -unrecognised effort of thousands of volunteers who devote a significant -part of their lives to provide the best software money can buy, for -free. This is a list of direct poliastro dependencies with a citeable -resource, which doesn\'t account for the fact that I have used and -enjoyed free (as in freedom) operative systems, compilers, text editors, -IDEs and browsers for my whole academic life. +`hapsira` wouldn\'t be possible without the tremendous, often unpaid and unrecognised effort of thousands of volunteers who devote a significant part of their lives to provide the best software money can buy, for free. This is a list of direct `hapsira` dependencies with a citeable resource, which doesn\'t account for the fact `hapsira`'s developers have used and enjoyed free (as in freedom) operative systems, compilers, text editors, IDEs and browsers. - Van Der Walt, Stefan, S. Chris Colbert, and Gael Varoquaux. \"The NumPy array: a structure for efficient numerical computation.\" @@ -47,5 +39,5 @@ IDEs and browsers for my whole academic life. interactive scientific computing.\" *Computing in Science & Engineering* 9, no. 3 (2007): 21-29. [DOI:10.1109/MCSE.2007.53](http://dx.doi.org/10.1109/MCSE.2007.53) -- The Astropy Collaboration, A. M. Price-Whelan, B. M. Sipőcz, H. M. Günther, P. L. Lim, S. M.Crawford, S. +- The Astropy Collaboration, A. M. Price-Whelan, B. M. Sipőcz, H. M. Günther, P. L. Lim, S. M.Crawford, S. Conseil, D. L. Shupe, M. W. Craig, N. Dencheva "The Astropy Project: Building an Open-science Project and Status of the v2.0 Core Package" The Astropy Collaboration et al AJ 156 123 (2018) [DOI:10.3847/1538-3881/aabc4f](https://iopscience.iop.org/article/10.3847/1538-3881/aabc4f) diff --git a/docs/source/changelog.md b/docs/source/changelog.md index 9ea021335..96ad62437 100644 --- a/docs/source/changelog.md +++ b/docs/source/changelog.md @@ -1,5 +1,36 @@ # What's new +## hapsira 0.18.0 - 2023-12-XX + +This release is a rebranded, but virtually identical fork of `poliastro`, `main` branch, as of the date of it being archived, October 14 2023. All noteworthy changes listed here were merged into `poliastro` after its last official release, `0.17.0`. + +- FEATURE: New plotters architecture with backend support, see [poliastro #1545](https://github.com/poliastro/poliastro/pull/1545) +- FEATURE: Python 3.11 support, CI tests enabled and passing, see [poliastro #1590](https://github.com/poliastro/poliastro/pull/1590) +- FEATURE: Added `cr3bp_char_quant` and its tests, see [poliastro #1570](https://github.com/poliastro/poliastro/pull/1570) +- FEATURE: Update_1_cr3bp_dj, see [poliastro #1490](https://github.com/poliastro/poliastro/pull/1490) +- FEATURE: Less strict version requirements on dependencies +- FEATURE: Added GM of various moons and mean distances of multiple systems, see [poliastro #1567](https://github.com/poliastro/poliastro/pull/1567) +- DOCS: Add offline-friendly formats to Read the Docs, see [poliastro #1549](https://github.com/poliastro/poliastro/pull/1549) +- DOCS: Modernize `README.md`, see [poliastro #1543](https://github.com/poliastro/poliastro/pull/1543) +- FIX: Docstring for hyperbolic to mean anomaly, see [poliastro #1608](https://github.com/poliastro/poliastro/pull/1608) +- FIX: `Orbit.to_ephem` producing incorrect ephemeris time, see [poliastro #1583](https://github.com/poliastro/poliastro/pull/1583) +- FIX: Update `change_ecc_inc.py` to allow for incl. reduction, see [poliastro #1579](https://github.com/poliastro/poliastro/pull/1579) +- FIX: Unit of h_vec in cross product calculation, see [poliastro #1576](https://github.com/poliastro/poliastro/pull/1576) +- FIX: Github repo language classification, see [poliastro #1571](https://github.com/poliastro/poliastro/pull/1571) +- FIX: Add missing test dependency `tox`, see [poliastro #1555](https://github.com/poliastro/poliastro/pull/1555) +- FIX: `pylint#2910` via workaround, ignore not an iterable warning on `numba.prange`, see [poliastro #1553](https://github.com/poliastro/poliastro/pull/1553) +- FIX: Pylint invalid-all-object / E0604 in propagators, see [poliastro #1552](https://github.com/poliastro/poliastro/pull/1552) +- FIX: Remove weird duplicated paragraph from changelog, see [poliastro #1551](https://github.com/poliastro/poliastro/pull/1551) +- FIX: Spheroid location, see [poliastro #1547](https://github.com/poliastro/poliastro/pull/1547) +- DEV: Remove upper bound on requires-python, see [poliastro #1588](https://github.com/poliastro/poliastro/pull/1588) +- DEV: Use `numpy.testing.assert_allclose` with small relative tolerance, see [poliastro #1587](https://github.com/poliastro/poliastro/pull/1587) +- DEV: Use Read the Docs action v1, see [poliastro #1566](https://github.com/poliastro/poliastro/pull/1566) +- DEV: Remove twobody decorators, see [poliastro #1557](https://github.com/poliastro/poliastro/pull/1557) +- DEV: Refactor build ephem interpolant, see [poliastro #1548](https://github.com/poliastro/poliastro/pull/1548) +- DEV: `ss_*` to `orb_*`, see [poliastro #1541](https://github.com/poliastro/poliastro/pull/1541) and [poliastro #1542](https://github.com/poliastro/poliastro/pull/1542) +- DEV: Rename notebooks to `.myst.md`, see [poliastro #1540](https://github.com/poliastro/poliastro/pull/1540) +- DEV: Black code formatting + ## poliastro 0.17.0 - 2022-07-10 ### Highlights diff --git a/docs/source/conf.py b/docs/source/conf.py index bf0f9c098..244d5dae9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# poliastro documentation build configuration file. +# hapsira documentation build configuration file. # # This file is execfile()d with the current directory set to its # containing dir. @@ -32,11 +32,13 @@ ] # GitHub role config -github_default_org_project = ("poliastro", "poliastro") +github_default_org_project = ("pleiszenburg", "hapsira") # MathJax config # See https://github.com/spatialaudio/nbsphinx/issues/572#issuecomment-853389268 -mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML" +mathjax_path = ( + "https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML" +) mathjax2_config = { "tex2jax": { "inlineMath": [["$", "$"], ["\\(", "\\)"]], @@ -51,8 +53,8 @@ "substitution", ] myst_substitutions = { - "Ephem": "{py:class}`~poliastro.ephem.Ephem`", - "Orbit": "{py:class}`~poliastro.twobody.orbit.scalar.Orbit`", + "Ephem": "{py:class}`~hapsira.ephem.Ephem`", + "Orbit": "{py:class}`~hapsira.twobody.orbit.scalar.Orbit`", } # Hoverxref Extension @@ -84,8 +86,8 @@ ".md": "markdown", } -project = "poliastro" -copyright = "2013, Juan Luis Cano Rodríguez and the poliastro development team" +project = "hapsira" +copyright = "2023 Sebastian M. Ernst" project_ver = version(project) version = ".".join(project_ver.split(".")[:2]) @@ -110,7 +112,7 @@ # Warning suppresses suppress_warnings = ["image.nonlocal_uri"] -if os.environ.get("POLIASTRO_SKIP_NOTEBOOKS") == "True": +if os.environ.get("HAPSIRA_SKIP_NOTEBOOKS") == "True": nbsphinx_execute = "never" suppress_warnings.append("nbsphinx.thumbnail") else: @@ -122,30 +124,34 @@ html_context = { "sidebar_external_links_caption": "Links", "sidebar_external_links": [ - ( - ' Blog', - "https://www.poliastro.space", - ), + # ( + # ' Blog', + # "https://www.hapsira.space", + # ), ( ' Source code', - "https://github.com/poliastro/poliastro", + "https://github.com/pleiszenburg/hapsira", ), ( ' Issue tracker', - "https://github.com/poliastro/poliastro/issues", + "https://github.com/pleiszenburg/hapsira/issues", ), ( ' Mailing list', - "https://groups.io/g/poliastro-dev", + "https://groups.io/g/hapsira-dev", ), ( ' Chat', - "http://chat.poliastro.space", + "https://matrix.to/#/#hapsira:matrix.org", ), ( - ' Citation', - "https://doi.org/10.5281/zenodo.593610", - ), + ' pleiszenburg.de', + "https://www.pleiszenburg.de/", + ) + # ( + # ' Citation', + # "https://doi.org/10.5281/zenodo.593610", + # ), ], } html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] @@ -156,7 +162,7 @@ # Thumbnail selection for nbsphinx gallery nbsphinx_thumbnails = { - "examples/going-to-mars-with-python-using-poliastro": "_static/thumbnails/going_to_mars_thumbnail.png", + "examples/going-to-mars-with-python-using-hapsira": "_static/thumbnails/going_to_mars_thumbnail.png", "examples/plotting-in-3D": "_static/thumbnails/3d_plotting_thumbnail.png", "examples/propagation-using-cowells-formulation": "_static/thumbnails/cowell_thumbnail.png", "examples/czml-tutorial": "_static/thumbnails/cesium_thumbnail.png", @@ -186,7 +192,7 @@ "*_compat*", # To avoid WARNING: more than one target found for cross-reference '__class__' ] -exclude_patterns.extend(["autoapi/index.rst", "autoapi/poliastro/index.rst"]) +exclude_patterns.extend(["autoapi/index.rst", "autoapi/hapsira/index.rst"]) # Ignore sphinx-autoapi warnings on reimported objects # See https://github.com/readthedocs/sphinx-autoapi/issues/285 diff --git a/docs/source/examples/analyzing-NEOs.myst.md b/docs/source/examples/analyzing-NEOs.myst.md index efac213e9..33e5edbc5 100644 --- a/docs/source/examples/analyzing-NEOs.myst.md +++ b/docs/source/examples/analyzing-NEOs.myst.md @@ -23,10 +23,10 @@ And what does "near" exactly mean? In terms of orbital elements, asteroids and c ```{code-cell} ipython3 from astropy import time -from poliastro.bodies import Earth -from poliastro.frames import Planes -from poliastro.plotting import OrbitPlotter -from poliastro.twobody.orbit import Orbit +from hapsira.bodies import Earth +from hapsira.frames import Planes +from hapsira.plotting import OrbitPlotter +from hapsira.twobody.orbit import Orbit ``` ## Small Body Database (SBDB) diff --git a/docs/source/examples/analyzing-the-parker-solar-probe-flybys.myst.md b/docs/source/examples/analyzing-the-parker-solar-probe-flybys.myst.md index 6edd99353..d9cf1e464 100644 --- a/docs/source/examples/analyzing-the-parker-solar-probe-flybys.myst.md +++ b/docs/source/examples/analyzing-the-parker-solar-probe-flybys.myst.md @@ -27,7 +27,7 @@ T_ref ``` ```{code-cell} ipython3 -from poliastro.bodies import Earth, Sun, Venus +from hapsira.bodies import Earth, Sun, Venus ``` ```{code-cell} ipython3 @@ -56,8 +56,8 @@ energy_ref ```{code-cell} ipython3 from astropy.time import Time -from poliastro.ephem import Ephem -from poliastro.util import norm +from hapsira.ephem import Ephem +from hapsira.util import norm ``` ```{code-cell} ipython3 @@ -100,7 +100,7 @@ tof = flyby_1_time - d_launch ``` ```{code-cell} ipython3 -from poliastro import iod +from hapsira import iod ``` ```{code-cell} ipython3 @@ -121,10 +121,10 @@ norm(v1_pre) ## 3. Flyby #1 around Venus -We compute a flyby using poliastro with the default value of the entry angle, just to discover that the results do not match what we expected: +We compute a flyby using hapsira with the default value of the entry angle, just to discover that the results do not match what we expected: ```{code-cell} ipython3 -from poliastro.threebody.flybys import compute_flyby +from hapsira.threebody.flybys import compute_flyby ``` ```{code-cell} ipython3 @@ -153,7 +153,7 @@ norm(V_2_v_) Now we will try to find the value of $\theta$ that satisfies our requirements: ```{code-cell} ipython3 -from poliastro.twobody import Orbit +from hapsira.twobody import Orbit ``` ```{code-cell} ipython3 @@ -232,7 +232,7 @@ orb_1_b ``` ```{code-cell} ipython3 -from poliastro.frames import Planes +from hapsira.frames import Planes ``` ```{code-cell} ipython3 @@ -258,7 +258,7 @@ And, finally, we plot the solution: ```{code-cell} ipython3 :tags: [nbsphinx-thumbnail] -from poliastro.plotting import OrbitPlotter +from hapsira.plotting import OrbitPlotter frame = OrbitPlotter(plane=Planes.EARTH_ECLIPTIC) diff --git a/docs/source/examples/atmospheric-models.myst.md b/docs/source/examples/atmospheric-models.myst.md index 452a9c969..0ab78d705 100644 --- a/docs/source/examples/atmospheric-models.myst.md +++ b/docs/source/examples/atmospheric-models.myst.md @@ -29,7 +29,7 @@ Along history different models have been developed: * COESA 1976: up to 1000 km. * Jacchia-Roberts -Since some of them are implemented in `poliastro`, let us compare the differences among them: +Since some of them are implemented in `hapsira`, let us compare the differences among them: ```{code-cell} from astropy import units as u @@ -37,7 +37,7 @@ from astropy import units as u from matplotlib import pyplot as plt import numpy as np -from poliastro.earth.atmosphere import COESA62, COESA76 +from hapsira.earth.atmosphere import COESA62, COESA76 ``` ## Comparing coesa62 and coesa76 diff --git a/docs/source/examples/catch-that-asteroid.myst.md b/docs/source/examples/catch-that-asteroid.myst.md index 27d2d4a21..a2da06e7a 100644 --- a/docs/source/examples/catch-that-asteroid.myst.md +++ b/docs/source/examples/catch-that-asteroid.myst.md @@ -41,13 +41,13 @@ from astropy.coordinates import solar_system_ephemeris solar_system_ephemeris.set("jpl") -from poliastro.bodies import Sun, Earth, Moon -from poliastro.ephem import Ephem -from poliastro.frames import Planes -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.misc import plot_solar_system -from poliastro.twobody import Orbit -from poliastro.util import norm, time_range +from hapsira.bodies import Sun, Earth, Moon +from hapsira.ephem import Ephem +from hapsira.frames import Planes +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.misc import plot_solar_system +from hapsira.twobody import Orbit +from hapsira.util import norm, time_range EPOCH = Time("2017-09-01 12:05:50", scale="tdb") C_FLORENCE = "#000" diff --git a/docs/source/examples/comparing-hohmann-and-bielliptic-transfers.myst.md b/docs/source/examples/comparing-hohmann-and-bielliptic-transfers.myst.md index f95b8186e..c1b909995 100644 --- a/docs/source/examples/comparing-hohmann-and-bielliptic-transfers.myst.md +++ b/docs/source/examples/comparing-hohmann-and-bielliptic-transfers.myst.md @@ -21,9 +21,9 @@ import numpy as np from mpl_toolkits.axes_grid1.inset_locator import mark_inset, zoomed_inset_axes -from poliastro.bodies import Earth -from poliastro.maneuver import Maneuver -from poliastro.twobody import Orbit +from hapsira.bodies import Earth +from hapsira.maneuver import Maneuver +from hapsira.twobody import Orbit ``` ```{code-cell} ipython3 diff --git a/docs/source/examples/customising-static-orbit-plots.myst.md b/docs/source/examples/customising-static-orbit-plots.myst.md index cc75723ef..ee08a6b92 100644 --- a/docs/source/examples/customising-static-orbit-plots.myst.md +++ b/docs/source/examples/customising-static-orbit-plots.myst.md @@ -24,11 +24,11 @@ from astropy.time import Time from matplotlib import pyplot as plt -from poliastro.bodies import Earth, Mars, Jupiter, Sun -from poliastro.frames import Planes -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import Matplotlib2D -from poliastro.twobody import Orbit +from hapsira.bodies import Earth, Mars, Jupiter, Sun +from hapsira.frames import Planes +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import Matplotlib2D +from hapsira.twobody import Orbit ``` ```{code-cell} ipython3 diff --git a/docs/source/examples/czml-tutorial.myst.md b/docs/source/examples/czml-tutorial.myst.md index 5a9cdc233..b179b18a2 100644 --- a/docs/source/examples/czml-tutorial.myst.md +++ b/docs/source/examples/czml-tutorial.myst.md @@ -19,22 +19,22 @@ Poliastro allows users to easily convert orbital data to CZML, a JSON format pri ## Dependencies -You will only need poliastro (obviously) and czml3, a library for easily creating and using CZML packets: +You will only need hapsira (obviously) and czml3, a library for easily creating and using CZML packets: -``pip install poliastro czml3`` +``pip install hapsira czml3`` +++ ## Our first example: The Molniya orbit -We'll start off by using one of the readily usable poliastro examples. Of course, you can use any poliastro ``Orbit`` object: +We'll start off by using one of the readily usable hapsira examples. Of course, you can use any hapsira ``Orbit`` object: ```{code-cell} -from poliastro.czml.extract_czml import CZMLExtractor +from hapsira.czml.extract_czml import CZMLExtractor ``` ```{code-cell} -from poliastro.examples import molniya +from hapsira.examples import molniya ``` To initialize the extractor, you'll only need the starting and ending epoch of the time period you wish to visualize and the number of sample points. The larger the sample point size, the more accurate the trajectory and the bigger your packets. Finding that sweet spot between reasonable package size and visual accuracy depends on the specific orbit. Generally, you'll need a bigger sample for faster satellites. You could also "break" your orbit into different parts and define the sample size individually (for example, this could be useful when the satellite accelerates within a certain time interval). @@ -101,7 +101,7 @@ extractor.add_orbit( ) ``` -You can now export the extractor packets by simply calling ``extractor.packets`` and load it to the Cesium app as described [here](https://github.com/poliastro/cesium-app): +You can now export the extractor packets by simply calling ``extractor.packets`` and load it to the Cesium app as described [here](https://github.com/hapsira/cesium-app): ```{raw-cell} >>> extractor.packets @@ -121,10 +121,10 @@ You can now export the extractor packets by simply calling ``extractor.packets`` ## Landing on Mars -You can customize the attractor of your orbit by defining any valid ellipsoid with the help of poliastro's ``Body`` class. For your convenience, poliastro offers a pre-defined list of all the major planetary bodies of the solar system so you can simply import them: +You can customize the attractor of your orbit by defining any valid ellipsoid with the help of hapsira's ``Body`` class. For your convenience, hapsira offers a pre-defined list of all the major planetary bodies of the solar system so you can simply import them: ```{code-cell} -from poliastro.bodies import Mars +from hapsira.bodies import Mars ``` Of course, when defining a new attractor you want to be able to identify something other than it's shape. For this reason, the extractor allows you to easily set the UV map by simply providing a valid URL: diff --git a/docs/source/examples/detecting-events.myst.md b/docs/source/examples/detecting-events.myst.md index 31db2b729..de3a48447 100644 --- a/docs/source/examples/detecting-events.myst.md +++ b/docs/source/examples/detecting-events.myst.md @@ -23,7 +23,7 @@ critical scientific information and help us formulate efficient space strategies the potentially disastrous ones, like satellite collisions, could help us take further steps to prevent such contingencies. -This notebook gives a glimpse of `poliastro`'s event detection capabilities. The procedure to track +This notebook gives a glimpse of `hapsira`'s event detection capabilities. The procedure to track an event during an orbit's propagation is fairly simple: 1. Instantiate the desired event class/classes. @@ -44,29 +44,29 @@ from astropy.coordinates import ( get_body_barycentric_posvel, ) -from poliastro.bodies import Earth, Sun +from hapsira.bodies import Earth, Sun -from poliastro.twobody.events import ( +from hapsira.twobody.events import ( AltitudeCrossEvent, LatitudeCrossEvent, NodeCrossEvent, PenumbraEvent, UmbraEvent, ) -from poliastro.twobody.orbit import Orbit -from poliastro.twobody.propagation import CowellPropagator -from poliastro.twobody.sampling import EpochsArray +from hapsira.twobody.orbit import Orbit +from hapsira.twobody.propagation import CowellPropagator +from hapsira.twobody.sampling import EpochsArray -from poliastro.util import time_range +from hapsira.util import time_range ``` ## Altitude Crossing Event Let's define some natural perturbation conditions for our orbit so that its altitude decreases with time. ```{code-cell} -from poliastro.constants import H0_earth, rho0_earth -from poliastro.core.perturbations import atmospheric_drag_exponential -from poliastro.core.propagation import func_twobody +from hapsira.constants import H0_earth, rho0_earth +from hapsira.core.perturbations import atmospheric_drag_exponential +from hapsira.core.propagation import func_twobody R = Earth.R.to_value(u.km) @@ -158,7 +158,7 @@ print( Let's plot the latitude varying with time: ```{code-cell} -from poliastro.core.spheroid_location import cartesian_to_ellipsoidal +from hapsira.core.spheroid_location import cartesian_to_ellipsoidal latitudes = [] for r in rr: @@ -179,9 +179,9 @@ Since the attractor is `Earth`, we could use `GroundtrackPlotter` for showing th orbit on Earth. ```{code-cell} -from poliastro.earth import EarthSatellite -from poliastro.earth.plotting import GroundtrackPlotter -from poliastro.plotting import OrbitPlotter +from hapsira.earth import EarthSatellite +from hapsira.earth.plotting import GroundtrackPlotter +from hapsira.plotting import OrbitPlotter es = EarthSatellite(orbit, None) @@ -221,7 +221,7 @@ Users can detect umbra/penumbra crossings using the `UmbraEvent` and `PenumbraEv respectively. As seen from the above examples, the procedure doesn't change much. ```{code-cell} -from poliastro.core.events import eclipse_function +from hapsira.core.events import eclipse_function attractor = Earth tof = 2 * u.d diff --git a/docs/source/examples/exploring-the-new-horizons-launch.myst.md b/docs/source/examples/exploring-the-new-horizons-launch.myst.md index e0971018f..d557acf96 100644 --- a/docs/source/examples/exploring-the-new-horizons-launch.myst.md +++ b/docs/source/examples/exploring-the-new-horizons-launch.myst.md @@ -19,15 +19,15 @@ Main data source: Guo & Farquhar "New Horizons Mission Design" http://www.boulde from astropy import time from astropy import units as u -from poliastro import iod - -from poliastro.bodies import Sun, Earth, Jupiter -from poliastro.ephem import Ephem -from poliastro.frames import Planes -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import Matplotlib2D -from poliastro.twobody import Orbit -from poliastro.util import norm +from hapsira import iod + +from hapsira.bodies import Sun, Earth, Jupiter +from hapsira.ephem import Ephem +from hapsira.frames import Planes +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import Matplotlib2D +from hapsira.twobody import Orbit +from hapsira.util import norm ``` ## Parking orbit diff --git a/docs/source/examples/generating-orbit-groundtracks.myst.md b/docs/source/examples/generating-orbit-groundtracks.myst.md index c297894d9..79ec59a70 100644 --- a/docs/source/examples/generating-orbit-groundtracks.myst.md +++ b/docs/source/examples/generating-orbit-groundtracks.myst.md @@ -17,7 +17,7 @@ kernelspec: By definition, a groundtrack is just the projection of the position left by a satellite over its attractor. They are usually applied to Earth orbiting -spacecraft and thus, have been implemented within the `poliastro.earth.plotting` +spacecraft and thus, have been implemented within the `hapsira.earth.plotting` sub-package. Something interesting about these kind of figures is that they take the Earth's rotation into account. @@ -25,7 +25,7 @@ Therefore, it is possible to predict over which locations in the planet will the spacecraft be within the next hours or days. In this notebook, we will show all the possibilities that the -`GrountrackPlotter` class offers to poliastro's users. Let us start by importing +`GrountrackPlotter` class offers to hapsira's users. Let us start by importing some useful modules! ```{code-cell} ipython3 @@ -33,10 +33,10 @@ some useful modules! from astropy import units as u # Earth focused modules, ISS example orbit and time span generator -from poliastro.earth import EarthSatellite -from poliastro.earth.plotting import GroundtrackPlotter -from poliastro.examples import iss -from poliastro.util import time_range +from hapsira.earth import EarthSatellite +from hapsira.earth.plotting import GroundtrackPlotter +from hapsira.examples import iss +from hapsira.util import time_range ``` ## EarthSatellite instance and desired time span diff --git a/docs/source/examples/going-to-jupiter-with-python-using-jupyter-and-poliastro.myst.md b/docs/source/examples/going-to-jupiter-with-python-using-jupyter-and-poliastro.myst.md index e1022976f..61c73e3b0 100644 --- a/docs/source/examples/going-to-jupiter-with-python-using-jupyter-and-poliastro.myst.md +++ b/docs/source/examples/going-to-jupiter-with-python-using-jupyter-and-poliastro.myst.md @@ -11,13 +11,13 @@ kernelspec: name: python3 --- -# Going to Jupiter with Python using Jupyter and poliastro +# Going to Jupiter with Python using Jupyter and hapsira Let us recreate with real data the [Juno NASSA Mission](https://www.jpl.nasa.gov/news/press_kits/juno/overview/). The main objectives of Juno spacecraft is to study the Jupiter planet: how was its formation, its evolution along time, atmospheric characteristics... ![Juno Image](juno_spacecraft.png) -First of all, let us import some of our favourite Python packages: numpy, astropy and poliastro! +First of all, let us import some of our favourite Python packages: numpy, astropy and hapsira! ```{code-cell} ipython3 from astropy import units as u @@ -28,16 +28,16 @@ solar_system_ephemeris.set("jpl") import numpy as np -from poliastro.bodies import Sun, Earth, Jupiter -from poliastro.ephem import Ephem -from poliastro.frames import Planes -from poliastro.maneuver import Maneuver -from poliastro.plotting import OrbitPlotter -from poliastro.twobody import Orbit -from poliastro.util import norm, time_range +from hapsira.bodies import Sun, Earth, Jupiter +from hapsira.ephem import Ephem +from hapsira.frames import Planes +from hapsira.maneuver import Maneuver +from hapsira.plotting import OrbitPlotter +from hapsira.twobody import Orbit +from hapsira.util import norm, time_range ``` -All the data for Juno's mission is sorted [here](https://github.com/poliastro/poliastro/wiki/EuroPython:-Per-Python-ad-Astra). The main maneuvers that the spacecraft will perform are listed down: +All the data for Juno's mission is sorted [here](https://github.com/hapsira/hapsira/wiki/EuroPython:-Per-Python-ad-Astra). The main maneuvers that the spacecraft will perform are listed down: * Inner cruise phase 1: This will set Juno in a new orbit around the sun. * Inner cruise phase 2: Fly-by around Earth. Gravity assist is performed. @@ -178,7 +178,7 @@ ic3, orb_target = ic2_end.apply_maneuver(man_jupiter, intermediate=True) ic3_end = ic3.propagate(date_arrival) ``` -Finally, we can plot all the different phases of the mission. This shows the whole power of the *poliastro* package, since a beautiful image is created showing the whole maneuvering process: +Finally, we can plot all the different phases of the mission. This shows the whole power of the *hapsira* package, since a beautiful image is created showing the whole maneuvering process: ```{code-cell} ipython3 :tags: [nbsphinx-thumbnail] diff --git a/docs/source/examples/going-to-mars-with-python-using-poliastro.myst.md b/docs/source/examples/going-to-mars-with-python-using-poliastro.myst.md index a07731700..676c8ed7a 100644 --- a/docs/source/examples/going-to-mars-with-python-using-poliastro.myst.md +++ b/docs/source/examples/going-to-mars-with-python-using-poliastro.myst.md @@ -11,9 +11,9 @@ kernelspec: name: python3 --- -# Going to Mars with Python using poliastro +# Going to Mars with Python using hapsira -This is an example on how to use [poliastro](https://github.com/poliastro/poliastro), a little library I've been working on to use in my Astrodynamics lessons. It features conversion between **classical orbital elements** and position vectors, propagation of **Keplerian orbits**, initial orbit determination using the solution of the **Lambert's problem** and **orbit plotting**. +This is an example on how to use [hapsira](https://github.com/hapsira/hapsira), a little library I've been working on to use in my Astrodynamics lessons. It features conversion between **classical orbital elements** and position vectors, propagation of **Keplerian orbits**, initial orbit determination using the solution of the **Lambert's problem** and **orbit plotting**. In this example we're going to draw the trajectory of the mission [Mars Science Laboratory (MSL)](http://mars.jpl.nasa.gov/msl/), which carried the rover Curiosity to the surface of Mars in a period of something less than 9 months. @@ -21,7 +21,7 @@ In this example we're going to draw the trajectory of the mission [Mars Science +++ -First of all, we import the necessary modules. Apart from poliastro we will make use of astropy to deal with physical units and time definitions and jplephem to compute the positions and velocities of the planets: +First of all, we import the necessary modules. Apart from hapsira we will make use of astropy to deal with physical units and time definitions and jplephem to compute the positions and velocities of the planets: ```{code-cell} ipython3 from astropy import units as u @@ -29,12 +29,12 @@ from astropy import time import numpy as np -from poliastro import iod -from poliastro.bodies import Earth, Mars, Sun -from poliastro.ephem import Ephem -from poliastro.maneuver import Maneuver -from poliastro.twobody import Orbit -from poliastro.util import time_range +from hapsira import iod +from hapsira.bodies import Earth, Mars, Sun +from hapsira.ephem import Ephem +from hapsira.maneuver import Maneuver +from hapsira.twobody import Orbit +from hapsira.util import time_range ``` We need a binary file from NASA called *SPICE kernel* to compute the position and velocities of the planets. Astropy downloads it for us: @@ -53,7 +53,7 @@ date_launch = time.Time("2011-11-26 15:02", scale="utc").tdb date_arrival = time.Time("2012-08-06 05:17", scale="utc").tdb ``` -To compute the transfer orbit, we have the useful function `lambert` : according to a theorem with the same name, *the transfer orbit between two points in space only depends on those two points and the time it takes to go from one to the other*. We could make use of the raw algorithms available in `poliastro.iod` for solving this but working with the `poliastro.maneuvers` is even easier! +To compute the transfer orbit, we have the useful function `lambert` : according to a theorem with the same name, *the transfer orbit between two points in space only depends on those two points and the time it takes to go from one to the other*. We could make use of the raw algorithms available in `hapsira.iod` for solving this but working with the `hapsira.maneuvers` is even easier! We just need to create the orbits for each one of the planets at the specific departure and arrival dates: @@ -81,8 +81,8 @@ orb_trans, orb_target = orb_earth.apply_maneuver(man_lambert, intermediate=True) Let's plot this transfer orbit in 3D! ```{code-cell} ipython3 -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import Plotly3D +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import Plotly3D ``` ```{code-cell} ipython3 diff --git a/docs/source/examples/hohmann-bielliptic-transfers.png b/docs/source/examples/hohmann-bielliptic-transfers.png index e3a8473dd..afa382eae 100644 Binary files a/docs/source/examples/hohmann-bielliptic-transfers.png and b/docs/source/examples/hohmann-bielliptic-transfers.png differ diff --git a/docs/source/examples/hohmann.png b/docs/source/examples/hohmann.png index d85b92650..b78795410 100644 Binary files a/docs/source/examples/hohmann.png and b/docs/source/examples/hohmann.png differ diff --git a/docs/source/examples/loading-OMM-and-TLE-satellite-data.myst.md b/docs/source/examples/loading-OMM-and-TLE-satellite-data.myst.md index 6cccc4987..a4778698e 100644 --- a/docs/source/examples/loading-OMM-and-TLE-satellite-data.myst.md +++ b/docs/source/examples/loading-OMM-and-TLE-satellite-data.myst.md @@ -28,7 +28,7 @@ kernelspec: +++ -However, it turns out that GP data in general, and TLEs in particular, are poorly understood even by professionals ([[1]](https://www.linkedin.com/posts/tom-johnson-32333a2_flawed-data-activity-6825845118990381056-yJX7), [[2]](https://twitter.com/flightclubio/status/1435303066085982209), [[3]](https://github.com/poliastro/poliastro/issues/1185)). The core issue is that TLEs and OMMs contain _Brouwer mean elements_, which **cannot be directly translated to osculating elements**. +However, it turns out that GP data in general, and TLEs in particular, are poorly understood even by professionals ([[1]](https://www.linkedin.com/posts/tom-johnson-32333a2_flawed-data-activity-6825845118990381056-yJX7), [[2]](https://twitter.com/flightclubio/status/1435303066085982209), [[3]](https://github.com/hapsira/hapsira/issues/1185)). The core issue is that TLEs and OMMs contain _Brouwer mean elements_, which **cannot be directly translated to osculating elements**. From "Spacetrack Report #3": @@ -58,7 +58,7 @@ Therefore, the **correct** way of using GP data is: As explained in the [Orbit Mean-Elements Messages (OMMs) support assessment](https://opensatcom.org/2020/12/28/omm-assessment-sgp4-benchmarks/) deliverable of OpenSatCom, OMM input/output support in open source libraries is somewhat scattered. Luckily, [python-sgp4](https://pypi.org/project/sgp4/) supports reading OMM in CSV and XML format, as well as usual TLE and 3LE formats. On the other hand, Astropy has accurate transformations from TEME to other reference frames. ```{code-cell} ipython3 -# From https://github.com/poliastro/poliastro/blob/main/contrib/satgpio.py +# From https://github.com/hapsira/hapsira/blob/main/contrib/satgpio.py """ Author: Juan Luis Cano Rodríguez @@ -203,7 +203,7 @@ import numpy as np from astropy.coordinates import CartesianRepresentation, CartesianDifferential -from poliastro.util import time_range +from hapsira.util import time_range ``` ```{code-cell} ipython3 @@ -223,15 +223,15 @@ CartesianRepresentation(rs << u.km, xyz_axis=-1) CartesianDifferential(vs << (u.km / u.s), xyz_axis=-1) ``` -Mixing all together, and leveraging poliastro `Ephem` objects, we can compute ephemerides from GP orbital data: +Mixing all together, and leveraging hapsira `Ephem` objects, we can compute ephemerides from GP orbital data: ```{code-cell} ipython3 from warnings import warn from astropy.coordinates import TEME, GCRS -from poliastro.ephem import Ephem -from poliastro.frames import Planes +from hapsira.ephem import Ephem +from hapsira.frames import Planes def ephem_from_gp(sat, times): @@ -271,9 +271,9 @@ iss_ephem And plot it! ```{code-cell} ipython3 -from poliastro.bodies import Earth -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import Plotly3D +from hapsira.bodies import Earth +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import Plotly3D plotter = OrbitPlotter(backend=Plotly3D()) plotter.set_attractor(Earth) diff --git a/docs/source/examples/logo_text.png b/docs/source/examples/logo_text.png index 2538fa5c0..10f5801ea 100644 Binary files a/docs/source/examples/logo_text.png and b/docs/source/examples/logo_text.png differ diff --git a/docs/source/examples/multirevolutions-solution-in-lamberts-problem.myst.md b/docs/source/examples/multirevolutions-solution-in-lamberts-problem.myst.md index cc12545ad..f4feae94d 100644 --- a/docs/source/examples/multirevolutions-solution-in-lamberts-problem.myst.md +++ b/docs/source/examples/multirevolutions-solution-in-lamberts-problem.myst.md @@ -13,7 +13,7 @@ kernelspec: # Multiple revolutions on Lambert's problem -After the implementation of Izzo's algorithm in *poliastro*, it is possible to solve the Lambert's problem within the multi-revolution scenario. Before introducing the usage of this feature, let us remember what is the Lambert's problem and explain some of the misconceptions behind the problem. +After the implementation of Izzo's algorithm in *hapsira*, it is possible to solve the Lambert's problem within the multi-revolution scenario. Before introducing the usage of this feature, let us remember what is the Lambert's problem and explain some of the misconceptions behind the problem. +++ @@ -54,7 +54,7 @@ $$ \Delta \theta = \arccos{\left(\frac{\vec{r_0} \cdot \vec{r}}{r_0 \cdot r}\right)} $$ -The `arccos` function will return always the shortest angle between both position vectors. Therefore, what happens with transfer angles $180 < \Delta \theta < 360$? In this case, a boolean is required to correct the value of the transfer angle. In `poliastro` this variable is named `is_prograde` and it controls the value of the transfer angle such that: +The `arccos` function will return always the shortest angle between both position vectors. Therefore, what happens with transfer angles $180 < \Delta \theta < 360$? In this case, a boolean is required to correct the value of the transfer angle. In `hapsira` this variable is named `is_prograde` and it controls the value of the transfer angle such that: * When `is_prograde=True`, solution orbit has an inclination less than $\text{inc} < 180$ degrees (prograde orbit). * Otherwise, when `is_prograde=False`, solution orbit inclination has $\text{inc} > 180$ degrees (retrograde orbit.) @@ -98,18 +98,18 @@ The minimum energy transfer orbit is used as a reference point by Lambert's prob +++ -## Exploring the single and multi-revolution scenarios using poliastro +## Exploring the single and multi-revolution scenarios using hapsira -Now, let us present how to use poliastro to solve for the multiple revolutions scenario. The idea is to compute all possible transfer orbits between Earth and Mars. Therefore, we need first to compute the initial position of the Earth and the final position of times for a given desired amount of time. +Now, let us present how to use hapsira to solve for the multiple revolutions scenario. The idea is to compute all possible transfer orbits between Earth and Mars. Therefore, we need first to compute the initial position of the Earth and the final position of times for a given desired amount of time. ```{code-cell} ipython3 from astropy import units as u from astropy.time import Time -from poliastro.bodies import Sun, Earth, Mars -from poliastro.ephem import Ephem -from poliastro.twobody import Orbit -from poliastro.util import time_range +from hapsira.bodies import Sun, Earth, Mars +from hapsira.ephem import Ephem +from hapsira.twobody import Orbit +from hapsira.util import time_range ``` Computing the initial and final position orbits for each planet: @@ -148,7 +148,7 @@ colors_and_styles = [ We now define a function for solving all the possible solutions ```{code-cell} ipython3 -from poliastro.maneuver import Maneuver +from hapsira.maneuver import Maneuver def lambert_solution_orbits(orb_departure, orb_arrival, M): @@ -170,8 +170,8 @@ Finally, we can plot all the different scenarios from $M=0$ up to $M=2$ revoluti ```{code-cell} ipython3 from matplotlib import pyplot as plt -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import Matplotlib2D +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import Matplotlib2D ``` ```{code-cell} ipython3 diff --git a/docs/source/examples/natural-and-artificial-perturbations.myst.md b/docs/source/examples/natural-and-artificial-perturbations.myst.md index eff9d2f6f..0f80764f2 100644 --- a/docs/source/examples/natural-and-artificial-perturbations.myst.md +++ b/docs/source/examples/natural-and-artificial-perturbations.myst.md @@ -21,27 +21,27 @@ from astropy.coordinates import solar_system_ephemeris from astropy.time import Time, TimeDelta from astropy import units as u -from poliastro.bodies import Earth, Moon -from poliastro.constants import rho0_earth, H0_earth +from hapsira.bodies import Earth, Moon +from hapsira.constants import rho0_earth, H0_earth -from poliastro.core.elements import rv2coe -from poliastro.core.perturbations import ( +from hapsira.core.elements import rv2coe +from hapsira.core.perturbations import ( atmospheric_drag_exponential, third_body, J2_perturbation, ) -from poliastro.core.propagation import func_twobody -from poliastro.ephem import build_ephem_interpolant -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import Plotly3D -from poliastro.twobody import Orbit -from poliastro.twobody.propagation import CowellPropagator -from poliastro.twobody.sampling import EpochsArray -from poliastro.util import norm, time_range +from hapsira.core.propagation import func_twobody +from hapsira.ephem import build_ephem_interpolant +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import Plotly3D +from hapsira.twobody import Orbit +from hapsira.twobody.propagation import CowellPropagator +from hapsira.twobody.sampling import EpochsArray +from hapsira.util import norm, time_range ``` ## Atmospheric drag ## -The poliastro package now has several commonly used natural perturbations. One of them is atmospheric drag! See how one can monitor decay of the near-Earth orbit over time using our new module `poliastro.twobody.perturbations`! +The hapsira package now has several commonly used natural perturbations. One of them is atmospheric drag! See how one can monitor decay of the near-Earth orbit over time using our new module `hapsira.twobody.perturbations`! ```{code-cell} ipython3 R = Earth.R.to(u.km).value @@ -104,7 +104,7 @@ atmosphere model than the one in `atmospheric_drag` for these sorts of computations. ```{code-cell} ipython3 -from poliastro.twobody.events import LithobrakeEvent +from hapsira.twobody.events import LithobrakeEvent orbit = Orbit.circular( Earth, 230 * u.km, epoch=Time(0.0, format="jd", scale="tdb") @@ -161,7 +161,7 @@ rr, vv = orbit.to_ephem( ).rv() # This will be easier to compute when this is solved: -# https://github.com/poliastro/poliastro/issues/380 +# https://github.com/hapsira/hapsira/issues/380 raans = [ rv2coe(k, r, v)[3] for r, v in zip(rr.to_value(u.km), vv.to_value(u.km / u.s)) @@ -239,7 +239,7 @@ frame.plot_ephem(ephem, label="orbit influenced by Moon") Apart from natural perturbations, there are artificial thrusts aimed at intentional change of orbit parameters. One of such changes is simultaneous change of eccentricity and inclination: ```{code-cell} ipython3 -from poliastro.twobody.thrust import change_ecc_inc +from hapsira.twobody.thrust import change_ecc_inc ecc_0, ecc_f = 0.4, 0.0 a = 42164 # km diff --git a/docs/source/examples/plotting-in-3D.myst.md b/docs/source/examples/plotting-in-3D.myst.md index 98c5a30a1..97c67ac1d 100644 --- a/docs/source/examples/plotting-in-3D.myst.md +++ b/docs/source/examples/plotting-in-3D.myst.md @@ -16,12 +16,12 @@ kernelspec: ```{code-cell} ipython3 import numpy as np -from poliastro.bodies import Earth, Sun -from poliastro.constants import J2000 -from poliastro.examples import churi, iss, molniya -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import Plotly3D -from poliastro.twobody import Orbit +from hapsira.bodies import Earth, Sun +from hapsira.constants import J2000 +from hapsira.examples import churi, iss, molniya +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import Plotly3D +from hapsira.twobody import Orbit ``` ```{code-cell} ipython3 @@ -56,8 +56,8 @@ frame.show() ```{code-cell} ipython3 from astropy.time import Time -from poliastro.ephem import Ephem -from poliastro.util import time_range +from hapsira.ephem import Ephem +from hapsira.util import time_range ``` ```{code-cell} ipython3 diff --git a/docs/source/examples/porkchops-with-poliastro.myst.md b/docs/source/examples/porkchops-with-poliastro.myst.md index 1f8bfc707..005a34026 100644 --- a/docs/source/examples/porkchops-with-poliastro.myst.md +++ b/docs/source/examples/porkchops-with-poliastro.myst.md @@ -11,7 +11,7 @@ kernelspec: name: python3 --- -# Porkchops with poliastro +# Porkchops with hapsira Porkchops are also known as mission design curves since they show different parameters used to design the ballistic trajectories for the targetting problem such as: @@ -19,19 +19,19 @@ Porkchops are also known as mission design curves since they show different para * Launch energy (C3L) * Arrival velocity (VHP) -For the moment, poliastro is only capable of creating these mission plots between `poliastro.bodies` objects. However, it is intended for future versions to make it able for plotting porkchops between NEOs also. +For the moment, hapsira is only capable of creating these mission plots between `hapsira.bodies` objects. However, it is intended for future versions to make it able for plotting porkchops between NEOs also. +++ ## Basic modules -For creating a porkchop plot with poliastro, we need to import the `porkchop` function from the `poliastro.plotting.porkchop` module. Also, two `poliastro.bodies` are necessary for computing the targetting problem associated. Finally by making use of `time_range`, a very useful function available at `poliastro.utils` it is possible to define a span of launching and arrival dates for the problem: +For creating a porkchop plot with hapsira, we need to import the `porkchop` function from the `hapsira.plotting.porkchop` module. Also, two `hapsira.bodies` are necessary for computing the targetting problem associated. Finally by making use of `time_range`, a very useful function available at `hapsira.utils` it is possible to define a span of launching and arrival dates for the problem: ```{code-cell} from astropy import units as u -from poliastro.bodies import Earth, Mars -from poliastro.plotting.porkchop import PorkchopPlotter -from poliastro.util import time_range +from hapsira.bodies import Earth, Mars +from hapsira.plotting.porkchop import PorkchopPlotter +from hapsira.util import time_range launch_span = time_range("2005-04-30", end="2005-10-07") arrival_span = time_range("2005-11-16", end="2006-12-21") @@ -41,8 +41,8 @@ arrival_span = time_range("2005-11-16", end="2006-12-21") All that we must do is pass the two bodies, the two time spans and some extra plotting parameters realted to different information along the figure such us: -* If we want poliastro to plot time of flight lines: `tfl=True/False` -* If we want poliastro to plot arrival velocity: `vhp=True/False` +* If we want hapsira to plot time of flight lines: `tfl=True/False` +* If we want hapsira to plot arrival velocity: `vhp=True/False` * The maximum value for C3 to be ploted: `max_c3=45 * u.km**2 / u.s**2` (by default) ```{code-cell} diff --git a/docs/source/examples/propagation-using-cowells-formulation.myst.md b/docs/source/examples/propagation-using-cowells-formulation.myst.md index 1c104825e..74c87eb21 100644 --- a/docs/source/examples/propagation-using-cowells-formulation.myst.md +++ b/docs/source/examples/propagation-using-cowells-formulation.myst.md @@ -21,11 +21,11 @@ $$\ddot{\mathbb{r}} = -\frac{\mu}{|\mathbb{r}|^3} \mathbb{r} + \mathbb{a}_d$$ +++ -
For an in-depth exploration of this topic, still to be integrated in poliastro, check out [this Master thesis](https://github.com/Juanlu001/pfc-uc3m).
+
For an in-depth exploration of this topic, still to be integrated in hapsira, check out [this Master thesis](https://github.com/Juanlu001/pfc-uc3m).
+++ -
An earlier version of this notebook allowed for more flexibility and interactivity, but was considerably more complex. Future versions of poliastro and plotly might bring back part of that functionality, depending on user feedback. You can still download the older version [here](https://github.com/poliastro/poliastro/blob/0.8.x/docs/source/examples/Propagation%20using%20Cowell's%20formulation.ipynb).
+
An earlier version of this notebook allowed for more flexibility and interactivity, but was considerably more complex. Future versions of hapsira and plotly might bring back part of that functionality, depending on user feedback. You can still download the older version [here](https://github.com/hapsira/hapsira/blob/0.8.x/docs/source/examples/Propagation%20using%20Cowell's%20formulation.ipynb).
+++ @@ -39,15 +39,15 @@ from astropy import units as u import numpy as np -from poliastro.bodies import Earth -from poliastro.core.propagation import func_twobody -from poliastro.examples import iss -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import Plotly3D -from poliastro.twobody import Orbit -from poliastro.twobody.propagation import CowellPropagator -from poliastro.twobody.sampling import EpochsArray -from poliastro.util import norm +from hapsira.bodies import Earth +from hapsira.core.propagation import func_twobody +from hapsira.examples import iss +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import Plotly3D +from hapsira.twobody import Orbit +from hapsira.twobody.propagation import CowellPropagator +from hapsira.twobody.sampling import EpochsArray +from hapsira.util import norm ``` To provide an acceleration depending on an extra parameter, we can use **closures** like this one: diff --git a/docs/source/examples/revisiting-lamberts-problem-in-python.myst.md b/docs/source/examples/revisiting-lamberts-problem-in-python.myst.md index 843869960..d931ea226 100644 --- a/docs/source/examples/revisiting-lamberts-problem-in-python.myst.md +++ b/docs/source/examples/revisiting-lamberts-problem-in-python.myst.md @@ -13,7 +13,7 @@ kernelspec: # Revisiting Lambert's problem in Python -The Izzo algorithm to solve the Lambert problem is available in poliastro and was implemented from [this paper](https://arxiv.org/abs/1403.2705). +The Izzo algorithm to solve the Lambert problem is available in hapsira and was implemented from [this paper](https://arxiv.org/abs/1403.2705). ```{code-cell} from cycler import cycler @@ -21,8 +21,8 @@ from cycler import cycler from matplotlib import pyplot as plt import numpy as np -from poliastro.core import iod -from poliastro.iod import izzo +from hapsira.core import iod +from hapsira.iod import izzo ``` ## Part 1: Reproducing the original figure @@ -120,7 +120,7 @@ fig ```{code-cell} from astropy import units as u -from poliastro.bodies import Earth +from hapsira.bodies import Earth ``` ### Single revolution diff --git a/docs/source/examples/studying-hohmann-transfers.myst.md b/docs/source/examples/studying-hohmann-transfers.myst.md index bca013a8c..d70c22bc5 100644 --- a/docs/source/examples/studying-hohmann-transfers.myst.md +++ b/docs/source/examples/studying-hohmann-transfers.myst.md @@ -19,10 +19,10 @@ from astropy import units as u from matplotlib import pyplot as plt import numpy as np -from poliastro.bodies import Earth -from poliastro.maneuver import Maneuver -from poliastro.twobody import Orbit -from poliastro.util import norm +from hapsira.bodies import Earth +from hapsira.maneuver import Maneuver +from hapsira.twobody import Orbit +from hapsira.util import norm ``` ```{code-cell} ipython3 diff --git a/docs/source/examples/tisserand.myst.md b/docs/source/examples/tisserand.myst.md index 43280f8b5..9a9b2bf63 100644 --- a/docs/source/examples/tisserand.myst.md +++ b/docs/source/examples/tisserand.myst.md @@ -34,7 +34,7 @@ bodies for a variety of $V_{\infty}$ and $\alpha$, $\alpha$ being the pump angle * Phasing is not taken into account. That means only orbits are taken into account, not rendezvous between departure and target body. -Please, note that **poliastro solves `mean orbital elements` for Solar System bodies. Although their orbital parameters do not have great variations among time, planet orbits are assumed not to be perfectly circular or coplanar.** However, Tisserand figures are still useful for quick-design gravity assisted maneuvers. +Please, note that **hapsira solves `mean orbital elements` for Solar System bodies. Although their orbital parameters do not have great variations among time, planet orbits are assumed not to be perfectly circular or coplanar.** However, Tisserand figures are still useful for quick-design gravity assisted maneuvers. +++ @@ -55,9 +55,9 @@ from astropy import units as u from matplotlib import pyplot as plt import numpy as np -from poliastro.bodies import Venus, Earth, Mars -from poliastro.plotting.tisserand import TisserandPlotter, TisserandKind -from poliastro.plotting.util import BODY_COLORS +from hapsira.bodies import Venus, Earth, Mars +from hapsira.plotting.tisserand import TisserandPlotter, TisserandKind +from hapsira.plotting.util import BODY_COLORS ``` Notice that we imported the `TisserandKind` class, which will help us to indicate the kind of Tisserand plot we want to generate: @@ -115,7 +115,7 @@ More complex tisserand graphs can be developed, for example for the whole Solar ```{code-cell} # Let us import the rest of the planets -from poliastro.bodies import Mercury, Jupiter, Saturn, Uranus, Neptune +from hapsira.bodies import Mercury, Jupiter, Saturn, Uranus, Neptune SS_BODIES_INNER = [ Mercury, diff --git a/docs/source/examples/visualizing-the-spacex-tesla-roadster-trip-to-mars.myst.md b/docs/source/examples/visualizing-the-spacex-tesla-roadster-trip-to-mars.myst.md index c4ba2e509..9083a9adf 100644 --- a/docs/source/examples/visualizing-the-spacex-tesla-roadster-trip-to-mars.myst.md +++ b/docs/source/examples/visualizing-the-spacex-tesla-roadster-trip-to-mars.myst.md @@ -17,12 +17,12 @@ kernelspec: from astropy.time import Time from astropy import units as u -from poliastro.bodies import Earth, Mars, Sun -from poliastro.ephem import Ephem -from poliastro.frames import Planes -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import Plotly3D -from poliastro.util import time_range +from hapsira.bodies import Earth, Mars, Sun +from hapsira.ephem import Ephem +from hapsira.frames import Planes +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import Plotly3D +from hapsira.util import time_range EPOCH = Time("2018-02-18 12:00:00", scale="tdb") ``` @@ -39,7 +39,7 @@ roadster ``` ```{code-cell} -from poliastro.plotting.misc import plot_solar_system +from hapsira.plotting.misc import plot_solar_system ``` ```{code-cell} diff --git a/docs/source/gallery.md b/docs/source/gallery.md index 86702e938..bd4ce8bd9 100644 --- a/docs/source/gallery.md +++ b/docs/source/gallery.md @@ -1,9 +1,7 @@ (gallery)= # Gallery -The following page contains a collection of practical examples and problems solved with **poliastro**. From interplanetary transfers, to asteroid-catching missions or even propagation under external perturbations. -In addition, the user might come across tutorials related on how to use and customize -the plotting utilities, insight on the {ref}`API ` capabilities and many other topics related to orbital mechanics. +The following page contains a collection of practical examples and problems solved with **hapsira**. From interplanetary transfers, to asteroid-catching missions or even propagation under external perturbations. In addition, the user might come across tutorials related on how to use and customize the plotting utilities, insight on the {ref}`API ` capabilities and many other topics related to orbital mechanics. ```{eval-rst} .. nbgallery:: @@ -14,16 +12,16 @@ the plotting utilities, insight on the {ref}`API ` capabilities a /examples/customising-static-orbit-plots.myst.md /examples/czml-tutorial.myst.md /examples/exploring-the-new-horizons-launch.myst.md - /examples/going-to-mars-with-python-using-poliastro.myst.md - /examples/going-to-jupiter-with-python-using-jupyter-and-poliastro.myst.md + /examples/going-to-mars-with-python-using-hapsira.myst.md + /examples/going-to-jupiter-with-python-using-jupyter-and-hapsira.myst.md /examples/generating-orbit-groundtracks.myst.md /examples/plotting-in-3D.myst.md /examples/analyzing-NEOs.myst.md /examples/visualizing-the-spacex-tesla-roadster-trip-to-mars.myst.md /examples/natural-and-artificial-perturbations.myst.md - /examples/porkchops-with-poliastro.myst.md + /examples/porkchops-with-hapsira.myst.md /examples/tisserand.myst.md /examples/detecting-events.myst.md /examples/loading-OMM-and-TLE-satellite-data.myst.md - + ``` diff --git a/docs/source/history.md b/docs/source/history.md index be595a98f..fe5433c38 100644 --- a/docs/source/history.md +++ b/docs/source/history.md @@ -1,39 +1,23 @@ # History -## Creation +## Creation of `hapsira`, by Sebastian M. Ernst -I started poliastro as a wrapper of some MATLAB and Fortran algorithms -that I needed for a University project: having good performance was a -must, so pure Python was not an option. As a three language project, it -was only known to work in my computer, and I had to fight against [oct2py](https://pypi.org/project/oct2py/) -and [f2py](https://numpy.org/doc/stable/f2py/) for long hours. +`hapsira` began as a fork of the then unmaintained and archived `poliastro` in October 2023. Its aim is the continuation of `poliastro`'s development with an emphasis on speed and package structure. -Later on, I enhanced the plotting capabilities of poliastro to serve me in -additional university tasks. I removed the MATLAB (Octave) code and kept -only the Fortran algorithms. Finally, when numba was mature enough, I -implemented everything in pure Python and poliastro 0.3 was born. +## Creation of `poliastro`, by Juan Luis Cano Rodríguez + +I started `poliastro` as a wrapper of some MATLAB and Fortran algorithms that I needed for a University project: having good performance was a must, so pure Python was not an option. As a three language project, it was only known to work in my computer, and I had to fight against [oct2py](https://pypi.org/project/oct2py/) and [f2py](https://numpy.org/doc/stable/f2py/) for long hours. + +Later on, I enhanced the plotting capabilities of `poliastro` to serve me in additional university tasks. I removed the MATLAB (Octave) code and kept only the Fortran algorithms. Finally, when numba was mature enough, I implemented everything in pure Python and `poliastro` 0.3 was born. + +I am Juan Luis Cano Rodríguez (two names and two surnames, it\'s the Spanish way!), an Aerospace Engineer with a passion for Astrodynamics and the Open Source world. Before hapsira started to be a truly community project, I started it when I was an Erasmus student at Politecnico di Milano, an important technical university in Italy which deeply influenced my life and ambitions and gave name to the library itself. It is and always will be my tiny tribute to a country that will always be in my heart and to people that never ceased to inspire me. *Grazie mille!* ## Future ideas -poliastro has been historically focused on interplanetary applications, -so we would like to improve its Earth-specific capabilities in the future, -for example: +`hapsira`/`poliastro` has been historically focused on interplanetary applications, so we would like to improve its Earth-specific capabilities in the future, for example: - High order gravitational model for the Earth - Input/output of TLE and other GP data format - Attitude & dynamics -And in general, we would like to stabilize the API -and release a 1.0 version at some point! - -## Acknowledgement from the original author - -I am Juan Luis Cano Rodríguez (two names and two surnames, it\'s the -Spanish way!), an Aerospace Engineer with a passion for Astrodynamics -and the Open Source world. Before poliastro started to be a truly -community project, I started it when I was an Erasmus student at -Politecnico di Milano, an important technical university in Italy which -deeply influenced my life and ambitions and gave name to the library -itself. It is and always will be my tiny tribute to a country that will -always be in my heart and to people that never ceased to inspire me. -*Grazie mille!* +And in general, we would like to stabilize the API and release a 1.0 version at some point! diff --git a/docs/source/index.md b/docs/source/index.md index f3b9d57e7..581eba39d 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -1,24 +1,19 @@ -# poliastro - Astrodynamics in Python +# hapsira - Astrodynamics in Python ```{image} _static/logo_text.png ---- +--- width: 675px align: center --- ``` -**poliastro** is an open source ([MIT](https://opensource.org/licenses/MIT)) pure Python library -for interactive Astrodynamics and Orbital Mechanics, -with a focus on ease of use, speed, and quick visualization. -It provides a simple and intuitive {ref}`API `, -and handles physical quantities with units. +**hapsira** is an open source ([MIT](https://opensource.org/licenses/MIT)) pure Python library for interactive Astrodynamics and Orbital Mechanics, with a focus on ease of use, speed, and quick visualization. It provides a simple and intuitive {ref}`API `, and handles physical quantities with units. It's a fork of [poliastro](http://github.com/poliastro/poliastro), aiming at continuing its development. -View the [source code](https://github.com/poliastro/poliastro) of poliastro! +View the [source code](https://github.com/pleiszenburg/hapsira) of `hapsira`! Some of its awesome features are: - Analytical and numerical orbit propagation -- Conversion between position and velocity vectors and classical - orbital elements +- Conversion between position and velocity vectors and classical orbital elements - Coordinate frame transformations - Hohmann and bielliptic maneuvers computation - Trajectory plotting @@ -28,55 +23,59 @@ Some of its awesome features are: And more to come! -poliastro is developed by an open, international community. Release -announcements and general discussion take place on our [mailing -list](https://groups.io/g/poliastro-dev) and -[chat](http://chat.poliastro.space/). +`hapsira` is developed by an open, international community. Release announcements and general discussion take place on our [mailing list](https://groups.io/g/hapsira-dev) and [chat](https://matrix.to/#/#hapsira:matrix.org). ```{eval-rst} .. raw:: html
- -
-
-
- - - -

- -
-
-
+ +
+
+
+ + + +
+ +
+
+
``` + ```{figure} _static/molniya.png --- align: right @@ -87,27 +86,18 @@ Plot of a [Molniya orbit](https://en.wikipedia.org/wiki/Molniya_orbit) around th ({math}`a = 26600~\mathrm{km}, e = 0.75, i = 63.4\mathrm{^\circ}`). ``` -The [source code](https://github.com/poliastro/poliastro), [issue -tracker](https://github.com/poliastro/poliastro/issues) and -[wiki](https://github.com/poliastro/poliastro/wiki/) are hosted on -GitHub, and all contributions and feedback are more than welcome. You -can test poliastro in your browser using [Binder](https://mybinder.org/), a cloud Jupyter -notebook server: - -[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/poliastro/poliastro/main?labpath=index.ipynb) +The [source code](https://github.com/pleiszenburg/hapsira) and [issue tracker](https://github.com/pleiszenburg/hapsira/issues) are hosted on GitHub, and all contributions and feedback are more than welcome. -See [benchmarks](https://benchmarks.poliastro.space/) for the -performance analysis of poliastro. + -poliastro works on the recent Python versions and is released under the -MIT license, allowing commercial use of the library. +`hapsira` works on the recent Python versions and is released under the MIT license, allowing commercial use of the library. ```python -from poliastro.examples import molniya +from hapsira.examples import molniya molniya.plot() ``` -## Success stories +## Success stories from the original `poliastro` > *\"My team and I used Poliastro for our final project in our Summer > App Space program. This module helped us in plotting asteroids by @@ -126,8 +116,8 @@ molniya.plot() > Urbana-Champaign, United States. We are currently working on a student > AIAA/AAS satellite competition to design a satellite perform some > science missions on asteroid (469219) 2016 HO3. We are using your -> poliastro python package in designing and visualizing the trajectory -> from GEO into asteroid's orbit. Thank you for your work on poliastro, +> hapsira python package in designing and visualizing the trajectory +> from GEO into asteroid's orbit. Thank you for your work on hapsira, > especially the APIs that are very clear and informational, which helps > us significantly.\"* > @@ -164,7 +154,7 @@ installation quickstart ``` -```{toctree} +```{toctree} --- maxdepth: 2 caption: How-to guides & Examples @@ -173,9 +163,9 @@ gallery contributing ``` -```{toctree} +```{toctree} --- -maxdepth: 2 +maxdepth: 2 caption: Reference --- api @@ -194,10 +184,5 @@ background ``` ```{note} -Older versions of poliastro relied on some Fortran subroutines written -by David A. Vallado for his book \"Fundamentals of Astrodynamics and -Applications\" and available on the Internet as the [companion software -of the book](http://celestrak.com/software/vallado-sw.asp). The author -explicitly gave permission to redistribute these subroutines in this -project under a permissive license. +Older versions of `poliastro`, from which `hapsira` was forked, relied on some Fortran subroutines written by David A. Vallado for his book \"Fundamentals of Astrodynamics and Applications\" and available on the Internet as the [companion software of the book](http://celestrak.com/software/vallado-sw.asp). The author explicitly gave permission to redistribute these subroutines in this project under a permissive license. ``` diff --git a/docs/source/installation.md b/docs/source/installation.md index 323afce8f..07fb7f670 100644 --- a/docs/source/installation.md +++ b/docs/source/installation.md @@ -2,7 +2,7 @@ ## Requirements -poliastro requires a number of Python packages, notably: +`hapsira` requires a number of Python packages, notably: - [Astropy](https://www.astropy.org/), for physical units and time handling - [NumPy](https://numpy.org/), for basic numerical routines @@ -12,84 +12,61 @@ poliastro requires a number of Python packages, notably: - [Plotly](https://plotly.com/), for interactive orbit plotting - [SciPy](https://www.scipy.org/), for root finding and numerical propagation -poliastro is supported on Linux, macOS and Windows on Python 3.8 to 3.10. +`hapsira` is supported on Linux, macOS and Windows on Python 3.8 to 3.11. ## Using conda -The easiest and fastest way to get the package up and running is to -install poliastro using [conda](https://conda.io/docs/): +The easiest and fastest way to get the package up and running is to install `hapsira` using [conda](https://conda.io/docs/): ```bash -$ conda install -c conda-forge poliastro +$ conda install -c conda-forge hapsira ``` -or, better yet, using [mamba](https://mamba.readthedocs.io/), -which is a super fast replacement for `conda`: +or, better yet, using [mamba](https://mamba.readthedocs.io/), which is a super fast replacement for `conda`: ```bash $ conda install -c conda-forge mamba -$ mamba install -c conda-forge poliastro +$ mamba install -c conda-forge hapsira ``` ```{note} -We encourage users to use conda or mamba -and the [conda-forge](https://conda-forge.org/) packages -for convenience, -especially when developing on Windows. -It is recommended to create a new environment. +We encourage users to use conda or mamba and the [conda-forge](https://conda-forge.org/) packages for convenience, especially when developing on Windows. It is recommended to create a new environment. ``` -If the installation fails for any reason, please open an issue in the -[issue tracker](https://github.com/poliastro/poliastro/issues). +If the installation fails for any reason, please open an issue in the [issue tracker](https://github.com/pleiszenburg/hapsira/issues). ## Alternative installation methods -You can also [install poliastro from PyPI](https://pypi.python.org/pypi/poliastro/) using pip: +You can also [install hapsira from PyPI](https://pypi.python.org/pypi/hapsira/) using pip: ```bash -$ pip install poliastro +$ pip install hapsira ``` -Finally, you can also install the latest development version of poliastro -[directly from GitHub](http://github.com/poliastro/poliastro): +Finally, you can also install the latest development version of `hapsira` [directly from GitHub](http://github.com/pleiszenburg/hapsira): ```bash -$ pip install https://github.com/poliastro/poliastro/archive/main.zip +$ pip install https://github.com/pleiszenburg/hapsira/archive/main.zip ``` -This is useful if there is some feature that you want to try, -but we did not release it yet as a stable version. -Although you might find some unpolished details, -these development installations should work without problems. -If you find any, please open an issue in the [issue tracker](https://github.com/poliastro/poliastro/issues). +This is useful if there is some feature that you want to try, but we did not release it yet as a stable version. Although you might find some unpolished details, these development installations should work without problems. If you find any, please open an issue in the [issue tracker](https://github.com/pleiszenburg/hapsira/issues). ```{warning} -It is recommended that you -**never ever use sudo** with distutils, pip, setuptools and friends in Linux -because you might seriously break your system -\[[1](http://wiki.python.org/moin/CheeseShopTutorial#Distutils_Installation)\]\[[2](http://stackoverflow.com/questions/4314376/how-can-i-install-a-python-egg-file/4314446#comment4690673_4314446)\]\[[3](http://workaround.org/easy-install-debian)\]\[[4](http://matplotlib.1069221.n5.nabble.com/Why-is-pip-not-mentioned-in-the-Installation-Documentation-tp39779p39812.html)\]. -Use [virtual environments](https://docs.python.org/3/library/venv.html) instead. +It is recommended that you **never ever use sudo** with distutils, pip, setuptools and friends in Linux because you might seriously break your system \[[1](http://wiki.python.org/moin/CheeseShopTutorial#Distutils_Installation)\]\[[2](http://stackoverflow.com/questions/4314376/how-can-i-install-a-python-egg-file/4314446#comment4690673_4314446)\]\[[3](http://workaround.org/easy-install-debian)\]\[[4](http://matplotlib.1069221.n5.nabble.com/Why-is-pip-not-mentioned-in-the-Installation-Documentation-tp39779p39812.html)\]. Use [virtual environments](https://docs.python.org/3/library/venv.html) instead. ``` -## Making poliastro work in your editor +## Making `hapsira` work in your editor ### Jupyter notebook and JupyterLab To install the extra dependencies needed to make the interactive plots work on Jupyter, do ```bash -$ pip install poliastro[jupyter] +$ pip install hapsira[jupyter] ``` -With Plotly versions older than 5 on JupyterLab, -you will also need to install Node.js -to enable the browser extensions. -Check out [their troubleshooting guide](https://plotly.com/python/troubleshooting/#jupyterlab-problems) -for further information. +With Plotly versions older than 5 on JupyterLab, you will also need to install Node.js to enable the browser extensions. Check out [their troubleshooting guide](https://plotly.com/python/troubleshooting/#jupyterlab-problems) for further information. ## Problems and suggestions -If for any reason you get an unexpected error message or an incorrect result, -or you want to let the developers know about your use case, -please open a new issue in the [issue tracker](https://github.com/poliastro/poliastro/issues) -and we will try to answer promptly. +If for any reason you get an unexpected error message or an incorrect result, or you want to let the developers know about your use case, please open a new issue in the [issue tracker](https://github.com/pleiszenburg/hapsira/issues) and we will try to answer promptly. diff --git a/docs/source/logo/logo.svg b/docs/source/logo/logo.svg index c10a8ee78..d5e51fa81 100644 --- a/docs/source/logo/logo.svg +++ b/docs/source/logo/logo.svg @@ -16,7 +16,7 @@ version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="logo.svg" - inkscape:export-filename="/home/juanlu/Development/Python/poliastro/logo.png" + inkscape:export-filename="/home/juanlu/Development/Python/hapsira/logo.png" inkscape:export-xdpi="72" inkscape:export-ydpi="72"> + width="338.66666mm" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + units="mm" + inkscape:pagecheckerboard="0" + showguides="true" + inkscape:guide-bbox="true" /> - - - - - - - - - - + id="defs7427" /> @@ -98,7 +55,7 @@ image/svg+xml - + @@ -108,140 +65,135 @@ inkscape:groupmode="layer" inkscape:label="Layer 1"> + id="g7316" + transform="translate(0.4394713,2.2654799)"> + + + + + + + + + - - - - - + transform="translate(55.55839,-14.142136)" + inkscape:export-ydpi="72" + inkscape:export-xdpi="72" + id="g18902"> + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:#3873a3;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:8.02466;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + id="path7973" + cx="336.1431" + cy="684.40381" + r="19.488455" /> - - - - - - + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + id="path8021-6" + cx="341.93665" + cy="682.64636" + r="5.5558391" /> - poli - Astrodynamics in Python - astro + hapsira + Astrodynamics in Python + A poliastro fork diff --git a/docs/source/quickstart.md b/docs/source/quickstart.md index 8c52ad73a..10033448e 100644 --- a/docs/source/quickstart.md +++ b/docs/source/quickstart.md @@ -3,12 +3,9 @@ ## Defining the orbit: {{ Orbit }} objects -The core of poliastro are the {{ Orbit }} objects -inside the {py:class}`poliastro.twobody` module. They store all the required -information to define an orbit: +The core of `hapsira` are the {{ Orbit }} objects inside the {py:class}`hapsira.twobody` module. They store all the required information to define an orbit: -- The body acting as the central body of the orbit, for example the - Earth. +- The body acting as the central body of the orbit, for example the Earth. - The position and velocity vectors or the orbital elements. - The time at which the orbit is defined. @@ -17,15 +14,13 @@ First of all, you have to import the relevant modules and classes: ```python from astropy import units as u -from poliastro.bodies import Earth, Mars, Sun -from poliastro.twobody import Orbit +from hapsira.bodies import Earth, Mars, Sun +from hapsira.twobody import Orbit ``` ## From position and velocity -There are several methods available to create {{ Orbit }} objects. -For example, if you have the position and velocity vectors you can use -{py:meth}`~poliastro.twobody.orbit.scalar.Orbit.from_vectors`: +There are several methods available to create {{ Orbit }} objects. For example, if you have the position and velocity vectors you can use {py:meth}`~hapsira.twobody.orbit.scalar.Orbit.from_vectors`: ```python # Data from Curtis, example 4.3 @@ -44,7 +39,7 @@ And that's it! Notice a couple of things: - If you display the orbit you just created, you get a string with the radius of pericenter, radius of apocenter, inclination, reference frame and attractor: - ```python + ```python >>> orb 7283 x 10293 km x 153.2 deg (GCRS) orbit around Earth (♁) at epoch J2000.000 (TT) ``` @@ -58,7 +53,7 @@ And that's it! Notice a couple of things: ``` - The reference frame of the orbit will be one pseudo-inertial frame around the attractor. - You can retrieve it using the {py:attr}`~poliastro.twobody.orbit.scalar.Orbit.frame` property: + You can retrieve it using the {py:attr}`~hapsira.twobody.orbit.scalar.Orbit.frame` property: ```python >>> orb.get_frame() @@ -74,8 +69,7 @@ alt: Plot of the orbit --- ``` -If you're working on interactive mode (for example, using JupyterLab) -you can immediately plot the current orbit: +If you're working on interactive mode (for example, using JupyterLab) you can immediately plot the current orbit: orb.plot() @@ -88,18 +82,12 @@ This plot is made in the so called *perifocal frame*, which means: The dotted line represents the *osculating orbit*: the instantaneous Keplerian orbit at that point. This is relevant in the context of perturbations, when the object shall deviate from its Keplerian orbit. ```{note} -This visualization uses Plotly under interactive environments like Jupyter -Notebook or Jupyter Lab while it switches to Matplotlib otherwise. Nevertheless, -you can select the drawing backend. Check out the -{py:class}`poliastro.plotting.orbit.OrbitPlotter` documentation for more -information. +This visualization uses Plotly under interactive environments like Jupyter Notebook or Jupyter Lab while it switches to Matplotlib otherwise. Nevertheless, you can select the drawing backend. Check out the {py:class}`hapsira.plotting.orbit.OrbitPlotter` documentation for more information. ``` ## From classical orbital elements -You can also define an {{ Orbit }} using a set of six parameters called **orbital elements**. -Although there are several of these element sets, each one with its advantages and drawbacks, -right now poliastro supports the *classical orbital elements*: +You can also define an {{ Orbit }} using a set of six parameters called **orbital elements**. Although there are several of these element sets, each one with its advantages and drawbacks, right now hapsira supports the *classical orbital elements*: - Semimajor axis $(a)$. - Eccentricity $(e)$. @@ -108,8 +96,7 @@ right now poliastro supports the *classical orbital elements*: - Argument of pericenter $(\omega)$. - True anomaly $(\nu)$. -In this case, you'd use the method -{py:meth}`~poliastro.twobody.orbit.Orbit.from_classical`: +In this case, you'd use the method {py:meth}`~hapsira.twobody.orbit.Orbit.from_classical`: ```python # Data for Mars at J2000 from JPL HORIZONS @@ -123,8 +110,7 @@ nu = 23.33 << u.deg orb = Orbit.from_classical(Sun, a, ecc, inc, raan, argp, nu) ``` -Notice that whether you create an {{ Orbit }} from $(r)$ and $(v)$ or from -elements you can access many mathematical properties of the orbit: +Notice that whether you create an {{ Orbit }} from $(r)$ and $(v)$ or from elements you can access many mathematical properties of the orbit: ```python >>> orb.period.to(u.day) @@ -136,14 +122,12 @@ To see a complete list of properties, check out the {{ Orbit }} class on the API ## Moving forward in time: propagation -Now that you have defined an orbit, you might be interested in computing -how is it going to evolve in the future. In the context of orbital mechanics, -this process is known as **propagation**. +Now that you have defined an orbit, you might be interested in computing how is it going to evolve in the future. In the context of orbital mechanics, this process is known as **propagation**. For example, start by importing an example orbit from the International Space Station: -```python ->>> from poliastro.examples import iss +```python +>>> from hapsira.examples import iss >>> iss 6772 x 6790 km x 51.6 deg (GCRS) orbit around Earth (♁) >>> iss.epoch @@ -154,8 +138,7 @@ For example, start by importing an example orbit from the International Space St ``` -Using the {py:meth}`~poliastro.twobody.orbit.scalar.Orbit.propagate` method -you can now retrieve the position of the ISS after some time: +Using the {py:meth}`~hapsira.twobody.orbit.scalar.Orbit.propagate` method you can now retrieve the position of the ISS after some time: ```python >>> iss_30m = iss.propagate(30 << u.min) @@ -165,19 +148,15 @@ you can now retrieve the position of the ISS after some time: ``` -To explore different propagation algorithms, check out the -{py:mod}`poliastro.twobody.propagation` module. +To explore different propagation algorithms, check out the {py:mod}`hapsira.twobody.propagation` module. -## Studying trajectories: {py:class}`~poliastro.ephem.Ephem` objects +## Studying trajectories: {py:class}`~hapsira.ephem.Ephem` objects -The `propagate` method gives you the final orbit at the epoch you designated. -To retrieve the whole trajectory instead, you can use -{py:meth}`poliastro.twobody.orbit.scalar.Orbit.to_ephem`, which returns an -{{ Ephem }} instance: +The `propagate` method gives you the final orbit at the epoch you designated. To retrieve the whole trajectory instead, you can use {py:meth}`hapsira.twobody.orbit.scalar.Orbit.to_ephem`, which returns an {{ Ephem }} instance: ```python -from poliastro.twobody.sampling import EpochsArray, TrueAnomalyBounds, EpochBounds -from poliastro.util import time_range +from hapsira.twobody.sampling import EpochsArray, TrueAnomalyBounds, EpochBounds +from hapsira.util import time_range start_date = Time("2022-07-11 05:05", scale="utc") end_date = Time("2022-07-11 07:05", scale="utc") @@ -195,8 +174,7 @@ ephem3 = iss.to_ephem(strategy=TrueAnomalyBounds(min_nu=0 << u.deg, max_nu=180 < ephem4 = iss.to_ephem(strategy=EpochBounds(min_epoch=start_date, max_epoch=end_date)) ``` -`Ephem` objects contain the coordinates of an object sampled at specific times. -You can access both: +`Ephem` objects contain the coordinates of an object sampled at specific times. You can access both: ```python >>> ephem1.epochs[:3] @@ -212,15 +190,13 @@ You can access both: ## Studying non-keplerian orbits: perturbations -Apart from the Keplerian propagators, poliastro also allows you to -define custom perturbation accelerations to study non Keplerian orbits, -thanks to Cowell's method: +Apart from the Keplerian propagators, hapsira also allows you to define custom perturbation accelerations to study non Keplerian orbits, thanks to Cowell's method: ```python >>> from numba import njit >>> import numpy as np ->>> from poliastro.core.propagation import func_twobody ->>> from poliastro.twobody.propagation import CowellPropagator +>>> from hapsira.core.propagation import func_twobody +>>> from hapsira.twobody.propagation import CowellPropagator >>> r0 = [-2384.46, 5729.01, 3050.46] << u.km >>> v0 = [-7.36138, -2.98997, 1.64354] << (u.km / u.s) >>> initial = Orbit.from_vectors(Earth, r0, v0) @@ -241,11 +217,10 @@ thanks to Cowell's method: 18255 x 21848 km x 28.0 deg (GCRS) orbit around Earth (♁) at epoch J2000.008 (TT) ``` -Some natural perturbations are available in poliastro to be used -directly in this way. For instance, to examine the effect of J2 perturbation: +Some natural perturbations are available in hapsira to be used directly in this way. For instance, to examine the effect of J2 perturbation: ```python ->>> from poliastro.core.perturbations import J2_perturbation +>>> from hapsira.core.perturbations import J2_perturbation >>> tofs = [48.0] << u.h >>> def f(t0, u_, k): ... du_kep = func_twobody(t0, u_, k) @@ -269,9 +244,7 @@ The J2 perturbation changes the orbit parameters (from Curtis example 12.2): ## Studying artificial perturbations: thrust -In addition to natural perturbations, poliastro also has built-in -artificial perturbations (thrust guidance laws) aimed at intentional change of some -orbital elements. For example, to simultaneously change eccentricity and inclination: +In addition to natural perturbations, hapsira also has built-in artificial perturbations (thrust guidance laws) aimed at intentional change of some orbital elements. For example, to simultaneously change eccentricity and inclination: ```python >>> ecc_0, ecc_f = [0.4, 0.0] << u.one @@ -310,22 +283,16 @@ The thrust changes orbit parameters as desired (within errors): (, ) ``` -For more available thrust guidance laws options, see the -{py:mod}`poliastro.twobody.thrust` module. +For more available thrust guidance laws options, see the {py:mod}`hapsira.twobody.thrust` module. -### Changing the orbit: {py:class}`~poliastro.maneuver.Maneuver` objects +### Changing the orbit: {py:class}`~hapsira.maneuver.Maneuver` objects -poliastro helps defining several in-plane and general out-of-plane -maneuvers with the {py:class}`~poliastro.maneuver.Maneuver` class. +`hapsira` helps defining several in-plane and general out-of-plane maneuvers with the {py:class}`~hapsira.maneuver.Maneuver` class. -Each `Maneuver` consists on a list of impulses $\Delta v_i$ (changes in velocity), -each one applied at a certain instant $t_i$. The simplest maneuver is -a single change of velocity without delay: -you can recreate it either using the {py:meth}`~poliastro.maneuver.Maneuver.impulse` method -or instantiating it directly. +Each `Maneuver` consists on a list of impulses $\Delta v_i$ (changes in velocity), each one applied at a certain instant $t_i$. The simplest maneuver is a single change of velocity without delay: you can recreate it either using the {py:meth}`~hapsira.maneuver.Maneuver.impulse` method or instantiating it directly. ```python -from poliastro.maneuver import Maneuver +from hapsira.maneuver import Maneuver dv = [5, 0, 0] << (u.m / u.s) @@ -333,13 +300,7 @@ imp = Maneuver.impulse(dv) imp = Maneuver((0 << u.s, dv)) # Equivalent ``` -There are other useful methods you can use to compute common in-plane maneuvers, -notably {py:meth} `~poliastro.maneuver.Maneuver.hohmann` and -{py:meth}`~poliastro.maneuver.Maneuver.bielliptic` for -[Hohmann](https://en.wikipedia.org/wiki/Hohmann_transfer_orbit) -and [bielliptic](https://en.wikipedia.org/wiki/Bi-elliptic_transfer) transfers respectively. -Both return the corresponding `Maneuver` object, which in turn you can use to calculate -the total cost in terms of velocity change $\sum |\Delta v_i|$ and the transfer time: +There are other useful methods you can use to compute common in-plane maneuvers, notably {py:meth} `~hapsira.maneuver.Maneuver.hohmann` and {py:meth}`~hapsira.maneuver.Maneuver.bielliptic` for [Hohmann](https://en.wikipedia.org/wiki/Hohmann_transfer_orbit) and [bielliptic](https://en.wikipedia.org/wiki/Bi-elliptic_transfer) transfers respectively. Both return the corresponding `Maneuver` object, which in turn you can use to calculate the total cost in terms of velocity change $\sum |\Delta v_i|$ and the transfer time: ```python >>> orb_i = Orbit.circular(Earth, alt=700 << u.km) @@ -363,8 +324,7 @@ You can also retrieve the individual vectorial impulses: (, ) ``` -To actually retrieve the resulting {{ Orbit }} after performing a maneuver, use -the method {py:meth}`~poliastro.twobody.orbit.scalar.Orbit.apply_maneuver`: +To actually retrieve the resulting {{ Orbit }} after performing a maneuver, use the method {py:meth}`~hapsira.twobody.orbit.scalar.Orbit.apply_maneuver`: ```python >>> orb_f = orb_i.apply_maneuver(hoh) @@ -374,28 +334,18 @@ the method {py:meth}`~poliastro.twobody.orbit.scalar.Orbit.apply_maneuver`: ### More advanced plotting: `OrbitPlotter` objects -You previously saw the {py:meth}`~poliastro.twobody.orbit.scalar.Orbit.plot` -method to easily plot orbits. Now you might want to plot several orbits in one -graph (for example, the maneuver you computed in the previous section). For this -purpose, poliastro has an `OrbitPlotter` object in the -{py:mod}`~poliastro.plotting` module. +You previously saw the {py:meth}`~hapsira.twobody.orbit.scalar.Orbit.plot` method to easily plot orbits. Now you might want to plot several orbits in one graph (for example, the maneuver you computed in the previous section). For this purpose, hapsira has an `OrbitPlotter` object in the {py:mod}`~hapsira.plotting` module. -The advantage of this object is that it allows you to select the desired drawing -backend. All the supported backends are specified in the dictionary -{py:class}`~poliastro.plotting.orbit.backens.SUPPORTED_ORBIT_PLOTTER_BACKENDS`. +The advantage of this object is that it allows you to select the desired drawing backend. All the supported backends are specified in the dictionary {py:class}`~hapsira.plotting.orbit.backens.SUPPORTED_ORBIT_PLOTTER_BACKENDS`. -If you would like to know which 2D check the -{py:class}`~poliastro.plotting.orbit.backens.SUPPORTED_ORBIT_PLOTTER_BACKENDS_2D`. -For 3D backends, refer to -{py:class}`~poliastro.plotting.orbit.backens.SUPPORTED_ORBIT_PLOTTER_BACKENDS_3D`. +If you would like to know which 2D check the {py:class}`~hapsira.plotting.orbit.backens.SUPPORTED_ORBIT_PLOTTER_BACKENDS_2D`. For 3D backends, refer to {py:class}`~hapsira.plotting.orbit.backens.SUPPORTED_ORBIT_PLOTTER_BACKENDS_3D`. -Note that some backends are interactive, meaning that you can move the scene or -even rotate the three-dimensional view in a dynamic way. +Note that some backends are interactive, meaning that you can move the scene or even rotate the three-dimensional view in a dynamic way. To easily visualize several orbits in two dimensions, you can run this code: ```python -from poliastro.plotting import OrbitPlotter +from hapsira.plotting import OrbitPlotter op = OrbitPlotter(backend_name="matplotlib2D") orb_a, orb_f = orb_i.apply_maneuver(hoh, intermediate=True) @@ -411,7 +361,7 @@ which produces this beautiful plot: --- align: center alt: Hohmann transfer ---- +--- Plot of a Hohmann transfer. ``` @@ -421,24 +371,20 @@ Plot of a Hohmann transfer. .. versionadded:: 0.14.0 ``` -Thanks to Astropy and jplephem, poliastro can read Satellite Planet Kernel (SPK) files, -part of NASA's SPICE toolkit. This means that you can query the position and velocity -of the planets of the Solar system. +Thanks to Astropy and jplephem, hapsira can read Satellite Planet Kernel (SPK) files, part of NASA's SPICE toolkit. This means that you can query the position and velocity of the planets of the Solar system. -The {py:class}`poliastro.ephem.Ephem` class allows you to retrieve a planetary orbit -using low precision ephemerides available in Astropy: +The {py:class}`hapsira.ephem.Ephem` class allows you to retrieve a planetary orbit using low precision ephemerides available in Astropy: ```python >>> from astropy.time import Time >>> epoch = time.Time("2020-04-29 10:43") # UTC by default ->>> from poliastro.ephem import Ephem +>>> from hapsira.ephem import Ephem >>> earth = Ephem.from_body(Earth, epoch.tdb) >>> earth Ephemerides at 1 epochs from 2020-04-29 10:44:09.186 (TDB) to 2020-04-29 10:44:09.186 (TDB) ``` -This does not require any external download. If on the other hand you -want to use higher precision ephemerides, you can tell Astropy to do so: +This does not require any external download. If on the other hand you want to use higher precision ephemerides, you can tell Astropy to do so: ```python >>> from astropy.coordinates import solar_system_ephemeris @@ -447,12 +393,9 @@ Downloading http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430. |==========>-------------------------------| 23M/119M (19.54%) ETA 59s22ss23 ``` -This in turn will download the ephemerides files from NASA and use them for future computations. -For more information, check out -[Astropy documentation on ephemerides](https://docs.astropy.org/en/stable/coordinates/solarsystem.html). +This in turn will download the ephemerides files from NASA and use them for future computations. For more information, check out [Astropy documentation on ephemerides](https://docs.astropy.org/en/stable/coordinates/solarsystem.html). -If you want to retrieve the **osculating orbit** at a given epoch, -you can do so using {py:meth}`~poliastro.twobody.orbit.scalar.Orbit.from_ephem`: +If you want to retrieve the **osculating orbit** at a given epoch, you can do so using {py:meth}`~hapsira.twobody.orbit.scalar.Orbit.from_ephem`: ```python >>> Orbit.from_ephem(Sun, earth, epoch) @@ -460,18 +403,12 @@ you can do so using {py:meth}`~poliastro.twobody.orbit.scalar.Orbit.from_ephem`: ``` ```{note} -Notice that the position and velocity vectors are given with respect to the -**Heliocentric Celestial Reference System** (HCRS) -which means equatorial coordinates centered on the Sun. +Notice that the position and velocity vectors are given with respect to the **Heliocentric Celestial Reference System** (HCRS) which means equatorial coordinates centered on the Sun. ``` -In addition, poliastro supports fetching orbital information from 2 online databases: -Small Body Database Browser (SBDB) and JPL HORIZONS. +In addition, hapsira supports fetching orbital information from 2 online databases: Small Body Database Browser (SBDB) and JPL HORIZONS. -HORIZONS can be used to generate ephemerides for solar-system bodies, -while SBDB provides model orbits for all known asteroids and many comets. -The data is fetched using the wrappers to these services provided by -[astroquery](https://astroquery.readthedocs.io/): +HORIZONS can be used to generate ephemerides for solar-system bodies, while SBDB provides model orbits for all known asteroids and many comets. The data is fetched using the wrappers to these services provided by [astroquery](https://astroquery.readthedocs.io/): ```python epoch = Time("2020-04-29 10:43") @@ -482,18 +419,11 @@ orbit_apophis = Orbit.from_sbdb("Apophis") ## Traveling through space: solving the Lambert problem -The determination of an orbit given two position vectors and the time of flight -is known in celestial mechanics as **Lambert's problem**, also known as the -two body boundary value problem. This contrasts with Kepler's problem or propagation, -which is rather an initial value problem. +The determination of an orbit given two position vectors and the time of flight is known in celestial mechanics as **Lambert's problem**, also known as the two body boundary value problem. This contrasts with Kepler's problem or propagation, which is rather an initial value problem. -poliastro allows you to solve Lambert's problem by passing the initial and final orbits -to {py:meth}`poliastro.maneuver.Maneuver.lambert` instance. -The time of flight is computed internally since orbits epochs are known. +`hapsira` allows you to solve Lambert's problem by passing the initial and final orbits to {py:meth}`hapsira.maneuver.Maneuver.lambert` instance. The time of flight is computed internally since orbits epochs are known. -For instance, this is a simplified version of the example -"Going to Mars with Python using poliastro", where the orbit of the -Mars Science Laboratory mission (rover Curiosity) is determined: +For instance, this is a simplified version of the example "Going to Mars with Python using hapsira", where the orbit of the Mars Science Laboratory mission (rover Curiosity) is determined: ```python date_launch = Time('2011-11-26 15:02', scale='tdb') @@ -525,18 +455,16 @@ alt: Plot of the orbit ## Creating a CZML document -You can create CZML documents which can then be visualized with the help of -[Cesium](https://cesium.com/platform/cesiumjs/). +You can create CZML documents which can then be visualized with the help of [Cesium](https://cesium.com/platform/cesiumjs/). First, load the orbital data and the CZML Extractor: ```python -from poliastro.examples import molniya, iss -from poliastro.czml.extract_czml import CZMLExtractor +from hapsira.examples import molniya, iss +from hapsira.czml.extract_czml import CZMLExtractor ``` -Then, specify the starting and ending epoch, as well as the number of -sample points (the higher the number, the more accurate the trajectory): +Then, specify the starting and ending epoch, as well as the number of sample points (the higher the number, the more accurate the trajectory): ```python start_epoch = iss.epoch @@ -549,8 +477,6 @@ extractor.add_orbit(molniya, label_text="Molniya") extractor.add_orbit(iss, label_text="ISS") ``` -Finaly, generate the CZML file by calling `extractor.packets`. -There is more information in -[this sample Cesium application](https://github.com/poliastro/cesium-app/blob/master/README.md). +Finaly, generate the CZML file by calling `extractor.packets`. There is more information in [this sample Cesium application](https://github.com/poliastro/cesium-app/blob/master/README.md). *Per Python ad astra* ;) diff --git a/docs/source/related.md b/docs/source/related.md index 8ba68a283..b78b56cc1 100644 --- a/docs/source/related.md +++ b/docs/source/related.md @@ -1,13 +1,12 @@ # Related software -These are some projects which share similarities with poliastro or which -served as inspiration: +These are some projects which share similarities with `hapsira` or which served as inspiration: - [astropy](http://www.astropy.org/): According to its website, \"The Astropy Project is a community effort to develop a single core package for Astronomy in Python and foster interoperability between Python astronomy packages\". Not only does it provide important core - features for poliastro like [time](https://docs.astropy.org/en/stable/time/) and physical [units](https://docs.astropy.org/en/stable/units/) handling, but + features for hapsira like [time](https://docs.astropy.org/en/stable/time/) and physical [units](https://docs.astropy.org/en/stable/units/) handling, but also sets a [high bar](https://docs.astropy.org/en/stable/index.html) for code quality and documentation standards. A truly inspiring project. - [Skyfield](https://rhodesmill.org/skyfield/): Another Astronomy @@ -18,10 +17,10 @@ served as inspiration: - [Plyades](https://plyades.readthedocs.io/): A pioneering astrodynamics library written in Python by [Helgee Eichhorn](https://helgeeichhorn.de/). Its clean and user-friendly API inspired me to completely refactor - poliastro 0.2 so it could be much easier to use. It is now deprecated by the author, with [Astrodynamics.jl](https://juliaastrodynamics.github.io/) being its successor (poliastro, too!) + hapsira 0.2 so it could be much easier to use. It is now deprecated by the author, with [Astrodynamics.jl](https://juliaastrodynamics.github.io/) being its successor (hapsira, too!) - [orbital](https://pythonhosted.org/OrbitalPy/): Yet another orbital mechanics Python library written by [Frazer McLean](https://www.frazermclean.co.uk/). It is very - similar to poliastro (orbital plotting module was inspired by mine) + similar to hapsira (orbital plotting module was inspired by mine) but its internal structure is way smarter. It is more focused in plotting and it even provides 3D plots and animations. - [orekit-python-wrapper](https://www.orekit.org/forge/projects/orekit-python-wrapper/wiki): @@ -33,7 +32,7 @@ served as inspiration: - [beyond](https://github.com/galactics/beyond/): A young flight dynamics library written in Python with a focus on developing \"a simple API for space observations\". Some parts overlap with - poliastro, but it also introduces many interesting features, and the + hapsira, but it also introduces many interesting features, and the examples look promising. Worth checking! - [SpiceyPy](https://github.com/andrewannex/SpiceyPy): This Python library wraps the [SPICE Toolkit](https://naif.jpl.nasa.gov/naif/toolkit.html), a huge software collection diff --git a/index.ipynb b/index.ipynb index 68175fa76..838f0fca4 100644 --- a/index.ipynb +++ b/index.ipynb @@ -8,7 +8,7 @@ "\n", "![logo_text.png](docs/source/examples/logo_text.png)\n", "\n", - "Here you can browse a gallery of examples using poliastro in the form of Jupyter notebooks." + "Here you can browse a gallery of examples using hapsira in the form of Jupyter notebooks." ] }, { diff --git a/pyproject.toml b/pyproject.toml index bad880e7a..0417fb060 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,16 +7,15 @@ requires = [ build-backend = "flit_core.buildapi" [project] -name = "poliastro" +name = "hapsira" readme = "README.md" requires-python = ">=3.8" -license = {file = "COPYING"} +license = {file = "LICENSE"} authors = [ - {name = "Juan Luis Cano Rodríguez", email = "hello@juanlu.space"} + {name = "Sebastian M. Ernst", email = "ernst@pleiszenburg.de"} ] maintainers = [ - {name = "Juan Luis Cano Rodríguez", email = "hello@juanlu.space"}, - {name = "Jorge Martinez Garrido", email = "contact@jorgemartinez.space"} + {name = "Sebastian M. Ernst", email = "ernst@pleiszenburg.de"} ] keywords = [ "aero", @@ -46,59 +45,59 @@ classifiers = [ "Topic :: Scientific/Engineering :: Astronomy", ] dependencies = [ - "astropy >=5.0,<6", - "astroquery >=0.3.9", + "astropy", # >=5.0,<6", + "astroquery", # >=0.3.9", "jplephem", - "matplotlib >=2.0,!=3.0.1", - "numba >=0.46 ; python_version<'3.9'", - "numba >=0.53.0 ; python_version>='3.9'", + "matplotlib<3.8", # >=2.0,!=3.0.1,<3.8", # https://github.com/librosa/librosa/issues/1763 + "numba", # >=0.46 ; python_version<'3.9'", + # "numba >=0.53.0 ; python_version>='3.9'", "numpy", "pandas", - "plotly >=4.0,<6", + "plotly", # >=4.0,<6", "pyerfa", - "scipy >=1.4.0", + "scipy", # >=1.4.0", ] dynamic = ["version", "description"] [project.urls] -Homepage = "https://www.poliastro.space" -Documentation = "https://docs.poliastro.space" -Source = "https://github.com/poliastro/poliastro" -Tracker = "https://github.com/poliastro/poliastro/issues" -Funding = "https://opencollective.com/poliastro" -Changelog = "https://docs.poliastro.space/en/stable/changelog.html" +Homepage = "https://hapsira.readthedocs.io" +Documentation = "https://hapsira.readthedocs.io" +Source = "https://github.com/pleiszenburg/hapsira" +Tracker = "https://github.com/pleiszenburg/hapsira/issues" +Changelog = "https://hapsira.readthedocs.io/en/stable/changelog.html" [project.optional-dependencies] jupyter = ["notebook", "ipywidgets>=7.6"] cesium = ["czml3 ~=0.5.3"] doc = [ "httpx", - "ipython>=5.0", - "ipywidgets>=7.6", + "ipython", # >=5.0", + "ipykernel", # https://github.com/pandas-dev/pandas/issues/18041#issuecomment-340701027 + "ipywidgets",# >=7.6", "jupyter-client", "jupytext", - "myst-parser>=0.13.1", - "nbsphinx>=0.8.6", - "nbconvert>=5.5", + "myst-parser", # >=0.13.1", + "nbsphinx", # >=0.8.6", + "nbconvert", # >=5.5", "sgp4", - "sphinx!=3.5,!=4.0,<5.1", # https://github.com/readthedocs/sphinx-hoverxref/issues/119 - "sphinx-autoapi", + "sphinx", # !=3.5,!=4.0,<5.1", # https://github.com/readthedocs/sphinx-hoverxref/issues/119 + "sphinx-autoapi>=3", "sphinx-gallery<=0.7.0", # Just to avoid the jupytext warning - "sphinx_rtd_theme~=1.0.0", - "sphinx-hoverxref==0.7b1", + "sphinx_rtd_theme", # ~=1.0.0", + "sphinx-hoverxref", # ==0.7b1", "sphinx-notfound-page", - "sphinx-copybutton>0.2.9", - "sphinx-github-role~=0.1.0", + "sphinx-copybutton", # >0.2.9", + "sphinx-github-role", # ~=0.1.0", ] test = [ "coverage", "hypothesis", "import-linter[toml]", - "mypy>=0.740", + "mypy", # >=0.740", "pre-commit", - "pytest>=3.2", - "pytest-cov<2.6.0", # https://github.com/pytest-dev/pytest-cov/issues/222 - "pytest-doctestplus>=0.8", # https://github.com/astropy/pytest-doctestplus/issues/118 + "pytest", # >=3.2", + "pytest-cov", # <2.6.0", # https://github.com/pytest-dev/pytest-cov/issues/222 + "pytest-doctestplus", # >=0.8", # https://github.com/astropy/pytest-doctestplus/issues/118 "pytest-mpl", "pytest-mypy", "pytest-remotedata", @@ -107,19 +106,16 @@ test = [ [tool.flit.sdist] include = [ - "src/poliastro/atmosphere/data/coesa62.dat", - "src/poliastro/atmosphere/data/coesa76.dat", - "src/poliastro/atmosphere/data/coesa76_p.dat", - "src/poliastro/atmosphere/data/coesa76_rho.dat", + "src/hapsira/atmosphere/data/coesa62.dat", + "src/hapsira/atmosphere/data/coesa76.dat", + "src/hapsira/atmosphere/data/coesa76_p.dat", + "src/hapsira/atmosphere/data/coesa76_rho.dat", "setup.cfg" ] exclude = [ "docs/" ] -[tool.black] -line-length = 79 - [tool.ruff] select = [ "E", # pycodestyle, see https://github.com/charliermarsh/ruff#pycodestyle-e-w @@ -143,7 +139,7 @@ exclude = [ [tool.ruff.isort] combine-as-imports = true force-sort-within-sections = true -known-first-party = ["poliastro"] +known-first-party = ["hapsira"] [tool.ruff.mccabe] max-complexity = 18 @@ -167,13 +163,13 @@ show_missing = true [tool.importlinter] # Include Astropy to properly analyze external submodules, # see https://github.com/seddonym/import-linter/issues/111 -root_packages = ["poliastro", "astropy"] +root_packages = ["hapsira", "astropy"] include_external_packages = true [[tool.importlinter.contracts]] -name = "poliastro.core does not import astropy.units" +name = "hapsira.core does not import astropy.units" type = "forbidden" -source_modules = ["poliastro.core"] +source_modules = ["hapsira.core"] forbidden_modules = ["astropy.units"] [tool.pytest.ini_options] diff --git a/src/poliastro/__init__.py b/src/hapsira/__init__.py similarity index 100% rename from src/poliastro/__init__.py rename to src/hapsira/__init__.py diff --git a/src/poliastro/_math/__init__.py b/src/hapsira/_math/__init__.py similarity index 100% rename from src/poliastro/_math/__init__.py rename to src/hapsira/_math/__init__.py diff --git a/src/poliastro/_math/integrate.py b/src/hapsira/_math/integrate.py similarity index 100% rename from src/poliastro/_math/integrate.py rename to src/hapsira/_math/integrate.py diff --git a/src/poliastro/_math/interpolate.py b/src/hapsira/_math/interpolate.py similarity index 100% rename from src/poliastro/_math/interpolate.py rename to src/hapsira/_math/interpolate.py diff --git a/src/poliastro/_math/ivp.py b/src/hapsira/_math/ivp.py similarity index 100% rename from src/poliastro/_math/ivp.py rename to src/hapsira/_math/ivp.py diff --git a/src/poliastro/_math/linalg.py b/src/hapsira/_math/linalg.py similarity index 100% rename from src/poliastro/_math/linalg.py rename to src/hapsira/_math/linalg.py diff --git a/src/poliastro/_math/optimize.py b/src/hapsira/_math/optimize.py similarity index 100% rename from src/poliastro/_math/optimize.py rename to src/hapsira/_math/optimize.py diff --git a/src/poliastro/_math/special.py b/src/hapsira/_math/special.py similarity index 100% rename from src/poliastro/_math/special.py rename to src/hapsira/_math/special.py diff --git a/src/poliastro/bodies.py b/src/hapsira/bodies.py similarity index 94% rename from src/poliastro/bodies.py rename to src/hapsira/bodies.py index 47ffc3107..f5ce40c68 100644 --- a/src/poliastro/bodies.py +++ b/src/hapsira/bodies.py @@ -26,7 +26,7 @@ and a way to define new bodies (:py:class:`~Body` class). -Data references can be found in :py:mod:`~poliastro.constants` +Data references can be found in :py:mod:`~hapsira.constants` """ from collections import namedtuple import math @@ -35,8 +35,8 @@ from astropy.constants import G from astropy.units import Quantity -from poliastro import constants -from poliastro.frames import Planes +from hapsira import constants +from hapsira.frames import Planes # HACK: Constants cannot be hashed @@ -121,9 +121,7 @@ def from_parameters(cls, parent, k, name, symbol, R, **kwargs): return cls(parent, k, name, symbol, R, **kwargs) @classmethod - def from_relative( - cls, reference, parent, k, name, symbol=None, R=0, **kwargs - ): + def from_relative(cls, reference, parent, k, name, symbol=None, R=0, **kwargs): k = k * reference.k R = R * reference.R return cls(parent, k, name, symbol, R, **kwargs) @@ -145,15 +143,15 @@ def plot( Epoch of current position. label : str, optional Label for the orbit, defaults to empty. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Reference plane of the coordinates. - backend : ~poliastro.plotting.orbit.backends._base.OrbitPlotterBackend + backend : ~hapsira.plotting.orbit.backends._base.OrbitPlotterBackend An instance of ``OrbitPlotterBackend`` for rendendering the scene. """ # HACK: import here the OrbitPlotter to avoid a circular dependency # between bodies.py and misc.py - from poliastro.plotting.orbit.plotter import OrbitPlotter + from hapsira.plotting.orbit.plotter import OrbitPlotter return OrbitPlotter(backend=backend, plane=plane).plot_body_orbit( self, epoch=epoch, label=label diff --git a/src/poliastro/constants/__init__.py b/src/hapsira/constants/__init__.py similarity index 96% rename from src/poliastro/constants/__init__.py rename to src/hapsira/constants/__init__.py index 1bc595e45..bd8052bc7 100644 --- a/src/poliastro/constants/__init__.py +++ b/src/hapsira/constants/__init__.py @@ -1,4 +1,4 @@ -from poliastro.constants.general import ( +from hapsira.constants.general import ( J2000, J2000_TDB, J2000_TT, @@ -67,7 +67,7 @@ Wdivc_sun, rho0_earth, ) -from poliastro.constants.mean_elements import ( +from hapsira.constants.mean_elements import ( mean_a_charon, mean_a_deimos, mean_a_earth, @@ -87,7 +87,7 @@ mean_a_uranus, mean_a_venus, ) -from poliastro.constants.rotational_elements import ( +from hapsira.constants.rotational_elements import ( rotational_period_earth, rotational_period_jupiter, rotational_period_mars, diff --git a/src/poliastro/constants/general.py b/src/hapsira/constants/general.py similarity index 100% rename from src/poliastro/constants/general.py rename to src/hapsira/constants/general.py diff --git a/src/poliastro/constants/mean_elements.py b/src/hapsira/constants/mean_elements.py similarity index 100% rename from src/poliastro/constants/mean_elements.py rename to src/hapsira/constants/mean_elements.py diff --git a/src/poliastro/constants/rotational_elements.py b/src/hapsira/constants/rotational_elements.py similarity index 100% rename from src/poliastro/constants/rotational_elements.py rename to src/hapsira/constants/rotational_elements.py diff --git a/src/poliastro/core/__init__.py b/src/hapsira/core/__init__.py similarity index 100% rename from src/poliastro/core/__init__.py rename to src/hapsira/core/__init__.py diff --git a/src/poliastro/core/angles.py b/src/hapsira/core/angles.py similarity index 100% rename from src/poliastro/core/angles.py rename to src/hapsira/core/angles.py diff --git a/src/poliastro/core/czml_utils.py b/src/hapsira/core/czml_utils.py similarity index 98% rename from src/poliastro/core/czml_utils.py rename to src/hapsira/core/czml_utils.py index 8e15e894d..54313646b 100644 --- a/src/poliastro/core/czml_utils.py +++ b/src/hapsira/core/czml_utils.py @@ -1,7 +1,7 @@ from numba import njit as jit import numpy as np -from poliastro._math.linalg import norm +from hapsira._math.linalg import norm @jit diff --git a/src/poliastro/core/earth_atmosphere/__init__.py b/src/hapsira/core/earth_atmosphere/__init__.py similarity index 100% rename from src/poliastro/core/earth_atmosphere/__init__.py rename to src/hapsira/core/earth_atmosphere/__init__.py diff --git a/src/poliastro/core/earth_atmosphere/jacchia.py b/src/hapsira/core/earth_atmosphere/jacchia.py similarity index 89% rename from src/poliastro/core/earth_atmosphere/jacchia.py rename to src/hapsira/core/earth_atmosphere/jacchia.py index 007d8d3ab..e1c93cfec 100644 --- a/src/poliastro/core/earth_atmosphere/jacchia.py +++ b/src/hapsira/core/earth_atmosphere/jacchia.py @@ -45,12 +45,8 @@ @jit def _O_and_O2_correction(alt, Texo, Z, CN2, CO2, CO, CAr, CHe, CH, CM, WM): for iz in range(90, alt): - CO2[iz] = CO2[iz] * ( - 10.0 ** (-0.07 * (1.0 + np.tanh(0.18 * (Z[iz] - 111.0)))) - ) - CO[iz] = CO[iz] * ( - 10.0 ** (-0.24 * np.exp(-0.009 * (Z[iz] - 97.7) ** 2)) - ) + CO2[iz] = CO2[iz] * (10.0 ** (-0.07 * (1.0 + np.tanh(0.18 * (Z[iz] - 111.0))))) + CO[iz] = CO[iz] * (10.0 ** (-0.24 * np.exp(-0.009 * (Z[iz] - 97.7) ** 2))) CM[iz] = CN2[iz] + CO2[iz] + CO[iz] + CAr[iz] + CHe[iz] + CH[iz] WM[iz] = ( wmN2 * CN2[iz] @@ -112,13 +108,9 @@ def _H_correction(alt, Texo, x, y, Z, CN2, CO2, CO, CAr, CHe, CH, CM, WM, T): def _altitude_profile(alt, Texo, x, y, E5M, E6P): # Raise Value Error if alt < 90 km or alt > 2500 km. if alt < 90 or 2500 < alt: - raise ValueError( - "Jacchia77 has been implemented in range 90km - 2500km." - ) + raise ValueError("Jacchia77 has been implemented in range 90km - 2500km.") - alt = int( - alt + 1 - ) # in fortran the upper limits are included. in python are not. + alt = int(alt + 1) # in fortran the upper limits are included. in python are not. Texo = int(Texo) Z = [0.0 for _ in range(alt)] @@ -173,10 +165,7 @@ def _altitude_profile(alt, Texo, x, y, E5M, E6P): G1 = (1 + Z[iz] / R0) ** (-2) E6P[iz - 90] = E6P[iz - 91] * np.exp( -0.5897446 - * ( - G1 * E5M[iz - 90] / T[iz] - + G0 * E5M[iz - 91] / T[iz - 1] - ) + * (G1 * E5M[iz - 90] / T[iz] + G0 * E5M[iz - 91] / T[iz - 1]) ) x = E5M[iz - 90] / wm0 @@ -204,9 +193,7 @@ def _altitude_profile(alt, Texo, x, y, E5M, E6P): _O_and_O2_correction(alt, Texo, Z, CN2, CO2, CO, CAr, CHe, CH, CM, WM) if 500 <= alt: - _H_correction( - alt, Texo, x, y, Z, CN2, CO2, CO, CAr, CHe, CH, CM, WM, T - ) + _H_correction(alt, Texo, x, y, Z, CN2, CO2, CO, CAr, CHe, CH, CM, WM, T) return ( Z, diff --git a/src/poliastro/core/earth_atmosphere/util.py b/src/hapsira/core/earth_atmosphere/util.py similarity index 100% rename from src/poliastro/core/earth_atmosphere/util.py rename to src/hapsira/core/earth_atmosphere/util.py diff --git a/src/poliastro/core/elements.py b/src/hapsira/core/elements.py similarity index 96% rename from src/poliastro/core/elements.py rename to src/hapsira/core/elements.py index 19d7ece0c..a9be9bd08 100644 --- a/src/poliastro/core/elements.py +++ b/src/hapsira/core/elements.py @@ -8,9 +8,9 @@ import numpy as np from numpy import cos, cross, sin, sqrt -from poliastro._math.linalg import norm -from poliastro.core.angles import E_to_nu, F_to_nu -from poliastro.core.util import rotation_matrix +from hapsira._math.linalg import norm +from hapsira.core.angles import E_to_nu, F_to_nu +from hapsira.core.util import rotation_matrix @jit @@ -97,7 +97,7 @@ def rv_pqw(k, p, ecc, nu): Examples -------- - >>> from poliastro.constants import GM_earth + >>> from hapsira.constants import GM_earth >>> k = GM_earth.value # Earth gravitational parameter >>> ecc = 0.3 # Eccentricity >>> h = 60000e6 # Angular momentum of the orbit (m**2 / s) @@ -109,9 +109,9 @@ def rv_pqw(k, p, ecc, nu): v = [-5753.30180931 -1328.66813933 0] [m]/[s] """ - pqw = np.array( - [[cos(nu), sin(nu), 0], [-sin(nu), ecc + cos(nu), 0]] - ) * np.array([[p / (1 + ecc * cos(nu))], [sqrt(k / p)]]) + pqw = np.array([[cos(nu), sin(nu), 0], [-sin(nu), ecc + cos(nu), 0]]) * np.array( + [[p / (1 + ecc * cos(nu))], [sqrt(k / p)]] + ) return pqw @@ -196,9 +196,7 @@ def coe2rv_many(k, p, ecc, inc, raan, argp, nu): # Disabling pylint warning, see https://github.com/PyCQA/pylint/issues/2910 for i in prange(n): # pylint: disable=not-an-iterable - rr[i, :], vv[i, :] = coe2rv( - k[i], p[i], ecc[i], inc[i], raan[i], argp[i], nu[i] - ) + rr[i, :], vv[i, :] = coe2rv(k[i], p[i], ecc[i], inc[i], raan[i], argp[i], nu[i]) return rr, vv @@ -360,7 +358,7 @@ def rv2coe(k, r, v, tol=1e-8): Examples -------- - >>> from poliastro.bodies import Earth + >>> from hapsira.bodies import Earth >>> from astropy import units as u >>> k = Earth.k.to_value(u.km ** 3 / u.s ** 2) >>> r = np.array([-6045., -3490., 2500.]) @@ -555,10 +553,6 @@ def mee2rv(p, f, g, h, k, L): + alpha2 * f ) ) - vz = ( - (2 / s2) - * (np.sqrt(k / p)) - * (h * np.cos(L) + k * np.sin(L) + f * h + g * k) - ) + vz = (2 / s2) * (np.sqrt(k / p)) * (h * np.cos(L) + k * np.sin(L) + f * h + g * k) return np.array([rx, ry, rz]), np.array([vx, vy, vz]) diff --git a/src/poliastro/core/events.py b/src/hapsira/core/events.py similarity index 93% rename from src/poliastro/core/events.py rename to src/hapsira/core/events.py index 27404ad47..921ba0c80 100644 --- a/src/poliastro/core/events.py +++ b/src/hapsira/core/events.py @@ -1,9 +1,9 @@ from numba import njit as jit import numpy as np -from poliastro._math.linalg import norm -from poliastro.core.elements import coe_rotation_matrix, rv2coe -from poliastro.core.util import planetocentric_to_AltAz +from hapsira._math.linalg import norm +from hapsira.core.elements import coe_rotation_matrix, rv2coe +from hapsira.core.util import planetocentric_to_AltAz @jit @@ -51,10 +51,7 @@ def eclipse_function(k, u_, r_sec, R_sec, R_primary, umbra=True): ((R_primary**2) * (1 + ecc * np.cos(nu)) ** 2) + (p**2) * (cos_psi**2) - p**2 - + pm - * (2 * p * R_primary * cos_psi) - * (1 + ecc * np.cos(nu)) - * sin_delta_shadow + + pm * (2 * p * R_primary * cos_psi) * (1 + ecc * np.cos(nu)) * sin_delta_shadow ) return shadow_function diff --git a/src/poliastro/core/fixed.py b/src/hapsira/core/fixed.py similarity index 100% rename from src/poliastro/core/fixed.py rename to src/hapsira/core/fixed.py diff --git a/src/poliastro/core/flybys.py b/src/hapsira/core/flybys.py similarity index 98% rename from src/poliastro/core/flybys.py rename to src/hapsira/core/flybys.py index f4c82e053..be8e8d656 100644 --- a/src/poliastro/core/flybys.py +++ b/src/hapsira/core/flybys.py @@ -4,7 +4,7 @@ import numpy as np from numpy import cross -from poliastro._math.linalg import norm +from hapsira._math.linalg import norm @jit diff --git a/src/poliastro/core/iod.py b/src/hapsira/core/iod.py similarity index 93% rename from src/poliastro/core/iod.py rename to src/hapsira/core/iod.py index e9ae9f414..601705ff2 100644 --- a/src/poliastro/core/iod.py +++ b/src/hapsira/core/iod.py @@ -2,8 +2,8 @@ import numpy as np from numpy import cross, pi -from poliastro._math.linalg import norm -from poliastro._math.special import hyp2f1b, stumpff_c2 as c2, stumpff_c3 as c3 +from hapsira._math.linalg import norm +from hapsira._math.special import hyp2f1b, stumpff_c2 as c2, stumpff_c3 as c3 @jit @@ -29,7 +29,7 @@ def vallado(k, r0, r, tof, M, prograde, lowpath, numiter, rtol): \dot{g} = 1 - \frac{y}{r} \\ \end{align} - Where y(z) is a function that depends on the :py:mod:`poliastro.core.stumpff` coefficients: + Where y(z) is a function that depends on the :py:mod:`hapsira.core.stumpff` coefficients: .. math:: @@ -80,10 +80,10 @@ def vallado(k, r0, r, tof, M, prograde, lowpath, numiter, rtol): Examples -------- - >>> from poliastro.core.iod import vallado + >>> from hapsira.core.iod import vallado >>> from astropy import units as u >>> import numpy as np - >>> from poliastro.bodies import Earth + >>> from hapsira.bodies import Earth >>> k = Earth.k.to(u.km ** 3 / u.s ** 2) >>> r1 = np.array([5000, 10000, 2100]) * u.km # Initial position vector >>> r2 = np.array([-14600, 2500, 7000]) * u.km # Final position vector @@ -102,10 +102,10 @@ def vallado(k, r0, r, tof, M, prograde, lowpath, numiter, rtol): """ # TODO: expand for the multi-revolution case. - # Issue: https://github.com/poliastro/poliastro/issues/858 + # Issue: https://github.com/hapsira/hapsira/issues/858 if M > 0: raise NotImplementedError( - "Multi-revolution scenario not supported for Vallado. See issue https://github.com/poliastro/poliastro/issues/858" + "Multi-revolution scenario not supported for Vallado. See issue https://github.com/hapsira/hapsira/issues/858" ) t_m = 1 if prograde else -1 @@ -140,10 +140,7 @@ def vallado(k, r0, r, tof, M, prograde, lowpath, numiter, rtol): * (1.0 / c3(psi)) * (1.0 - norm_r0_times_norm_r * np.sqrt(c2(psi)) / A) ) - y = ( - norm_r0_plus_norm_r - + A * (psi * c3(psi) - 1) / c2(psi) ** 0.5 - ) + y = norm_r0_plus_norm_r + A * (psi * c3(psi) - 1) / c2(psi) ** 0.5 xi = np.sqrt(y / c2(psi)) tof_new = (xi**3 * c3(psi) + A * np.sqrt(y)) / np.sqrt(k) @@ -212,9 +209,7 @@ def izzo(k, r1, r2, tof, M, prograde, lowpath, numiter, rtol): # Check collinearity of r1 and r2 if not cross(r1, r2).any(): - raise ValueError( - "Lambert solution cannot be computed for collinear vectors" - ) + raise ValueError("Lambert solution cannot be computed for collinear vectors") # Chord c = r2 - r1 @@ -253,9 +248,7 @@ def izzo(k, r1, r2, tof, M, prograde, lowpath, numiter, rtol): sigma = np.sqrt(1 - rho**2) # Compute the radial and tangential components at r0 and r - V_r1, V_r2, V_t1, V_t2 = _reconstruct( - x, y, r1_norm, r2_norm, ll, gamma, rho, sigma - ) + V_r1, V_r2, V_t1, V_t2 = _reconstruct(x, y, r1_norm, r2_norm, ll, gamma, rho, sigma) # Solve for the initial and final velocity v1 = V_r1 * (r1 / r1_norm) + V_t1 * i_t1 @@ -364,16 +357,14 @@ def _tof_equation_p(x, y, T, ll): @jit def _tof_equation_p2(x, y, T, dT, ll): - return (3 * T + 5 * x * dT + 2 * (1 - ll**2) * ll**3 / y**3) / ( - 1 - x**2 - ) + return (3 * T + 5 * x * dT + 2 * (1 - ll**2) * ll**3 / y**3) / (1 - x**2) @jit def _tof_equation_p3(x, y, _, dT, ddT, ll): - return ( - 7 * x * ddT + 8 * dT - 6 * (1 - ll**2) * ll**5 * x / y**5 - ) / (1 - x**2) + return (7 * x * ddT + 8 * dT - 6 * (1 - ll**2) * ll**5 * x / y**5) / ( + 1 - x**2 + ) @jit @@ -412,7 +403,7 @@ def _initial_guess(T, ll, M, lowpath): # elif T_1 < T < T_0 # Corrected initial guess, # piecewise equation right after expression (30) in the original paper is incorrect - # See https://github.com/poliastro/poliastro/issues/1362 + # See https://github.com/hapsira/hapsira/issues/1362 x_0 = np.exp(np.log(2) * np.log(T / T_0) / np.log(T_1 / T_0)) - 1 return x_0 diff --git a/src/poliastro/core/maneuver.py b/src/hapsira/core/maneuver.py similarity index 96% rename from src/poliastro/core/maneuver.py rename to src/hapsira/core/maneuver.py index 7ce6b20e8..548e5aea6 100644 --- a/src/poliastro/core/maneuver.py +++ b/src/hapsira/core/maneuver.py @@ -4,8 +4,8 @@ import numpy as np from numpy import cross -from poliastro._math.linalg import norm -from poliastro.core.elements import coe_rotation_matrix, rv2coe, rv_pqw +from hapsira._math.linalg import norm +from hapsira.core.elements import coe_rotation_matrix, rv2coe, rv_pqw @jit @@ -122,9 +122,7 @@ def bielliptic(k, r_b, r_f, rv): a_trans2 = (r_b + r_f) / 2 dv_a = np.sqrt(2 * k / r_i - k / a_trans1) - v_i - dv_b = np.sqrt(2 * k / r_b - k / a_trans2) - np.sqrt( - 2 * k / r_b - k / a_trans1 - ) + dv_b = np.sqrt(2 * k / r_b - k / a_trans2) - np.sqrt(2 * k / r_b - k / a_trans1) dv_c = np.sqrt(k / r_f) - np.sqrt(2 * k / r_f - k / a_trans2) dv_a = np.array([0, dv_a, 0]) diff --git a/src/poliastro/core/perturbations.py b/src/hapsira/core/perturbations.py similarity index 95% rename from src/poliastro/core/perturbations.py rename to src/hapsira/core/perturbations.py index e37ca354e..eb76a3582 100644 --- a/src/poliastro/core/perturbations.py +++ b/src/hapsira/core/perturbations.py @@ -1,8 +1,8 @@ from numba import njit as jit import numpy as np -from poliastro._math.linalg import norm -from poliastro.core.events import line_of_sight as line_of_sight_fast +from hapsira._math.linalg import norm +from hapsira.core.events import line_of_sight as line_of_sight_fast @jit @@ -66,7 +66,7 @@ def J3_perturbation(t0, state, k, J3, R): ----- The J3 accounts for the oblateness of the attractor. The formula is given in Howard Curtis, problem 12.8 - This perturbation has not been fully validated, see https://github.com/poliastro/poliastro/pull/398 + This perturbation has not been fully validated, see https://github.com/hapsira/hapsira/pull/398 """ r_vec = state[:3] @@ -156,7 +156,7 @@ def atmospheric_drag(t0, state, k, C_D, A_over_m, rho): Notes ----- This function provides the acceleration due to atmospheric drag, as - computed by a model from poliastro.earth.atmosphere + computed by a model from hapsira.earth.atmosphere """ v_vec = state[3:] @@ -195,10 +195,7 @@ def third_body(t0, state, k, k_third, perturbation_body): """ body_r = perturbation_body(t0) delta_r = body_r - state[:3] - return ( - k_third * delta_r / norm(delta_r) ** 3 - - k_third * body_r / norm(body_r) ** 3 - ) + return k_third * delta_r / norm(delta_r) ** 3 - k_third * body_r / norm(body_r) ** 3 def radiation_pressure(t0, state, k, R, C_R, A_over_m, Wdivc_s, star): diff --git a/src/hapsira/core/propagation/__init__.py b/src/hapsira/core/propagation/__init__.py new file mode 100644 index 000000000..5460386d5 --- /dev/null +++ b/src/hapsira/core/propagation/__init__.py @@ -0,0 +1,35 @@ +"""Low level propagation algorithms.""" + +from hapsira.core.propagation.base import func_twobody +from hapsira.core.propagation.cowell import cowell +from hapsira.core.propagation.danby import danby, danby_coe +from hapsira.core.propagation.farnocchia import ( + farnocchia_coe, + farnocchia_rv as farnocchia, +) +from hapsira.core.propagation.gooding import gooding, gooding_coe +from hapsira.core.propagation.markley import markley, markley_coe +from hapsira.core.propagation.mikkola import mikkola, mikkola_coe +from hapsira.core.propagation.pimienta import pimienta, pimienta_coe +from hapsira.core.propagation.recseries import recseries, recseries_coe +from hapsira.core.propagation.vallado import vallado + +__all__ = [ + "cowell", + "func_twobody", + "farnocchia_coe", + "farnocchia", + "vallado", + "mikkola_coe", + "mikkola", + "markley_coe", + "markley", + "pimienta_coe", + "pimienta", + "gooding_coe", + "gooding", + "danby_coe", + "danby", + "recseries_coe", + "recseries", +] diff --git a/src/poliastro/core/propagation/base.py b/src/hapsira/core/propagation/base.py similarity index 100% rename from src/poliastro/core/propagation/base.py rename to src/hapsira/core/propagation/base.py diff --git a/src/poliastro/core/propagation/cowell.py b/src/hapsira/core/propagation/cowell.py similarity index 92% rename from src/poliastro/core/propagation/cowell.py rename to src/hapsira/core/propagation/cowell.py index 196bb19e6..876545b11 100644 --- a/src/poliastro/core/propagation/cowell.py +++ b/src/hapsira/core/propagation/cowell.py @@ -1,7 +1,7 @@ import numpy as np -from poliastro._math.ivp import DOP853, solve_ivp -from poliastro.core.propagation.base import func_twobody +from hapsira._math.ivp import DOP853, solve_ivp +from hapsira.core.propagation.base import func_twobody def cowell(k, r, v, tofs, rtol=1e-11, *, events=None, f=func_twobody): diff --git a/src/poliastro/core/propagation/danby.py b/src/hapsira/core/propagation/danby.py similarity index 92% rename from src/poliastro/core/propagation/danby.py rename to src/hapsira/core/propagation/danby.py index 6762a5fc5..f6a71c2cc 100644 --- a/src/poliastro/core/propagation/danby.py +++ b/src/hapsira/core/propagation/danby.py @@ -1,8 +1,8 @@ from numba import njit as jit import numpy as np -from poliastro.core.angles import E_to_M, F_to_M, nu_to_E, nu_to_F -from poliastro.core.elements import coe2rv, rv2coe +from hapsira.core.angles import E_to_M, F_to_M, nu_to_E, nu_to_F +from hapsira.core.elements import coe2rv, rv2coe @jit @@ -62,9 +62,7 @@ def danby_coe(k, p, ecc, inc, raan, argp, nu, tof, numiter=20, rtol=1e-8): else: delta = -f / fp delta_star = -f / (fp + 0.5 * delta * fpp) - deltak = -f / ( - fp + 0.5 * delta_star * fpp + delta_star**2 * fppp / 6 - ) + deltak = -f / (fp + 0.5 * delta_star * fpp + delta_star**2 * fppp / 6) E = E + deltak n += 1 else: diff --git a/src/poliastro/core/propagation/farnocchia.py b/src/hapsira/core/propagation/farnocchia.py similarity index 96% rename from src/poliastro/core/propagation/farnocchia.py rename to src/hapsira/core/propagation/farnocchia.py index ba5295bab..d20e7124b 100644 --- a/src/poliastro/core/propagation/farnocchia.py +++ b/src/hapsira/core/propagation/farnocchia.py @@ -1,7 +1,7 @@ from numba import njit as jit import numpy as np -from poliastro.core.angles import ( +from hapsira.core.angles import ( D_to_M, D_to_nu, E_to_M, @@ -15,7 +15,7 @@ nu_to_E, nu_to_F, ) -from poliastro.core.elements import coe2rv, rv2coe +from hapsira.core.elements import coe2rv, rv2coe @jit @@ -28,10 +28,7 @@ def _kepler_equation_prime_near_parabolic(D, M, ecc): x = (ecc - 1.0) / (ecc + 1.0) * (D**2) assert abs(x) < 1 S = dS_x_alt(ecc, x) - return ( - np.sqrt(2.0 / (1.0 + ecc)) - + np.sqrt(2.0 / (1.0 + ecc) ** 3) * (D**2) * S - ) + return np.sqrt(2.0 / (1.0 + ecc)) + np.sqrt(2.0 / (1.0 + ecc) ** 3) * (D**2) * S @jit @@ -88,8 +85,7 @@ def D_to_M_near_parabolic(D, ecc): assert abs(x) < 1 S = S_x(ecc, x) return ( - np.sqrt(2.0 / (1.0 + ecc)) * D - + np.sqrt(2.0 / (1.0 + ecc) ** 3) * (D**3) * S + np.sqrt(2.0 / (1.0 + ecc)) * D + np.sqrt(2.0 / (1.0 + ecc) ** 3) * (D**3) * S ) diff --git a/src/poliastro/core/propagation/gooding.py b/src/hapsira/core/propagation/gooding.py similarity index 94% rename from src/poliastro/core/propagation/gooding.py rename to src/hapsira/core/propagation/gooding.py index 9d0185e9c..59f53bc0b 100644 --- a/src/poliastro/core/propagation/gooding.py +++ b/src/hapsira/core/propagation/gooding.py @@ -1,8 +1,8 @@ from numba import njit as jit import numpy as np -from poliastro.core.angles import E_to_M, E_to_nu, nu_to_E -from poliastro.core.elements import coe2rv, rv2coe +from hapsira.core.angles import E_to_M, E_to_nu, nu_to_E +from hapsira.core.elements import coe2rv, rv2coe @jit diff --git a/src/poliastro/core/propagation/markley.py b/src/hapsira/core/propagation/markley.py similarity index 90% rename from src/poliastro/core/propagation/markley.py rename to src/hapsira/core/propagation/markley.py index 8c5d30e2d..2cedb5352 100644 --- a/src/poliastro/core/propagation/markley.py +++ b/src/hapsira/core/propagation/markley.py @@ -1,14 +1,14 @@ from numba import njit as jit import numpy as np -from poliastro.core.angles import ( +from hapsira.core.angles import ( E_to_M, E_to_nu, _kepler_equation, _kepler_equation_prime, nu_to_E, ) -from poliastro.core.elements import coe2rv, rv2coe +from hapsira.core.elements import coe2rv, rv2coe @jit @@ -22,9 +22,7 @@ def markley_coe(k, p, ecc, inc, raan, argp, nu, tof): M = (M + np.pi) % (2 * np.pi) - np.pi # Equation (20) - alpha = (3 * np.pi**2 + 1.6 * (np.pi - np.abs(M)) / (1 + ecc)) / ( - np.pi**2 - 6 - ) + alpha = (3 * np.pi**2 + 1.6 * (np.pi - np.abs(M)) / (1 + ecc)) / (np.pi**2 - 6) # Equation (5) d = 3 * (1 - ecc) + alpha * ecc @@ -52,10 +50,7 @@ def markley_coe(k, p, ecc, inc, raan, argp, nu, tof): delta3 = -f0 / (f1 - 0.5 * f0 * f2 / f1) delta4 = -f0 / (f1 + 0.5 * delta3 * f2 + 1 / 6 * delta3**2 * f3) delta5 = -f0 / ( - f1 - + 0.5 * delta4 * f2 - + 1 / 6 * delta4**2 * f3 - + 1 / 24 * delta4**3 * f4 + f1 + 0.5 * delta4 * f2 + 1 / 6 * delta4**2 * f3 + 1 / 24 * delta4**3 * f4 ) E += delta5 diff --git a/src/poliastro/core/propagation/mikkola.py b/src/hapsira/core/propagation/mikkola.py similarity index 93% rename from src/poliastro/core/propagation/mikkola.py rename to src/hapsira/core/propagation/mikkola.py index c42ee73bb..f40d18412 100644 --- a/src/poliastro/core/propagation/mikkola.py +++ b/src/hapsira/core/propagation/mikkola.py @@ -1,7 +1,7 @@ from numba import njit as jit import numpy as np -from poliastro.core.angles import ( +from hapsira.core.angles import ( D_to_nu, E_to_M, E_to_nu, @@ -10,7 +10,7 @@ nu_to_E, nu_to_F, ) -from poliastro.core.elements import coe2rv, rv2coe +from hapsira.core.elements import coe2rv, rv2coe @jit @@ -69,10 +69,7 @@ def mikkola_coe(k, p, ecc, inc, raan, argp, nu, tof): u2 = -f / (f1 + 0.5 * f2 * u1) u3 = -f / (f1 + 0.5 * f2 * u2 + (1.0 / 6.0) * f3 * u2**2) u4 = -f / ( - f1 - + 0.5 * f2 * u3 - + (1.0 / 6.0) * f3 * u3**2 - + (1.0 / 24.0) * f4 * (u3**3) + f1 + 0.5 * f2 * u3 + (1.0 / 6.0) * f3 * u3**2 + (1.0 / 24.0) * f4 * (u3**3) ) u5 = -f / ( f1 diff --git a/src/poliastro/core/propagation/pimienta.py b/src/hapsira/core/propagation/pimienta.py similarity index 96% rename from src/poliastro/core/propagation/pimienta.py rename to src/hapsira/core/propagation/pimienta.py index a61e91a80..3914466ad 100644 --- a/src/poliastro/core/propagation/pimienta.py +++ b/src/hapsira/core/propagation/pimienta.py @@ -1,8 +1,8 @@ from numba import njit as jit import numpy as np -from poliastro.core.angles import E_to_M, E_to_nu, nu_to_E -from poliastro.core.elements import coe2rv, rv2coe +from hapsira.core.angles import E_to_M, E_to_nu, nu_to_E +from hapsira.core.elements import coe2rv, rv2coe @jit @@ -135,11 +135,7 @@ def pimienta_coe(k, p, ecc, inc, raan, argp, nu, tof): + 1.0378368e9 * c13 * x_bar3 + 39916800 * c11 * x_bar ) - f11 = ( - 5.4486432e10 * c15 * x_bar4 - + 3.1135104e9 * c13 * x_bar2 - + 39916800 * c11 - ) + f11 = 5.4486432e10 * c15 * x_bar4 + 3.1135104e9 * c13 * x_bar2 + 39916800 * c11 f12 = 2.17945728e11 * c15 * x_bar3 + 6.2270208e9 * c13 * x_bar f13 = 6.53837184 * c15 * x_bar2 + 6.2270208e9 * c13 f14 = 1.307674368e12 * c15 * x_bar @@ -173,13 +169,7 @@ def pimienta_coe(k, p, ecc, inc, raan, argp, nu, tof): h4 = f1 + g1 * u3 * f2 + g2 * u3**2 * f3 + g3 * u3**3 * f4 u4 = -f / h4 - h5 = ( - f1 - + g1 * u4 * f2 - + g2 * u4**2 * f3 - + g3 * u4**3 * f4 - + g4 * u4**4 * f5 - ) + h5 = f1 + g1 * u4 * f2 + g2 * u4**2 * f3 + g3 * u4**3 * f4 + g4 * u4**4 * f5 u5 = -f / h5 h6 = ( diff --git a/src/poliastro/core/propagation/recseries.py b/src/hapsira/core/propagation/recseries.py similarity index 93% rename from src/poliastro/core/propagation/recseries.py rename to src/hapsira/core/propagation/recseries.py index 1602828af..ae99feba2 100644 --- a/src/poliastro/core/propagation/recseries.py +++ b/src/hapsira/core/propagation/recseries.py @@ -1,8 +1,8 @@ from numba import njit as jit import numpy as np -from poliastro.core.angles import E_to_M, E_to_nu, nu_to_E -from poliastro.core.elements import coe2rv, rv2coe +from hapsira.core.angles import E_to_M, E_to_nu, nu_to_E +from hapsira.core.elements import coe2rv, rv2coe @jit @@ -53,9 +53,7 @@ def recseries_coe( elif method == "order": Niter = order else: - raise ValueError( - "Unknown recursion termination method ('rtol','order')." - ) + raise ValueError("Unknown recursion termination method ('rtol','order').") # compute eccentric anomaly through recursive series E = M + ecc # Using initial guess from vallado to improve convergence diff --git a/src/poliastro/core/propagation/vallado.py b/src/hapsira/core/propagation/vallado.py similarity index 94% rename from src/poliastro/core/propagation/vallado.py rename to src/hapsira/core/propagation/vallado.py index 6ac61be93..d52fc3a97 100644 --- a/src/poliastro/core/propagation/vallado.py +++ b/src/hapsira/core/propagation/vallado.py @@ -1,8 +1,8 @@ from numba import njit as jit import numpy as np -from poliastro._math.linalg import norm -from poliastro._math.special import stumpff_c2 as c2, stumpff_c3 as c3 +from hapsira._math.linalg import norm +from hapsira._math.special import stumpff_c2 as c2, stumpff_c3 as c3 @jit @@ -90,9 +90,7 @@ def vallado(k, r0, v0, tof, numiter): (-2 * k * alpha * tof) / ( dot_r0v0 - + np.sign(tof) - * np.sqrt(-k / alpha) - * (1 - norm_r0 * alpha) + + np.sign(tof) * np.sqrt(-k / alpha) * (1 - norm_r0 * alpha) ) ) ) diff --git a/src/poliastro/core/sensors.py b/src/hapsira/core/sensors.py similarity index 100% rename from src/poliastro/core/sensors.py rename to src/hapsira/core/sensors.py diff --git a/src/poliastro/core/spheroid_location.py b/src/hapsira/core/spheroid_location.py similarity index 94% rename from src/poliastro/core/spheroid_location.py rename to src/hapsira/core/spheroid_location.py index 895291624..dd6b54651 100644 --- a/src/poliastro/core/spheroid_location.py +++ b/src/hapsira/core/spheroid_location.py @@ -3,7 +3,7 @@ from numba import njit as jit import numpy as np -from poliastro._math.linalg import norm +from hapsira._math.linalg import norm @jit @@ -179,12 +179,8 @@ def cartesian_to_ellipsoidal(a, c, x, y, z): e2_ = e2 / (1 - e2) p = np.sqrt(x**2 + y**2) th = np.arctan(z * a / (p * c)) - lon = np.arctan2( - y, x - ) # Use `arctan2` so that lon lies in the range: [-pi, +pi] - lat = np.arctan( - (z + e2_ * c * np.sin(th) ** 3) / (p - e2 * a * np.cos(th) ** 3) - ) + lon = np.arctan2(y, x) # Use `arctan2` so that lon lies in the range: [-pi, +pi] + lat = np.arctan((z + e2_ * c * np.sin(th) ** 3) / (p - e2 * a * np.cos(th) ** 3)) v = a / np.sqrt(1 - e2 * np.sin(lat) ** 2) h = ( diff --git a/src/poliastro/core/threebody/__init__.py b/src/hapsira/core/threebody/__init__.py similarity index 100% rename from src/poliastro/core/threebody/__init__.py rename to src/hapsira/core/threebody/__init__.py diff --git a/src/poliastro/core/threebody/cr3bp_quantities_calculations.py b/src/hapsira/core/threebody/cr3bp_quantities_calculations.py similarity index 100% rename from src/poliastro/core/threebody/cr3bp_quantities_calculations.py rename to src/hapsira/core/threebody/cr3bp_quantities_calculations.py diff --git a/src/hapsira/core/thrust/__init__.py b/src/hapsira/core/thrust/__init__.py new file mode 100644 index 000000000..873a4c3f7 --- /dev/null +++ b/src/hapsira/core/thrust/__init__.py @@ -0,0 +1,5 @@ +from hapsira.core.thrust.change_a_inc import change_a_inc +from hapsira.core.thrust.change_argp import change_argp +from hapsira.core.thrust.change_ecc_inc import change_ecc_inc + +__all__ = ["change_a_inc", "change_argp", "change_ecc_inc"] diff --git a/src/poliastro/core/thrust/change_a_inc.py b/src/hapsira/core/thrust/change_a_inc.py similarity index 96% rename from src/poliastro/core/thrust/change_a_inc.py rename to src/hapsira/core/thrust/change_a_inc.py index b3e951a4b..2dbb3abed 100644 --- a/src/poliastro/core/thrust/change_a_inc.py +++ b/src/hapsira/core/thrust/change_a_inc.py @@ -2,8 +2,8 @@ import numpy as np from numpy import cross -from poliastro._math.linalg import norm -from poliastro.core.elements import circular_velocity +from hapsira._math.linalg import norm +from hapsira.core.elements import circular_velocity @jit diff --git a/src/poliastro/core/thrust/change_argp.py b/src/hapsira/core/thrust/change_argp.py similarity index 94% rename from src/poliastro/core/thrust/change_argp.py rename to src/hapsira/core/thrust/change_argp.py index 4bfa22e4b..ffaf7d888 100644 --- a/src/poliastro/core/thrust/change_argp.py +++ b/src/hapsira/core/thrust/change_argp.py @@ -2,8 +2,8 @@ import numpy as np from numpy import cross -from poliastro._math.linalg import norm -from poliastro.core.elements import circular_velocity, rv2coe +from hapsira._math.linalg import norm +from hapsira.core.elements import circular_velocity, rv2coe @jit diff --git a/src/poliastro/core/thrust/change_ecc_inc.py b/src/hapsira/core/thrust/change_ecc_inc.py similarity index 84% rename from src/poliastro/core/thrust/change_ecc_inc.py rename to src/hapsira/core/thrust/change_ecc_inc.py index b014c4c5f..dfa97c86b 100644 --- a/src/poliastro/core/thrust/change_ecc_inc.py +++ b/src/hapsira/core/thrust/change_ecc_inc.py @@ -9,8 +9,8 @@ import numpy as np from numpy import cross -from poliastro._math.linalg import norm -from poliastro.core.elements import ( +from hapsira._math.linalg import norm +from hapsira.core.elements import ( circular_velocity, eccentricity_vector, rv2coe, @@ -34,11 +34,7 @@ def beta(ecc_0, ecc_f, inc_0, inc_f, argp): * ( ecc_0 - ecc_f - + np.log( - (1 + ecc_f) - * (-1 + ecc_0) - / ((1 + ecc_0) * (-1 + ecc_f)) - ) + + np.log((1 + ecc_f) * (-1 + ecc_0) / ((1 + ecc_0) * (-1 + ecc_f))) ) ) ) @@ -48,12 +44,7 @@ def beta(ecc_0, ecc_f, inc_0, inc_f, argp): @jit def delta_V(V_0, ecc_0, ecc_f, beta_): """Compute required increment of velocity.""" - return ( - 2 - * V_0 - * np.abs(np.arcsin(ecc_0) - np.arcsin(ecc_f)) - / (3 * np.cos(beta_)) - ) + return 2 * V_0 * np.abs(np.arcsin(ecc_0) - np.arcsin(ecc_f)) / (3 * np.cos(beta_)) @jit diff --git a/src/poliastro/core/thrust/change_ecc_quasioptimal.py b/src/hapsira/core/thrust/change_ecc_quasioptimal.py similarity index 88% rename from src/poliastro/core/thrust/change_ecc_quasioptimal.py rename to src/hapsira/core/thrust/change_ecc_quasioptimal.py index f94ceb30d..c78d2487c 100644 --- a/src/poliastro/core/thrust/change_ecc_quasioptimal.py +++ b/src/hapsira/core/thrust/change_ecc_quasioptimal.py @@ -1,7 +1,7 @@ from numba import njit as jit import numpy as np -from poliastro.core.elements import circular_velocity +from hapsira.core.elements import circular_velocity @jit diff --git a/src/poliastro/core/util.py b/src/hapsira/core/util.py similarity index 100% rename from src/poliastro/core/util.py rename to src/hapsira/core/util.py diff --git a/src/poliastro/czml/__init__.py b/src/hapsira/czml/__init__.py similarity index 100% rename from src/poliastro/czml/__init__.py rename to src/hapsira/czml/__init__.py diff --git a/src/poliastro/czml/extract_czml.py b/src/hapsira/czml/extract_czml.py similarity index 89% rename from src/poliastro/czml/extract_czml.py rename to src/hapsira/czml/extract_czml.py index 7fc23004f..9b696397f 100644 --- a/src/poliastro/czml/extract_czml.py +++ b/src/hapsira/czml/extract_czml.py @@ -19,8 +19,8 @@ from erfa import gd2gce import numpy as np -from poliastro.bodies import Earth -from poliastro.core.czml_utils import ( +from hapsira.bodies import Earth +from hapsira.core.czml_utils import ( project_point_on_ellipsoid as project_point_on_ellipsoid_fast, ) @@ -66,7 +66,7 @@ def __init__( N : int Default number of sample points. Unless otherwise specified, the number of sampled data points will be N when calling add_orbit() - attractor : poliastro.bodies.Body + attractor : hapsira.bodies.Body Attractor of the orbits pr_map : str A URL to the projection of the defined ellipsoid (UV map). @@ -137,9 +137,7 @@ def _init_orbit_packet_cords_(self, i, rtol): # FIXME: Unused rtol with default propagation method, # should we just get rid of it? cords = ( - self.orbits[i][0] - .propagate(TimeDelta(k * h)) - .r.to_value(u.m)[..., None] + self.orbits[i][0].propagate(TimeDelta(k * h)).r.to_value(u.m)[..., None] ) cords = np.insert(cords, 0, h.value * k, axis=0) @@ -177,9 +175,7 @@ def _init_groundtrack_packet_cords_(self, i, rtol): # FIXME: Unused rtol with default propagation method, # should we just get rid of it? cords = ( - self.orbits[i][0] - .propagate(TimeDelta(k * h)) - .r.to_value(u.m)[..., None] + self.orbits[i][0].propagate(TimeDelta(k * h)).r.to_value(u.m)[..., None] ) cords = np.insert(cords, 0, h.value * k, axis=0) @@ -208,9 +204,7 @@ def _init_czml_(self): start=self.start_epoch, end=self.end_epoch, value=Clock( - currentTime=self.start_epoch.datetime.replace( - tzinfo=timezone.utc - ), + currentTime=self.start_epoch.datetime.replace(tzinfo=timezone.utc), multiplier=60, ), ), @@ -306,16 +300,12 @@ def add_ground_station( pckt = Packet( id="GS" + str(self.gs_n), description=id_description, - availability=TimeInterval( - start=self.start_epoch, end=self.end_epoch - ), + availability=TimeInterval(start=self.start_epoch, end=self.end_epoch), position=Position(cartesian=pos), label=Label( show=label_show, text=label_text, - font=label_font - if label_font is not None - else "11pt Lucida Console", + font=label_font if label_font is not None else "11pt Lucida Console", fillColor=Color(rgba=label_fill_color) if label_fill_color is not None else None, @@ -354,7 +344,7 @@ def add_orbit( Parameters ---------- - orbit : poliastro.twobody.orbit.Orbit + orbit : hapsira.twobody.orbit.Orbit Orbit to be added rtol : float Maximum relative error permitted @@ -410,17 +400,13 @@ def add_orbit( self.orbits.append([orbit, N, orbit.epoch]) cartesian_cords = self._init_orbit_packet_cords_(self.i, rtol=rtol) - start_epoch = Time( - min(self.orbits[self.i][2], self.start_epoch), format="isot" - ) + start_epoch = Time(min(self.orbits[self.i][2], self.start_epoch), format="isot") pckt = Packet( id=self.i, name=id_name, description=id_description, - availability=TimeInterval( - start=self.start_epoch, end=self.end_epoch - ), + availability=TimeInterval(start=self.start_epoch, end=self.end_epoch), position=Position( interpolationDegree=5, interpolationAlgorithm=InterpolationAlgorithms.LAGRANGE, @@ -433,23 +419,17 @@ def add_orbit( show=path_show, width=path_width, material=Material( - solidColor=SolidColorMaterial( - color=Color.from_list(path_color) - ) + solidColor=SolidColorMaterial(color=Color.from_list(path_color)) ) if path_color is not None else Material( - solidColor=SolidColorMaterial( - color=Color.from_list([255, 255, 0]) - ) + solidColor=SolidColorMaterial(color=Color.from_list([255, 255, 0])) ), resolution=120, ), label=Label( text=label_text, - font=label_font - if label_font is not None - else "11pt Lucida Console", + font=label_font if label_font is not None else "11pt Lucida Console", show=label_show, fillColor=Color(rgba=label_fill_color) if label_fill_color is not None @@ -466,14 +446,10 @@ def add_orbit( if groundtrack_show: groundtrack_color = path_color - groundtrack_cords = self._init_groundtrack_packet_cords_( - self.i, rtol=rtol - ) + groundtrack_cords = self._init_groundtrack_packet_cords_(self.i, rtol=rtol) pckt = Packet( id="groundtrack" + str(self.i), - availability=TimeInterval( - start=self.start_epoch, end=self.end_epoch - ), + availability=TimeInterval(start=self.start_epoch, end=self.end_epoch), position=Position( interpolationDegree=5, interpolationAlgorithm=InterpolationAlgorithms.LAGRANGE, @@ -497,12 +473,8 @@ def add_orbit( ), resolution=60, width=groundtrack_width, - leadTime=groundtrack_lead_time - if groundtrack_lead_time - else 100, - trailTime=groundtrack_trail_time - if groundtrack_trail_time - else 100, + leadTime=groundtrack_lead_time if groundtrack_lead_time else 100, + trailTime=groundtrack_trail_time if groundtrack_trail_time else 100, ), ) self.packets.append(pckt) @@ -571,9 +543,7 @@ def add_trajectory( """ positions = ( - positions.represent_as(CartesianRepresentation) - .get_xyz(1) - .to_value(u.m) + positions.represent_as(CartesianRepresentation).get_xyz(1).to_value(u.m) ) epochs = Time(epochs, format="isot") @@ -598,9 +568,7 @@ def add_trajectory( id=self.i, name=id_name, description=id_description, - availability=TimeInterval( - start=self.start_epoch, end=self.end_epoch - ), + availability=TimeInterval(start=self.start_epoch, end=self.end_epoch), position=Position( interpolationDegree=5, interpolationAlgorithm=InterpolationAlgorithms.LAGRANGE, @@ -613,23 +581,17 @@ def add_trajectory( show=path_show, width=path_width, material=Material( - solidColor=SolidColorMaterial( - color=Color.from_list(path_color) - ) + solidColor=SolidColorMaterial(color=Color.from_list(path_color)) ) if path_color is not None else Material( - solidColor=SolidColorMaterial( - color=Color.from_list([255, 255, 0]) - ) + solidColor=SolidColorMaterial(color=Color.from_list([255, 255, 0])) ), resolution=120, ), label=Label( text=label_text, - font=label_font - if label_font is not None - else "11pt Lucida Console", + font=label_font if label_font is not None else "11pt Lucida Console", show=label_show, fillColor=Color(rgba=label_fill_color) if label_fill_color is not None diff --git a/src/poliastro/earth/__init__.py b/src/hapsira/earth/__init__.py similarity index 86% rename from src/poliastro/earth/__init__.py rename to src/hapsira/earth/__init__.py index ef8bc912d..55865dcff 100644 --- a/src/poliastro/earth/__init__.py +++ b/src/hapsira/earth/__init__.py @@ -5,11 +5,11 @@ from astropy import units as u import numpy as np -from poliastro.bodies import Earth -from poliastro.core.perturbations import J2_perturbation -from poliastro.core.propagation import func_twobody -from poliastro.earth.enums import EarthGravity -from poliastro.twobody.propagation import CowellPropagator +from hapsira.bodies import Earth +from hapsira.core.perturbations import J2_perturbation +from hapsira.core.propagation import func_twobody +from hapsira.earth.enums import EarthGravity +from hapsira.twobody.propagation import CowellPropagator class EarthSatellite: @@ -61,7 +61,7 @@ def propagate(self, tof, atmosphere=None, gravity=None, *args): tof : ~astropy.units.Quantity, ~astropy.time.Time, ~astropy.time.TimeDelta Scalar time to propagate. atmosphere: - a callable model from poliastro.earth.atmosphere + a callable model from hapsira.earth.atmosphere gravity : EarthGravity There are two possible values, SPHERICAL and J2. Only J2 is implemented at the moment. Default value is None. *args: @@ -79,10 +79,7 @@ def propagate(self, tof, atmosphere=None, gravity=None, *args): def ad(t0, state, k, perturbations): if perturbations: return np.sum( - [ - f(t0=t0, state=state, k=k, **p) - for f, p in perturbations.items() - ], + [f(t0=t0, state=state, k=k, **p) for f, p in perturbations.items()], axis=0, ) else: diff --git a/src/hapsira/earth/atmosphere/__init__.py b/src/hapsira/earth/atmosphere/__init__.py new file mode 100644 index 000000000..f659f7951 --- /dev/null +++ b/src/hapsira/earth/atmosphere/__init__.py @@ -0,0 +1,4 @@ +from hapsira.earth.atmosphere.coesa62 import COESA62 +from hapsira.earth.atmosphere.coesa76 import COESA76 + +__all__ = ["COESA62", "COESA76"] diff --git a/src/poliastro/earth/atmosphere/base.py b/src/hapsira/earth/atmosphere/base.py similarity index 97% rename from src/poliastro/earth/atmosphere/base.py rename to src/hapsira/earth/atmosphere/base.py index 4cef9ae26..dc5eeb2f7 100644 --- a/src/poliastro/earth/atmosphere/base.py +++ b/src/hapsira/earth/atmosphere/base.py @@ -2,7 +2,7 @@ import astropy.units as u -from poliastro.core.earth_atmosphere.util import ( +from hapsira.core.earth_atmosphere.util import ( _check_altitude as _check_altitude_fast, _get_index as _get_index_fast, ) diff --git a/src/poliastro/earth/atmosphere/coesa62.py b/src/hapsira/earth/atmosphere/coesa62.py similarity index 98% rename from src/poliastro/earth/atmosphere/coesa62.py rename to src/hapsira/earth/atmosphere/coesa62.py index b7bcf7c34..ee6f5dcc4 100644 --- a/src/poliastro/earth/atmosphere/coesa62.py +++ b/src/hapsira/earth/atmosphere/coesa62.py @@ -58,8 +58,8 @@ from astropy.utils.data import get_pkg_data_filename import numpy as np -from poliastro._math.integrate import quad -from poliastro.earth.atmosphere.base import COESA +from hapsira._math.integrate import quad +from hapsira.earth.atmosphere.base import COESA # Constants come from the original paper to achieve pure implementation r0 = 6356.766 * u.km @@ -179,8 +179,7 @@ def pressure(self, alt, geometric=True): # Putting g = (g0*(r0/(r0 +z))**2) in (g * dz / z - zb + Tb/Lb) # and integrating it. integrand = quad( - lambda x: (g0_v * (r0_v / (r0_v + x)) ** 2) - / (x - zb_v + Tb_v / Lb_v), + lambda x: (g0_v * (r0_v / (r0_v + x)) ** 2) / (x - zb_v + Tb_v / Lb_v), zb_v, z_v, ) diff --git a/src/poliastro/earth/atmosphere/coesa76.py b/src/hapsira/earth/atmosphere/coesa76.py similarity index 98% rename from src/poliastro/earth/atmosphere/coesa76.py rename to src/hapsira/earth/atmosphere/coesa76.py index 6b3f7b79c..465d5d435 100644 --- a/src/poliastro/earth/atmosphere/coesa76.py +++ b/src/hapsira/earth/atmosphere/coesa76.py @@ -48,7 +48,7 @@ from astropy.utils.data import get_pkg_data_filename import numpy as np -from poliastro.earth.atmosphere.base import COESA +from hapsira.earth.atmosphere.base import COESA # Following constants come from original U.S Atmosphere 1962 paper so a pure # model of this atmosphere can be implemented @@ -175,9 +175,7 @@ def temperature(self, alt, geometric=True): else: T10 = 360.0 * u.K _gamma = self.Lb_levels[9] / (Tinf - T10) - epsilon = ( - (z - self.zb_levels[10]) * (r0 + self.zb_levels[10]) / (r0 + z) - ) + epsilon = (z - self.zb_levels[10]) * (r0 + self.zb_levels[10]) / (r0 + z) T = Tinf - (Tinf - T10) * np.exp(-_gamma * epsilon) return T.to(u.K) diff --git a/src/poliastro/earth/atmosphere/data/coesa62.dat b/src/hapsira/earth/atmosphere/data/coesa62.dat similarity index 100% rename from src/poliastro/earth/atmosphere/data/coesa62.dat rename to src/hapsira/earth/atmosphere/data/coesa62.dat diff --git a/src/poliastro/earth/atmosphere/data/coesa76.dat b/src/hapsira/earth/atmosphere/data/coesa76.dat similarity index 100% rename from src/poliastro/earth/atmosphere/data/coesa76.dat rename to src/hapsira/earth/atmosphere/data/coesa76.dat diff --git a/src/poliastro/earth/atmosphere/data/coesa76_p.dat b/src/hapsira/earth/atmosphere/data/coesa76_p.dat similarity index 100% rename from src/poliastro/earth/atmosphere/data/coesa76_p.dat rename to src/hapsira/earth/atmosphere/data/coesa76_p.dat diff --git a/src/poliastro/earth/atmosphere/data/coesa76_rho.dat b/src/hapsira/earth/atmosphere/data/coesa76_rho.dat similarity index 100% rename from src/poliastro/earth/atmosphere/data/coesa76_rho.dat rename to src/hapsira/earth/atmosphere/data/coesa76_rho.dat diff --git a/src/poliastro/earth/atmosphere/jacchia.py b/src/hapsira/earth/atmosphere/jacchia.py similarity index 98% rename from src/poliastro/earth/atmosphere/jacchia.py rename to src/hapsira/earth/atmosphere/jacchia.py index 5496cf19b..c2695248b 100644 --- a/src/poliastro/earth/atmosphere/jacchia.py +++ b/src/hapsira/earth/atmosphere/jacchia.py @@ -1,7 +1,7 @@ from astropy import units as u import numpy as np -from poliastro.core.earth_atmosphere.jacchia import ( +from hapsira.core.earth_atmosphere.jacchia import ( _altitude_profile as _altitude_profile_fast, _H_correction as _H_correction_fast, _O_and_O2_correction as _O_and_O2_correction_fast, diff --git a/src/poliastro/earth/enums.py b/src/hapsira/earth/enums.py similarity index 100% rename from src/poliastro/earth/enums.py rename to src/hapsira/earth/enums.py diff --git a/src/poliastro/earth/plotting/__init__.py b/src/hapsira/earth/plotting/__init__.py similarity index 56% rename from src/poliastro/earth/plotting/__init__.py rename to src/hapsira/earth/plotting/__init__.py index 2e4b187e3..54c16833e 100644 --- a/src/poliastro/earth/plotting/__init__.py +++ b/src/hapsira/earth/plotting/__init__.py @@ -1,5 +1,5 @@ """Plotting routines focused on Earth capabilities.""" -from poliastro.earth.plotting.groundtrack import GroundtrackPlotter +from hapsira.earth.plotting.groundtrack import GroundtrackPlotter __all__ = ["GroundtrackPlotter"] diff --git a/src/poliastro/earth/plotting/groundtrack.py b/src/hapsira/earth/plotting/groundtrack.py similarity index 95% rename from src/poliastro/earth/plotting/groundtrack.py rename to src/hapsira/earth/plotting/groundtrack.py index a089f7096..b078f9508 100644 --- a/src/poliastro/earth/plotting/groundtrack.py +++ b/src/hapsira/earth/plotting/groundtrack.py @@ -10,9 +10,9 @@ ) import plotly.graph_objects as go -from poliastro.bodies import Earth -from poliastro.earth.plotting.utils import EARTH_PALETTE -from poliastro.twobody.sampling import EpochsArray +from hapsira.bodies import Earth +from hapsira.earth.plotting.utils import EARTH_PALETTE +from hapsira.twobody.sampling import EpochsArray class GroundtrackPlotter: @@ -82,7 +82,7 @@ def _get_raw_coords(self, orb, t_deltas): Parameters ---------- - orb : ~poliastro.twobody.Orbit + orb : ~hapsira.twobody.Orbit Orbit to be propagated t_deltas : ~astropy.time.DeltaTime Desired observation time @@ -137,7 +137,7 @@ def _trace_groundtrack(self, orb, t_deltas, label, line_style): Parameters ---------- - orb : ~poliastro.twobody.Orbit + orb : ~hapsira.twobody.Orbit EarthSatellite's associated Orbit t_deltas : ~astropy.time.DeltaTime Collection of epochs @@ -173,7 +173,7 @@ def _trace_position(self, ss, label, marker): Parameters ---------- - ss : ~poliastro.twobody.Orbit + ss : ~hapsira.twobody.Orbit EarthSatellite's orbit label : string Label for the orbit @@ -211,7 +211,7 @@ def plot(self, earth_orb, t_span, label, color, line_style={}, marker={}): Parameters ---------- - earth_orb : ~poliastro.earth.EarthSatellite + earth_orb : ~hapsira.earth.EarthSatellite Desired Earth's satellite to who's grountrack will be plotted t_span : ~astropy.time.TimeDelta A collection of epochs diff --git a/src/poliastro/earth/plotting/utils.py b/src/hapsira/earth/plotting/utils.py similarity index 100% rename from src/poliastro/earth/plotting/utils.py rename to src/hapsira/earth/plotting/utils.py diff --git a/src/poliastro/earth/util.py b/src/hapsira/earth/util.py similarity index 97% rename from src/poliastro/earth/util.py rename to src/hapsira/earth/util.py index b30a4d782..a89d5f983 100644 --- a/src/poliastro/earth/util.py +++ b/src/hapsira/earth/util.py @@ -3,8 +3,8 @@ from astropy.time import Time import numpy as np -from poliastro import constants -from poliastro.util import wrap_angle +from hapsira import constants +from hapsira.util import wrap_angle @u.quantity_input(ltan=u.hourangle) diff --git a/src/poliastro/ephem.py b/src/hapsira/ephem.py similarity index 86% rename from src/poliastro/ephem.py rename to src/hapsira/ephem.py index bdc6d170c..5f46772ef 100644 --- a/src/poliastro/ephem.py +++ b/src/hapsira/ephem.py @@ -10,14 +10,16 @@ ) from astroquery.jplhorizons import Horizons -from poliastro._math.interpolate import interp1d, sinc_interp, spline_interp -from poliastro.bodies import Earth -from poliastro.frames import Planes -from poliastro.frames.util import get_frame -from poliastro.twobody.sampling import EpochsArray -from poliastro.warnings import TimeScaleWarning - -EPHEM_FORMAT = "Ephemerides at {num} epochs from {start} ({start_scale}) to {end} ({end_scale})" +from hapsira._math.interpolate import interp1d, sinc_interp, spline_interp +from hapsira.bodies import Earth +from hapsira.frames import Planes +from hapsira.frames.util import get_frame +from hapsira.twobody.sampling import EpochsArray +from hapsira.warnings import TimeScaleWarning + +EPHEM_FORMAT = ( + "Ephemerides at {num} epochs from {start} ({start_scale}) to {end} ({end_scale})" +) def build_ephem_interpolant(body, epochs, attractor=Earth): @@ -28,8 +30,8 @@ def build_ephem_interpolant(body, epochs, attractor=Earth): body : Body Source body. epochs : ~astropy.time.Time - Array of time values, can be generated with poliastro.util.time_range. - attractor : ~poliastro.bodies.Body, optional + Array of time values, can be generated with hapsira.util.time_range. + attractor : ~hapsira.bodies.Body, optional Attractor, default to Earth. Returns @@ -65,15 +67,9 @@ def _interp_1d(arr): y = _interp_1d(coordinates.y.value) << xyz_unit z = _interp_1d(coordinates.z.value) << xyz_unit - d_x = ( - _interp_1d(coordinates.differentials["s"].d_x.value) << d_xyz_unit - ) - d_y = ( - _interp_1d(coordinates.differentials["s"].d_y.value) << d_xyz_unit - ) - d_z = ( - _interp_1d(coordinates.differentials["s"].d_z.value) << d_xyz_unit - ) + d_x = _interp_1d(coordinates.differentials["s"].d_x.value) << d_xyz_unit + d_y = _interp_1d(coordinates.differentials["s"].d_y.value) << d_xyz_unit + d_z = _interp_1d(coordinates.differentials["s"].d_z.value) << d_xyz_unit return CartesianRepresentation( x, y, z, differentials=CartesianDifferential(d_x, d_y, d_z) @@ -134,7 +130,7 @@ class Ephem: Coordinates with velocities. epochs : astropy.time.Time Epochs corresponding to the coordinates. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Reference plane of the coordinates. """ @@ -172,21 +168,19 @@ def plane(self): return self._plane @classmethod - def from_body( - cls, body, epochs, *, attractor=None, plane=Planes.EARTH_EQUATOR - ): + def from_body(cls, body, epochs, *, attractor=None, plane=Planes.EARTH_EQUATOR): """Return `Ephem` for a `SolarSystemPlanet` at certain epochs. Parameters ---------- - body : ~poliastro.bodies.SolarSystemPlanet + body : ~hapsira.bodies.SolarSystemPlanet Body. epochs : ~astropy.time.Time Epochs to sample the body positions. - attractor : ~poliastro.bodies.SolarSystemPlanet, optional + attractor : ~hapsira.bodies.SolarSystemPlanet, optional Body to use as central location, if not given the Solar System Barycenter will be used. - plane : ~poliastro.frames.Planes, optional + plane : ~hapsira.frames.Planes, optional Fundamental plane of the frame, default to Earth Equator. """ @@ -203,9 +197,7 @@ def from_body( ) r, v = get_body_barycentric_posvel(body.name, epochs) - coordinates = r.with_differentials( - v.represent_as(CartesianDifferential) - ) + coordinates = r.with_differentials(v.represent_as(CartesianDifferential)) destination_frame = _get_destination_frame(attractor, plane, epochs) @@ -236,10 +228,10 @@ def from_horizons( Name of the body to query for. epochs : ~astropy.time.Time Epochs to sample the body positions. - attractor : ~poliastro.bodies.SolarSystemPlanet, optional + attractor : ~hapsira.bodies.SolarSystemPlanet, optional Body to use as central location, if not given the Solar System Barycenter will be used. - plane : ~poliastro.frames.Planes, optional + plane : ~hapsira.frames.Planes, optional Fundamental plane of the frame, default to Earth Equator. id_type : NoneType or str, optional Use "smallbody" for Asteroids and Comets and None (default) to first @@ -298,11 +290,11 @@ def from_orbit( Parameters ---------- - orbit : ~poliastro.twobody.orbit.Orbit + orbit : ~hapsira.twobody.orbit.Orbit Orbit. epochs : ~astropy.time.Time Epochs to sample the orbit positions. - plane : ~poliastro.frames.Planes, optional + plane : ~hapsira.frames.Planes, optional Fundamental plane of the frame, default to Earth Equator. """ @@ -319,7 +311,7 @@ def sample(self, epochs=None, *, interpolator=SplineInterpolator()): epochs : ~astropy.time.Time, optional Epochs to sample the ephemerides, if not given the original one from the object will be used. - interpolator : ~poliastro.ephem.BaseInterpolator, optional + interpolator : ~hapsira.ephem.BaseInterpolator, optional Interpolation method to use for epochs outside of the original ones, default to splines. diff --git a/src/poliastro/examples.py b/src/hapsira/examples.py similarity index 94% rename from src/poliastro/examples.py rename to src/hapsira/examples.py index 2948d965b..f4d18cf48 100644 --- a/src/poliastro/examples.py +++ b/src/hapsira/examples.py @@ -1,8 +1,8 @@ """Example data.""" from astropy import time, units as u -from poliastro.bodies import Earth, Sun -from poliastro.twobody import Orbit +from hapsira.bodies import Earth, Sun +from hapsira.twobody import Orbit iss = Orbit.from_vectors( Earth, diff --git a/src/hapsira/frames/__init__.py b/src/hapsira/frames/__init__.py new file mode 100644 index 000000000..733ee07ab --- /dev/null +++ b/src/hapsira/frames/__init__.py @@ -0,0 +1,5 @@ +from hapsira.frames.enums import Planes + +__all__ = [ + "Planes", +] diff --git a/src/poliastro/frames/ecliptic.py b/src/hapsira/frames/ecliptic.py similarity index 90% rename from src/poliastro/frames/ecliptic.py rename to src/hapsira/frames/ecliptic.py index 0f5f95825..65c229162 100644 --- a/src/poliastro/frames/ecliptic.py +++ b/src/hapsira/frames/ecliptic.py @@ -19,7 +19,7 @@ import erfa import numpy as np -from poliastro.frames.equatorial import GCRS +from hapsira.frames.equatorial import GCRS __all__ = [ "GeocentricSolarEcliptic", @@ -44,9 +44,7 @@ class GeocentricSolarEcliptic(BaseEclipticFrame): obstime = TimeAttribute(default=DEFAULT_OBSTIME) -@frame_transform_graph.transform( - DynamicMatrixTransform, GCRS, GeocentricSolarEcliptic -) +@frame_transform_graph.transform(DynamicMatrixTransform, GCRS, GeocentricSolarEcliptic) def gcrs_to_geosolarecliptic(gcrs_coo, to_frame): if not to_frame.obstime.isscalar: raise ValueError( @@ -76,9 +74,7 @@ def gcrs_to_geosolarecliptic(gcrs_coo, to_frame): return matrix_product(rot_matrix, _earth_detilt_matrix) -@frame_transform_graph.transform( - DynamicMatrixTransform, GeocentricSolarEcliptic, GCRS -) +@frame_transform_graph.transform(DynamicMatrixTransform, GeocentricSolarEcliptic, GCRS) def geosolarecliptic_to_gcrs(from_coo, gcrs_frame): return matrix_transpose(gcrs_to_geosolarecliptic(gcrs_frame, from_coo)) @@ -104,7 +100,5 @@ def _make_rotation_matrix_from_reprs(start_representation, end_representation): ) # Negation is required # This line works around some input/output quirks of Astropy's rotation_matrix() - matrix = np.array( - rotation_matrix(rotation_angle, rotation_axis.xyz.value.tolist()) - ) + matrix = np.array(rotation_matrix(rotation_angle, rotation_axis.xyz.value.tolist())) return matrix diff --git a/src/poliastro/frames/enums.py b/src/hapsira/frames/enums.py similarity index 100% rename from src/poliastro/frames/enums.py rename to src/hapsira/frames/enums.py diff --git a/src/poliastro/frames/equatorial.py b/src/hapsira/frames/equatorial.py similarity index 91% rename from src/poliastro/frames/equatorial.py rename to src/hapsira/frames/equatorial.py index 7934829c7..92a6c8c15 100644 --- a/src/poliastro/frames/equatorial.py +++ b/src/hapsira/frames/equatorial.py @@ -16,7 +16,7 @@ from astropy.coordinates.builtin_frames.utils import DEFAULT_OBSTIME import numpy as np -from poliastro.bodies import ( +from hapsira.bodies import ( Jupiter, Mars, Mercury, @@ -50,12 +50,8 @@ class _PlanetaryICRS(BaseRADecFrame): obstime = TimeAttribute(default=DEFAULT_OBSTIME) def __new__(cls, *args, **kwargs): - frame_transform_graph.transform(AffineTransform, cls, ICRS)( - cls.to_icrs - ) - frame_transform_graph.transform(AffineTransform, ICRS, cls)( - cls.from_icrs - ) + frame_transform_graph.transform(AffineTransform, cls, ICRS)(cls.to_icrs) + frame_transform_graph.transform(AffineTransform, ICRS, cls)(cls.from_icrs) frame_transform_graph.transform( FunctionTransformWithFiniteDifference, cls, cls )(cls.self_transform) @@ -66,9 +62,7 @@ def __new__(cls, *args, **kwargs): def to_icrs(planet_coo, _): # This is just an origin translation so without a distance it cannot go ahead if isinstance(planet_coo.data, UnitSphericalRepresentation): - raise u.UnitsError( - _NEED_ORIGIN_HINT.format(planet_coo.__class__.__name__) - ) + raise u.UnitsError(_NEED_ORIGIN_HINT.format(planet_coo.__class__.__name__)) if planet_coo.data.differentials: bary_sun_pos, bary_sun_vel = get_body_barycentric_posvel( @@ -90,9 +84,7 @@ def to_icrs(planet_coo, _): def from_icrs(icrs_coo, planet_frame): # This is just an origin translation so without a distance it cannot go ahead if isinstance(icrs_coo.data, UnitSphericalRepresentation): - raise u.UnitsError( - _NEED_ORIGIN_HINT.format(icrs_coo.__class__.__name__) - ) + raise u.UnitsError(_NEED_ORIGIN_HINT.format(icrs_coo.__class__.__name__)) if icrs_coo.data.differentials: bary_sun_pos, bary_sun_vel = get_body_barycentric_posvel( diff --git a/src/poliastro/frames/fixed.py b/src/hapsira/frames/fixed.py similarity index 92% rename from src/poliastro/frames/fixed.py rename to src/hapsira/frames/fixed.py index 91ea90b36..5c2501579 100644 --- a/src/poliastro/frames/fixed.py +++ b/src/hapsira/frames/fixed.py @@ -10,7 +10,7 @@ from astropy.coordinates.builtin_frames.utils import DEFAULT_OBSTIME from astropy.coordinates.matrix_utilities import rotation_matrix -from poliastro.bodies import ( +from hapsira.bodies import ( Jupiter, Mars, Mercury, @@ -21,8 +21,8 @@ Uranus, Venus, ) -from poliastro.constants import J2000 -from poliastro.core.fixed import ( +from hapsira.constants import J2000 +from hapsira.core.fixed import ( jupiter_rot_elements_at_epoch as jupiter_rot_elements_at_epoch_fast, mars_rot_elements_at_epoch as mars_rot_elements_at_epoch_fast, mercury_rot_elements_at_epoch as mercury_rot_elements_at_epoch_fast, @@ -33,7 +33,7 @@ uranus_rot_elements_at_epoch as uranus_rot_elements_at_epoch_fast, venus_rot_elements_at_epoch as venus_rot_elements_at_epoch_fast, ) -from poliastro.frames.equatorial import ( +from hapsira.frames.equatorial import ( JupiterICRS, MarsICRS, MercuryICRS, @@ -64,12 +64,12 @@ class _PlanetaryFixed(BaseRADecFrame): obstime = TimeAttribute(default=DEFAULT_OBSTIME) def __new__(cls, *args, **kwargs): - frame_transform_graph.transform( - FunctionTransform, cls, cls.equatorial - )(cls.to_equatorial) - frame_transform_graph.transform( - FunctionTransform, cls.equatorial, cls - )(cls.from_equatorial) + frame_transform_graph.transform(FunctionTransform, cls, cls.equatorial)( + cls.to_equatorial + ) + frame_transform_graph.transform(FunctionTransform, cls.equatorial, cls)( + cls.from_equatorial + ) return super().__new__(cls) @@ -103,9 +103,7 @@ def from_equatorial(equatorial_coo, fixed_frame): raise ValueError( f"Equatorial coordinates must be of type `HCRS`, got `{type(equatorial_coo)}` instead." ) - elif ( - fixed_frame.body != Sun and equatorial_coo.body != fixed_frame.body - ): + elif fixed_frame.body != Sun and equatorial_coo.body != fixed_frame.body: raise ValueError( "Fixed and equatorial coordinates must have the same body if the fixed frame body is not Sun" ) diff --git a/src/poliastro/frames/util.py b/src/hapsira/frames/util.py similarity index 88% rename from src/poliastro/frames/util.py rename to src/hapsira/frames/util.py index 2f25f6795..e110dd013 100644 --- a/src/poliastro/frames/util.py +++ b/src/hapsira/frames/util.py @@ -1,4 +1,4 @@ -from poliastro.bodies import ( +from hapsira.bodies import ( Earth, Jupiter, Mars, @@ -9,13 +9,13 @@ Uranus, Venus, ) -from poliastro.constants import J2000 -from poliastro.frames.ecliptic import ( +from hapsira.constants import J2000 +from hapsira.frames.ecliptic import ( GeocentricMeanEcliptic, HeliocentricEclipticJ2000, ) -from poliastro.frames.enums import Planes -from poliastro.frames.equatorial import ( +from hapsira.frames.enums import Planes +from hapsira.frames.equatorial import ( GCRS, HCRS, JupiterICRS, @@ -26,7 +26,7 @@ UranusICRS, VenusICRS, ) -from poliastro.frames.fixed import ( +from hapsira.frames.fixed import ( ITRS, JupiterFixed, MarsFixed, @@ -75,9 +75,9 @@ def get_frame(attractor, plane, obstime=J2000): Parameters ---------- - attractor : ~poliastro.bodies.Body + attractor : ~hapsira.bodies.Body Body that serves as the center of the frame. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. obstime : ~astropy.time.Time Time of the frame. diff --git a/src/poliastro/io.py b/src/hapsira/io.py similarity index 81% rename from src/poliastro/io.py rename to src/hapsira/io.py index 462d4629c..bc2f38a31 100644 --- a/src/poliastro/io.py +++ b/src/hapsira/io.py @@ -3,9 +3,9 @@ from astroquery.jplsbdb import SBDB import numpy as np -from poliastro.bodies import Sun -from poliastro.frames import Planes -from poliastro.twobody.angles import ( +from hapsira.bodies import Sun +from hapsira.frames import Planes +from hapsira.twobody.angles import ( D_to_nu, E_to_nu, F_to_nu, @@ -13,7 +13,7 @@ M_to_E, M_to_F, ) -from poliastro.twobody.orbit import Orbit +from hapsira.twobody.orbit import Orbit def orbit_from_sbdb(name, **kwargs): @@ -23,16 +23,12 @@ def orbit_from_sbdb(name, **kwargs): # No error till now ---> more than one object has been found # Contains all the name of the objects objects_name = obj["list"]["name"] - objects_name_in_str = ( - "" # Used to store them in string form each in new line - ) + objects_name_in_str = "" # Used to store them in string form each in new line for i in objects_name: objects_name_in_str += i + "\n" raise ValueError( - str(obj["count"]) - + " different objects found: \n" - + objects_name_in_str + str(obj["count"]) + " different objects found: \n" + objects_name_in_str ) if "object" not in obj.keys(): diff --git a/src/poliastro/iod/__init__.py b/src/hapsira/iod/__init__.py similarity index 56% rename from src/poliastro/iod/__init__.py rename to src/hapsira/iod/__init__.py index 303de4305..8c695591e 100644 --- a/src/poliastro/iod/__init__.py +++ b/src/hapsira/iod/__init__.py @@ -1,4 +1,4 @@ # Select default algorithm -from poliastro.iod.izzo import lambert +from hapsira.iod.izzo import lambert __all__ = ["lambert"] diff --git a/src/poliastro/iod/izzo.py b/src/hapsira/iod/izzo.py similarity index 90% rename from src/poliastro/iod/izzo.py rename to src/hapsira/iod/izzo.py index d3a7ad1dd..42af60b85 100644 --- a/src/poliastro/iod/izzo.py +++ b/src/hapsira/iod/izzo.py @@ -1,14 +1,12 @@ """Izzo's algorithm for Lambert's problem.""" from astropy import units as u -from poliastro.core.iod import izzo as izzo_fast +from hapsira.core.iod import izzo as izzo_fast kms = u.km / u.s -def lambert( - k, r0, r, tof, M=0, prograde=True, lowpath=True, numiter=35, rtol=1e-8 -): +def lambert(k, r0, r, tof, M=0, prograde=True, lowpath=True, numiter=35, rtol=1e-8): """Solves the Lambert problem using the Izzo algorithm. .. versionadded:: 0.5.0 diff --git a/src/poliastro/iod/vallado.py b/src/hapsira/iod/vallado.py similarity index 85% rename from src/poliastro/iod/vallado.py rename to src/hapsira/iod/vallado.py index dc9468dcd..a267d744e 100644 --- a/src/poliastro/iod/vallado.py +++ b/src/hapsira/iod/vallado.py @@ -1,14 +1,12 @@ """Initial orbit determination.""" from astropy import units as u -from poliastro.core.iod import vallado as vallado_fast +from hapsira.core.iod import vallado as vallado_fast kms = u.km / u.s -def lambert( - k, r0, r, tof, M=0, prograde=True, lowpath=True, numiter=35, rtol=1e-8 -): +def lambert(k, r0, r, tof, M=0, prograde=True, lowpath=True, numiter=35, rtol=1e-8): """Solves the Lambert problem. .. versionadded:: 0.3.0 @@ -57,8 +55,6 @@ def lambert( r_ = r.to_value(u.km) tof_ = tof.to_value(u.s) - v0, v = vallado_fast( - k_, r0_, r_, tof_, M, prograde, lowpath, numiter, rtol - ) + v0, v = vallado_fast(k_, r0_, r_, tof_, M, prograde, lowpath, numiter, rtol) return v0 << kms, v << kms diff --git a/src/poliastro/maneuver.py b/src/hapsira/maneuver.py similarity index 93% rename from src/poliastro/maneuver.py rename to src/hapsira/maneuver.py index 5729fd34d..224162b84 100644 --- a/src/poliastro/maneuver.py +++ b/src/hapsira/maneuver.py @@ -1,13 +1,13 @@ """Orbital maneuvers.""" from astropy import units as u -from poliastro.core.maneuver import ( +from hapsira.core.maneuver import ( bielliptic as bielliptic_fast, correct_pericenter as correct_pericenter_fast, hohmann as hohmann_fast, ) -from poliastro.iod.izzo import lambert as lambert_izzo -from poliastro.util import norm +from hapsira.iod.izzo import lambert as lambert_izzo +from hapsira.util import norm class Maneuver: @@ -36,9 +36,7 @@ def __init__(self, *impulses): """ # Validate units of the impulses provided - self.impulses = [ - self.impulse_has_valid_units(*impulse) for impulse in impulses - ] + self.impulses = [self.impulse_has_valid_units(*impulse) for impulse in impulses] self._dts, self._dvs = zip(*self.impulses) # Validate that all delta-V are three-dimensional vectors. Note that the @@ -79,7 +77,7 @@ def hohmann(cls, orbit_i, r_f): Parameters ---------- - orbit_i : poliastro.twobody.orbit.Orbit + orbit_i : hapsira.twobody.orbit.Orbit Initial orbit r_f : astropy.unit.Quantity Final orbital radius @@ -114,7 +112,7 @@ def bielliptic(cls, orbit_i, r_b, r_f): Parameters ---------- - orbit_i : poliastro.twobody.orbit.Orbit + orbit_i : hapsira.twobody.orbit.Orbit Initial orbit r_b : astropy.unit.Quantity Altitude of the intermediate orbit @@ -164,9 +162,9 @@ def lambert(cls, orbit_i, orbit_f, method=lambert_izzo, **kwargs): Parameters ---------- - orbit_i : ~poliastro.twobody.Orbit + orbit_i : ~hapsira.twobody.Orbit Initial orbit - orbit_f : ~poliastro.twobody.Orbit + orbit_f : ~hapsira.twobody.Orbit Final orbit method : function Method for solving Lambert's problem @@ -248,9 +246,7 @@ def correct_pericenter(cls, orbit, max_delta_r): ecc = orbit.ecc.value max_delta_r = max_delta_r.value - delta_t, vf_ = correct_pericenter_fast( - k, R, J2, max_delta_r, v, a, inc, ecc - ) + delta_t, vf_ = correct_pericenter_fast(k, R, J2, max_delta_r, v, a, inc, ecc) delta_t = delta_t * u.s vf_ = vf_ * u.km / u.s diff --git a/src/hapsira/plotting/__init__.py b/src/hapsira/plotting/__init__.py new file mode 100644 index 000000000..6ba5d7a09 --- /dev/null +++ b/src/hapsira/plotting/__init__.py @@ -0,0 +1,11 @@ +from hapsira.plotting.gabbard import GabbardPlotter +from hapsira.plotting.orbit.plotter import OrbitPlotter +from hapsira.plotting.porkchop import PorkchopPlotter +from hapsira.plotting.tisserand import TisserandPlotter + +__all__ = [ + "OrbitPlotter", + "GabbardPlotter", + "PorkchopPlotter", + "TisserandPlotter", +] diff --git a/src/poliastro/plotting/gabbard.py b/src/hapsira/plotting/gabbard.py similarity index 91% rename from src/poliastro/plotting/gabbard.py rename to src/hapsira/plotting/gabbard.py index 6df0d481a..4a353863c 100644 --- a/src/poliastro/plotting/gabbard.py +++ b/src/hapsira/plotting/gabbard.py @@ -1,15 +1,13 @@ from astropy import units as u from matplotlib import pyplot as plt -from poliastro.plotting.util import generate_label +from hapsira.plotting.util import generate_label class GabbardPlotter: """GabbardPlotter class.""" - def __init__( - self, ax=None, dark=False, altitude_unit=u.km, period_unit=u.min - ): + def __init__(self, ax=None, dark=False, altitude_unit=u.km, period_unit=u.min): self._ax = ax if not self._ax: if dark: @@ -39,7 +37,7 @@ def _static_gabbard_plot(self, orbits): Parameters ---------- - orbits : ~poliastro.twobody.orbit.Orbit List + orbits : ~hapsira.twobody.orbit.Orbit List The Orbits whose perigee and apogee will be plotted. """ diff --git a/src/poliastro/plotting/misc.py b/src/hapsira/plotting/misc.py similarity index 89% rename from src/poliastro/plotting/misc.py rename to src/hapsira/plotting/misc.py index 4806108c2..5575619ce 100644 --- a/src/poliastro/plotting/misc.py +++ b/src/hapsira/plotting/misc.py @@ -4,7 +4,7 @@ import astropy.units as u import erfa -from poliastro.bodies import ( +from hapsira.bodies import ( Earth, Jupiter, Mars, @@ -14,8 +14,8 @@ Uranus, Venus, ) -from poliastro.frames import Planes -from poliastro.plotting import OrbitPlotter +from hapsira.frames import Planes +from hapsira.plotting import OrbitPlotter def plot_solar_system( @@ -37,14 +37,14 @@ def plot_solar_system( A list of strings containing the labels of the bodies. outer : bool, optional Whether to print the outer Solar System, default to True. - backend : ~poliastro.plotting.orbit.backends._base.OrbitPlotterBackend + backend : ~hapsira.plotting.orbit.backends._base.OrbitPlotterBackend An instance of ``OrbitPlotterBackend`` for rendendering the scene. length_scale_units : ~astropy.units.Unit Desired units of lenght used for representing distances. Returns ------- - ~poliastro.plotting.orbit.plotter.OrbitPlotter + ~hapsira.plotting.orbit.plotter.OrbitPlotter An object for plotting orbits. """ diff --git a/src/poliastro/plotting/orbit/__init__.py b/src/hapsira/plotting/orbit/__init__.py similarity index 60% rename from src/poliastro/plotting/orbit/__init__.py rename to src/hapsira/plotting/orbit/__init__.py index 3bac98913..7dce971e7 100644 --- a/src/poliastro/plotting/orbit/__init__.py +++ b/src/hapsira/plotting/orbit/__init__.py @@ -1,5 +1,5 @@ """A sub-package holding all orbit plotting utilities.""" -from poliastro.plotting.orbit.plotter import OrbitPlotter +from hapsira.plotting.orbit.plotter import OrbitPlotter __all__ = ["OrbitPlotter"] diff --git a/src/poliastro/plotting/orbit/backends/__init__.py b/src/hapsira/plotting/orbit/backends/__init__.py similarity index 89% rename from src/poliastro/plotting/orbit/backends/__init__.py rename to src/hapsira/plotting/orbit/backends/__init__.py index d269541bd..83924615e 100644 --- a/src/poliastro/plotting/orbit/backends/__init__.py +++ b/src/hapsira/plotting/orbit/backends/__init__.py @@ -1,8 +1,8 @@ """A sub-package collecting all support orbit plotter backends.""" -from poliastro.plotting.orbit.backends.matplotlib import Matplotlib2D -from poliastro.plotting.orbit.backends.plotly import Plotly2D, Plotly3D +from hapsira.plotting.orbit.backends.matplotlib import Matplotlib2D +from hapsira.plotting.orbit.backends.plotly import Plotly2D, Plotly3D DEFAULT_ORBIT_PLOTTER_BACKENDS_2D = { "matplotlib2D": Matplotlib2D, diff --git a/src/poliastro/plotting/orbit/backends/_base.py b/src/hapsira/plotting/orbit/backends/_base.py similarity index 100% rename from src/poliastro/plotting/orbit/backends/_base.py rename to src/hapsira/plotting/orbit/backends/_base.py diff --git a/src/poliastro/plotting/orbit/backends/matplotlib.py b/src/hapsira/plotting/orbit/backends/matplotlib.py similarity index 98% rename from src/poliastro/plotting/orbit/backends/matplotlib.py rename to src/hapsira/plotting/orbit/backends/matplotlib.py index 67e090f57..1f489bab9 100644 --- a/src/poliastro/plotting/orbit/backends/matplotlib.py +++ b/src/hapsira/plotting/orbit/backends/matplotlib.py @@ -5,7 +5,7 @@ from matplotlib.colors import LinearSegmentedColormap, to_rgba import numpy as np -from poliastro.plotting.orbit.backends._base import OrbitPlotterBackend +from hapsira.plotting.orbit.backends._base import OrbitPlotterBackend def _segments_from_arrays(x, y): @@ -242,9 +242,7 @@ def draw_coordinates(self, coordinates, *, colors, dashed, label): cmap = LinearSegmentedColormap.from_list( f"{colors[0]}_to_alpha", colors # Useless name ) - lc = LineCollection( - segments, linestyles=linestyle, cmap=cmap, label=label - ) + lc = LineCollection(segments, linestyles=linestyle, cmap=cmap, label=label) lc.set_array(np.linspace(1, 0, len(x))) self.ax.add_collection(lc) diff --git a/src/poliastro/plotting/orbit/backends/plotly.py b/src/hapsira/plotting/orbit/backends/plotly.py similarity index 98% rename from src/poliastro/plotting/orbit/backends/plotly.py rename to src/hapsira/plotting/orbit/backends/plotly.py index 33e403c9c..45a8d84b0 100644 --- a/src/poliastro/plotting/orbit/backends/plotly.py +++ b/src/hapsira/plotting/orbit/backends/plotly.py @@ -6,8 +6,8 @@ import plotly import plotly.graph_objects as go -from poliastro.plotting.orbit.backends._base import OrbitPlotterBackend -from poliastro.plotting.util import generate_sphere +from hapsira.plotting.orbit.backends._base import OrbitPlotterBackend +from hapsira.plotting.util import generate_sphere class BasePlotly(OrbitPlotterBackend): @@ -110,9 +110,7 @@ def draw_position(self, position, *, color, label, size): An object representing the trace of the coordinates in the scene. """ - return self.draw_sphere( - position, color=color, label=label, radius=size - ) + return self.draw_sphere(position, color=color, label=label, radius=size) def draw_impulse(self, position, *, color, label, size): """Draw an impulse into the scene. diff --git a/src/poliastro/plotting/orbit/plotter.py b/src/hapsira/plotting/orbit/plotter.py similarity index 89% rename from src/poliastro/plotting/orbit/plotter.py rename to src/hapsira/plotting/orbit/plotter.py index 64439f720..8af74a7cd 100644 --- a/src/poliastro/plotting/orbit/plotter.py +++ b/src/hapsira/plotting/orbit/plotter.py @@ -7,19 +7,17 @@ import astropy.units as u import numpy as np -from poliastro.ephem import Ephem -from poliastro.frames import Planes -import poliastro.plotting.orbit.backends as orbit_plotter_backends -from poliastro.plotting.util import BODY_COLORS, generate_label -from poliastro.twobody.mean_elements import get_mean_elements -from poliastro.twobody.sampling import EpochBounds -from poliastro.util import norm, time_range +from hapsira.ephem import Ephem +from hapsira.frames import Planes +import hapsira.plotting.orbit.backends as orbit_plotter_backends +from hapsira.plotting.util import BODY_COLORS, generate_label +from hapsira.twobody.mean_elements import get_mean_elements +from hapsira.twobody.sampling import EpochBounds +from hapsira.util import norm, time_range class Trajectory( - namedtuple( - "Trajectory", ["coordinates", "position", "colors", "dashed", "label"] - ) + namedtuple("Trajectory", ["coordinates", "position", "colors", "dashed", "label"]) ): """A class for collecting all information of a body within a plotter. @@ -47,11 +45,11 @@ def __init__( Parameters ---------- - backend : ~poliastro.plotting.orbit.backends._base.OrbitPlotterBackend + backend : ~hapsira.plotting.orbit.backends._base.OrbitPlotterBackend An instance of ``OrbitPlotterBackend`` for rendendering the scene. num_points : int, optional Number of points to use when drawing trajectories. Default to 150. - plane : ~poliastro.frames.Plane, optional + plane : ~hapsira.frames.Plane, optional Reference plane to be used when drawing the scene. Default to `EARTH_EQUATOR`. length_scale_units : ~astropy.units.Unit, optional @@ -82,7 +80,7 @@ def backend(self): Returns ------- - ~poliastro.plotting.orbit.backends._base.OrbitPlotterBackend + ~hapsira.plotting.orbit.backends._base.OrbitPlotterBackend An instance of ``OrbitPlotterBackend`` used for rendendering the scene. """ @@ -94,7 +92,7 @@ def plane(self): Returns ------- - ~poliastro.frames.Plane, optional + ~hapsira.frames.Plane, optional Reference plane to be used when drawing the scene. Default to """ @@ -129,7 +127,7 @@ def set_attractor(self, attractor): Parameters ---------- - attractor : ~poliastro.bodies.Body + attractor : ~hapsira.bodies.Body Central body. Raises @@ -150,7 +148,7 @@ def set_orbit_frame(self, orbit): Parameters ---------- - orbit : ~poliastro.twobody.Orbit + orbit : ~hapsira.twobody.Orbit Orbit to use as frame. """ @@ -161,9 +159,7 @@ def set_orbit_frame(self, orbit): if not np.allclose([norm(v) for v in (p_vec, q_vec, w_vec)], 1): raise ValueError("Vectors must be unit.") - elif not np.allclose( - [p_vec @ q_vec, q_vec @ w_vec, w_vec @ p_vec], 0 - ): + elif not np.allclose([p_vec @ q_vec, q_vec @ w_vec, w_vec @ p_vec], 0): raise ValueError("Vectors must be mutually orthogonal.") else: self._frame = p_vec, q_vec, w_vec @@ -176,7 +172,7 @@ def set_body_frame(self, body, epoch=None): Parameters ---------- - body : poliastro.bodies.SolarSystemPlanet + body : hapsira.bodies.SolarSystemPlanet Body. epoch : astropy.time.Time, optional Epoch of current position. @@ -187,9 +183,9 @@ def set_body_frame(self, body, epoch=None): from astropy import time # HACK: avoid circular dependency with ``Body.plot()`` - from poliastro.bodies import Sun - from poliastro.twobody import Orbit - from poliastro.warnings import TimeScaleWarning + from hapsira.bodies import Sun + from hapsira.twobody import Orbit + from hapsira.warnings import TimeScaleWarning if not epoch: epoch = time.Time.now().tdb @@ -338,9 +334,7 @@ def _add_trajectory(self, trajectory): if position is not None: position = ( np.asarray( - self._project( - [position.to_value(self.length_scale_units)] - ) + self._project([position.to_value(self.length_scale_units)]) ).flatten() * self.length_scale_units ) @@ -353,10 +347,7 @@ def _add_trajectory(self, trajectory): # Add the coordinates to the scene trace_coordinates = self.backend.draw_coordinates( - [ - coords.to_value(self.length_scale_units) - for coords in coordinates - ], + [coords.to_value(self.length_scale_units) for coords in coordinates], colors=colors, dashed=dashed, label=coordinates_label, @@ -388,9 +379,7 @@ def _add_trajectory(self, trajectory): self.backend.resize_limits() # Update the axis legends using the desired length scale units - self.backend.draw_axes_labels_with_length_scale_units( - self.length_scale_units - ) + self.backend.draw_axes_labels_with_length_scale_units(self.length_scale_units) return ( (trace_coordinates, trace_position) @@ -403,7 +392,7 @@ def plot(self, orbit, *, color=None, label=None, trail=False, dashed=True): Parameters ---------- - orbit : ~poliastro.twobody.orbit.Orbit + orbit : ~hapsira.twobody.orbit.Orbit Orbit to plot. color : str, optional Color of the line and the position. @@ -454,7 +443,7 @@ def plot_body_orbit( Parameters ---------- - body : poliastro.bodies.SolarSystemPlanet + body : hapsira.bodies.SolarSystemPlanet Body. epoch : astropy.time.Time Epoch of current position. @@ -478,27 +467,21 @@ def plot_body_orbit( epochs = time_range( epoch, num_values=self._num_points, end=epoch + period, scale="tdb" ) - ephem = Ephem.from_body( - body, epochs, attractor=body.parent, plane=self.plane - ) + ephem = Ephem.from_body(body, epochs, attractor=body.parent, plane=self.plane) # Get body color and label if color is None: color = BODY_COLORS.get(body.name) label = generate_label(epoch, label or str(body)) - return self.plot_ephem( - ephem, epoch, label=label, color=color, trail=trail - ) + return self.plot_ephem(ephem, epoch, label=label, color=color, trail=trail) - def plot_ephem( - self, ephem, epoch=None, *, label=None, color=None, trail=False - ): + def plot_ephem(self, ephem, epoch=None, *, label=None, color=None, trail=False): """Plot ``Ephem`` object over its sampling period. Parameters ---------- - ephem : ~poliastro.ephem.Ephem + ephem : ~hapsira.ephem.Ephem Ephemerides to plot. epoch : astropy.time.Time, optional Epoch of the current position, `None` is used if not given. @@ -551,9 +534,9 @@ def plot_maneuver( Parameters ---------- - initial_orbit : ~poliastro.twobody.orbit.Orbit + initial_orbit : ~hapsira.twobody.orbit.Orbit The base orbit for which the maneuver will be applied. - maneuver : ~poliastro.maneuver.Maneuver + maneuver : ~hapsira.maneuver.Maneuver The maneuver to be plotted. label : str, optional Label of the trajectory. @@ -579,9 +562,7 @@ def plot_maneuver( if self.backend.is_2D: final_phase_position = ( np.asarray( - self._project( - [final_phase.r.to_value(self.length_scale_units)] - ) + self._project([final_phase.r.to_value(self.length_scale_units)]) ).flatten() * self.length_scale_units ) @@ -594,9 +575,7 @@ def plot_maneuver( impulse_lines = ( [ self.backend.draw_impulse( - position=final_phase_position.to_value( - self.length_scale_units - ), + position=final_phase_position.to_value(self.length_scale_units), color=color, label=impulse_label, size=None, @@ -615,11 +594,7 @@ def plot_maneuver( orbit_phase_r = ( np.asarray( self._project( - [ - orbit_phase.r.to_value( - self.length_scale_units - ) - ] + [orbit_phase.r.to_value(self.length_scale_units)] ) ).flatten() * self.length_scale_units @@ -639,9 +614,7 @@ def plot_maneuver( # HACK: if no color is provided, get the one randomly generated # for previous impulse lines - color = ( - impulse_lines[0][0].get_color() if color is None else color - ) + color = impulse_lines[0][0].get_color() if color is None else color # Get the propagation time required before next impulse time_to_next_impulse, _ = maneuver.impulses[ith_impulse + 1] @@ -668,9 +641,7 @@ def plot_maneuver( # Finally, draw the impulse at the very beginning of the final phase impulse_label = f"Impulse {ith_impulse + 2} - {label}" impulse_lines = self.backend.draw_impulse( - position=final_phase_position.to_value( - self.length_scale_units - ), + position=final_phase_position.to_value(self.length_scale_units), color=color, label=impulse_label, size=None, diff --git a/src/poliastro/plotting/porkchop.py b/src/hapsira/plotting/porkchop.py similarity index 89% rename from src/poliastro/plotting/porkchop.py rename to src/hapsira/plotting/porkchop.py index a06ff9819..314d8c37e 100644 --- a/src/poliastro/plotting/porkchop.py +++ b/src/hapsira/plotting/porkchop.py @@ -3,7 +3,7 @@ from matplotlib import pyplot as plt import numpy as np -from poliastro.bodies import ( +from hapsira.bodies import ( Earth, Jupiter, Mars, @@ -16,9 +16,9 @@ Uranus, Venus, ) -from poliastro.maneuver import Maneuver -from poliastro.twobody.orbit import Orbit -from poliastro.util import norm +from hapsira.maneuver import Maneuver +from hapsira.twobody.orbit import Orbit +from hapsira.util import norm def _get_state(body, time): @@ -37,7 +37,7 @@ def _get_state(body, time): Pluto, ] - # We check if body belongs to poliastro.bodies + # We check if body belongs to hapsira.bodies if body in solar_system_bodies: rr, vv = coord.get_body_barycentric_posvel(body.name, time) else: @@ -56,12 +56,8 @@ def _targetting(departure_body, target_body, t_launch, t_arrival): # Transform into Orbit objects attractor = departure_body.parent - orb_dpt = Orbit.from_vectors( - attractor, rr_dpt_body, vv_dpt_body, epoch=t_launch - ) - orb_arr = Orbit.from_vectors( - attractor, rr_arr_body, vv_arr_body, epoch=t_arrival - ) + orb_dpt = Orbit.from_vectors(attractor, rr_dpt_body, vv_dpt_body, epoch=t_launch) + orb_arr = Orbit.from_vectors(attractor, rr_arr_body, vv_arr_body, epoch=t_arrival) # Define time of flight tof = orb_arr.epoch - orb_dpt.epoch @@ -106,9 +102,9 @@ class PorkchopPlotter: Parameters ---------- - departure_body: poliastro.bodies.Body + departure_body: hapsira.bodies.Body Body from which departure is done - target_body: poliastro.bodies.Body + target_body: hapsira.bodies.Body Body for targetting launch_span: astropy.time.Time Time span for launch @@ -167,9 +163,9 @@ def porkchop(self): Examples -------- - >>> from poliastro.plotting.porkchop import PorkchopPlotter - >>> from poliastro.bodies import Earth, Mars - >>> from poliastro.util import time_range + >>> from hapsira.plotting.porkchop import PorkchopPlotter + >>> from hapsira.bodies import Earth, Mars + >>> from hapsira.util import time_range >>> launch_span = time_range("2005-04-30", end="2005-10-07") >>> arrival_span = time_range("2005-11-16", end="2006-12-21") >>> porkchop_plot = PorkchopPlotter(Earth, Mars, launch_span, arrival_span) @@ -190,9 +186,7 @@ def porkchop(self): else: fig = self.ax.figure - c3_levels = np.linspace( - 0, self.max_c3.to_value(u.km**2 / u.s**2), 30 - ) + c3_levels = np.linspace(0, self.max_c3.to_value(u.km**2 / u.s**2), 30) c = self.ax.contourf( [D.to_datetime() for D in self.launch_span], @@ -227,9 +221,7 @@ def porkchop(self): linewidths=3.5, ) - self.ax.clabel( - tfl_contour, inline=1, fmt="%1.1f", colors="r", fontsize=14 - ) + self.ax.clabel(tfl_contour, inline=1, fmt="%1.1f", colors="r", fontsize=14) if self.vhp: vhp_levels = np.linspace(0, self.max_vhp.to_value(u.km / u.s), 5) diff --git a/src/poliastro/plotting/tisserand.py b/src/hapsira/plotting/tisserand.py similarity index 92% rename from src/poliastro/plotting/tisserand.py rename to src/hapsira/plotting/tisserand.py index bb2311145..3f77de6df 100644 --- a/src/poliastro/plotting/tisserand.py +++ b/src/hapsira/plotting/tisserand.py @@ -5,9 +5,9 @@ from matplotlib import pyplot as plt import numpy as np -from poliastro.plotting.util import BODY_COLORS -from poliastro.twobody.mean_elements import get_mean_elements -from poliastro.util import norm +from hapsira.plotting.util import BODY_COLORS +from hapsira.twobody.mean_elements import get_mean_elements +from hapsira.util import norm class TisserandKind(Enum): @@ -53,7 +53,7 @@ def _solve_tisserand( Parameters ---------- - body : ~poliastro.bodies.Body + body : ~hapsira.bodies.Body Body to be plotted Tisserand vinf_array : ~astropy.units.Quantity Desired Vinf for the flyby @@ -85,9 +85,7 @@ def _solve_tisserand( # Solving for non-dimensional a_sc and ecc_sc A_SC = 1 / np.abs(1 - V_INF**2 - 2 * V_INF * np.cos(ALPHA)) - ECC_SC = np.sqrt( - 1 - 1 / A_SC * ((3 - 1 / A_SC - V_INF**2) / (2)) ** 2 - ) + ECC_SC = np.sqrt(1 - 1 / A_SC * ((3 - 1 / A_SC - V_INF**2) / (2)) ** 2) # Compute main Tisserand variables RR_P = A_SC * R_body * (1 - ECC_SC) @@ -131,7 +129,7 @@ def plot_line(self, body, vinf, alpha_lim=(0, np.pi), color=None): Parameters ---------- - body : ~poliastro.bodies.Body + body : ~hapsira.bodies.Body Body to be plotted Tisserand vinf : ~astropy.units.Quantity Vinf velocity line @@ -168,7 +166,7 @@ def plot(self, body, vinf_span, num_contours=10, color=None): Parameters ---------- - body : ~poliastro.bodies.Body + body : ~hapsira.bodies.Body Body to be plotted Tisserand vinf_span : tuple Minimum and maximum Vinf velocities @@ -184,9 +182,7 @@ def plot(self, body, vinf_span, num_contours=10, color=None): """ # Solve Tisserand parameters - RR_P, RR_A, EE, TT = self._solve_tisserand( - body, vinf_span, num_contours - ) + RR_P, RR_A, EE, TT = self._solve_tisserand(body, vinf_span, num_contours) # Check if color defined if not color: diff --git a/src/poliastro/plotting/util.py b/src/hapsira/plotting/util.py similarity index 100% rename from src/poliastro/plotting/util.py rename to src/hapsira/plotting/util.py diff --git a/src/poliastro/sensors.py b/src/hapsira/sensors.py similarity index 98% rename from src/poliastro/sensors.py rename to src/hapsira/sensors.py index 633b6aedb..8d6568de0 100644 --- a/src/poliastro/sensors.py +++ b/src/hapsira/sensors.py @@ -1,6 +1,6 @@ from astropy import units as u -from poliastro.core.sensors import ( +from hapsira.core.sensors import ( ground_range_diff_at_azimuth as ground_range_diff_at_azimuth_fast, min_and_max_ground_range as min_and_max_ground_range_fast, ) diff --git a/src/poliastro/spacecraft/__init__.py b/src/hapsira/spacecraft/__init__.py similarity index 100% rename from src/poliastro/spacecraft/__init__.py rename to src/hapsira/spacecraft/__init__.py diff --git a/src/poliastro/spheroid_location.py b/src/hapsira/spheroid_location.py similarity index 91% rename from src/poliastro/spheroid_location.py rename to src/hapsira/spheroid_location.py index 3f040fb83..c1a9f5073 100644 --- a/src/poliastro/spheroid_location.py +++ b/src/hapsira/spheroid_location.py @@ -1,7 +1,7 @@ import astropy.units as u import numpy as np -from poliastro.core.spheroid_location import ( +from hapsira.core.spheroid_location import ( N as N_fast, cartesian_cords as cartesian_cords_fast, cartesian_to_ellipsoidal as cartesian_to_ellipsoidal_fast, @@ -25,7 +25,7 @@ def __init__(self, lon, lat, h, body): Geodetic latitude h : ~astropy.units.quantity.Quantity Geodetic height - body : ~poliastro.bodies.Body + body : ~hapsira.bodies.Body Planetary body the spheroid location lies on """ @@ -71,9 +71,7 @@ def N(self): self._b.to_value(u.m), self._c.to_value(u.m), ) - cartesian_cords = np.array( - [coord.value for coord in self.cartesian_cords] - ) + cartesian_cords = np.array([coord.value for coord in self.cartesian_cords]) return N_fast(a, b, c, cartesian_cords) @property @@ -108,9 +106,7 @@ def distance(self, px, py, pz): """ px, py, pz = px.to_value(u.m), py.to_value(u.m), pz.to_value(u.m) - cartesian_cords = np.array( - [coord.value for coord in self.cartesian_cords] - ) + cartesian_cords = np.array([coord.value for coord in self.cartesian_cords]) return ( distance_fast(cartesian_cords, px, py, pz) * u.m ) # body.R and body.R_polar has u.m as units @@ -130,9 +126,7 @@ def is_visible(self, px, py, pz): """ px, py, pz = px.to_value(u.m), py.to_value(u.m), pz.to_value(u.m) - cartesian_cords = np.array( - [coord.value for coord in self.cartesian_cords] - ) + cartesian_cords = np.array([coord.value for coord in self.cartesian_cords]) return is_visible_fast(cartesian_cords, px, py, pz, self.N) diff --git a/src/poliastro/threebody/__init__.py b/src/hapsira/threebody/__init__.py similarity index 100% rename from src/poliastro/threebody/__init__.py rename to src/hapsira/threebody/__init__.py diff --git a/src/poliastro/threebody/cr3bp_char_quant.py b/src/hapsira/threebody/cr3bp_char_quant.py similarity index 90% rename from src/poliastro/threebody/cr3bp_char_quant.py rename to src/hapsira/threebody/cr3bp_char_quant.py index 86c353bc0..92bd215ef 100644 --- a/src/poliastro/threebody/cr3bp_char_quant.py +++ b/src/hapsira/threebody/cr3bp_char_quant.py @@ -1,7 +1,7 @@ """@author: Dhruv Jain, Multi-Body Dynamics Research Group, Purdue University.""" from astropy import units as u -from poliastro.core.threebody.cr3bp_quantities_calculations import ( +from hapsira.core.threebody.cr3bp_quantities_calculations import ( calculate_mu, calculate_tstar, ) @@ -40,8 +40,8 @@ def from_primaries(cls, p1, p2): Parameters ---------- - p1: ~poliastro.bodies.Body - p2: ~poliastro.bodies.Body + p1: ~hapsira.bodies.Body + p2: ~hapsira.bodies.Body """ name, mu, lstar, tstar = cls.bodies_char_compute(p1, p2) return cls(name, mu, lstar, tstar) @@ -54,8 +54,8 @@ def bodies_char_compute(self, p1, p2): Parameters ---------- - p1: ~poliastro.bodies.Body - p2: ~poliastro.bodies.Body + p1: ~hapsira.bodies.Body + p2: ~hapsira.bodies.Body Returns ------- @@ -70,9 +70,7 @@ def bodies_char_compute(self, p1, p2): """ assert ( p1 == p2.parent or p2 == p1.parent - ) is True, ( - "P1 and P2 are not part of the same system. Recheck body.parent" - ) + ) is True, "P1 and P2 are not part of the same system. Recheck body.parent" if p1.k < p2.k: # swap p1 and p2, as p1 should be the more massive body diff --git a/src/poliastro/threebody/flybys.py b/src/hapsira/threebody/flybys.py similarity index 87% rename from src/poliastro/threebody/flybys.py rename to src/hapsira/threebody/flybys.py index 27c4573af..74ecbecab 100644 --- a/src/poliastro/threebody/flybys.py +++ b/src/hapsira/threebody/flybys.py @@ -1,6 +1,6 @@ from astropy import units as u -from poliastro.core.flybys import compute_flyby as compute_flyby_fast +from hapsira.core.flybys import compute_flyby as compute_flyby_fast @u.quantity_input( @@ -40,8 +40,6 @@ def compute_flyby(v_spacecraft, v_body, k, r_p, theta=0 * u.deg): r_p = r_p.to_value(u.km) theta = theta.to_value(u.rad) - v_spacecraft_out, delta = compute_flyby_fast( - v_spacecraft, v_body, k, r_p, theta - ) + v_spacecraft_out, delta = compute_flyby_fast(v_spacecraft, v_body, k, r_p, theta) return v_spacecraft_out * u.km / u.s, delta * u.rad diff --git a/src/poliastro/threebody/restricted.py b/src/hapsira/threebody/restricted.py similarity index 97% rename from src/poliastro/threebody/restricted.py rename to src/hapsira/threebody/restricted.py index 6e2be8af0..76c5e1d10 100644 --- a/src/poliastro/threebody/restricted.py +++ b/src/hapsira/threebody/restricted.py @@ -7,8 +7,8 @@ from astropy import units as u import numpy as np -from poliastro._math.optimize import brentq -from poliastro.util import norm +from hapsira._math.optimize import brentq +from hapsira.util import norm @u.quantity_input(r12=u.km, m1=u.kg, m2=u.kg) diff --git a/src/poliastro/threebody/soi.py b/src/hapsira/threebody/soi.py similarity index 95% rename from src/poliastro/threebody/soi.py rename to src/hapsira/threebody/soi.py index 36b102acd..29dc155cf 100644 --- a/src/poliastro/threebody/soi.py +++ b/src/hapsira/threebody/soi.py @@ -31,7 +31,7 @@ a\\left(\\frac{m}{3M}\\right)^{\\frac{1}{3}} """ -from poliastro.twobody.mean_elements import get_mean_elements +from hapsira.twobody.mean_elements import get_mean_elements def laplace_radius(body): @@ -39,7 +39,7 @@ def laplace_radius(body): Parameters ---------- - body : `~poliastro.bodies.Body` + body : `~hapsira.bodies.Body` Astronomical body which the SOI's radius is computed for. Returns @@ -59,7 +59,7 @@ def hill_radius(body): Parameters ---------- - body : `~poliastro.bodies.Body` + body : `~hapsira.bodies.Body` Astronomical body which the SOI's radius is computed for. Returns diff --git a/src/hapsira/twobody/__init__.py b/src/hapsira/twobody/__init__.py new file mode 100644 index 000000000..a0d46c591 --- /dev/null +++ b/src/hapsira/twobody/__init__.py @@ -0,0 +1,3 @@ +from hapsira.twobody.orbit import Orbit + +__all__ = ["Orbit"] diff --git a/src/poliastro/twobody/angles.py b/src/hapsira/twobody/angles.py similarity index 99% rename from src/poliastro/twobody/angles.py rename to src/hapsira/twobody/angles.py index 02fd00187..a07091be4 100644 --- a/src/poliastro/twobody/angles.py +++ b/src/hapsira/twobody/angles.py @@ -1,7 +1,7 @@ """Angles and anomalies.""" from astropy import units as u -from poliastro.core.angles import ( +from hapsira.core.angles import ( D_to_M as D_to_M_fast, D_to_nu as D_to_nu_fast, E_to_M as E_to_M_fast, diff --git a/src/poliastro/twobody/elements.py b/src/hapsira/twobody/elements.py similarity index 96% rename from src/poliastro/twobody/elements.py rename to src/hapsira/twobody/elements.py index 729e425aa..7b14f08d3 100644 --- a/src/poliastro/twobody/elements.py +++ b/src/hapsira/twobody/elements.py @@ -1,13 +1,13 @@ from astropy import units as u import numpy as np -from poliastro.core.elements import ( +from hapsira.core.elements import ( circular_velocity as circular_velocity_fast, coe2rv as coe2rv_fast, coe2rv_many as coe2rv_many_fast, eccentricity_vector as eccentricity_vector_fast, ) -from poliastro.core.propagation.farnocchia import ( +from hapsira.core.propagation.farnocchia import ( delta_t_from_nu as delta_t_from_nu_fast, ) @@ -18,9 +18,7 @@ @u.quantity_input(k=u_km3s2, a=u.km) def circular_velocity(k, a): """Circular velocity for a given body (k) and semimajor axis (a).""" - return ( - circular_velocity_fast(k.to_value(u_km3s2), a.to_value(u.km)) * u_kms - ) + return circular_velocity_fast(k.to_value(u_km3s2), a.to_value(u.km)) * u_kms @u.quantity_input(k=u_km3s2, a=u.km) diff --git a/src/poliastro/twobody/events.py b/src/hapsira/twobody/events.py similarity index 93% rename from src/poliastro/twobody/events.py rename to src/hapsira/twobody/events.py index d247208a6..e0604b934 100644 --- a/src/poliastro/twobody/events.py +++ b/src/hapsira/twobody/events.py @@ -4,12 +4,12 @@ from astropy.coordinates import get_body_barycentric_posvel import numpy as np -from poliastro._math.linalg import norm -from poliastro.core.events import ( +from hapsira._math.linalg import norm +from hapsira.core.events import ( eclipse_function as eclipse_function_fast, line_of_sight as line_of_sight_fast, ) -from poliastro.core.spheroid_location import ( +from hapsira.core.spheroid_location import ( cartesian_to_ellipsoidal as cartesian_to_ellipsoidal_fast, ) @@ -99,7 +99,7 @@ class LatitudeCrossEvent(Event): Parameters ---------- - orbit: ~poliastro.twobody.orbit.Orbit + orbit: ~hapsira.twobody.orbit.Orbit Orbit. lat: astropy.quantity.Quantity Threshold latitude. @@ -122,9 +122,7 @@ def __init__(self, orbit, lat, terminal=False, direction=0): def __call__(self, t, u_, k): self._last_t = t pos_on_body = (u_[:3] / norm(u_[:3])) * self._R - _, lat_, _ = cartesian_to_ellipsoidal_fast( - self._R, self._R_polar, *pos_on_body - ) + _, lat_, _ = cartesian_to_ellipsoidal_fast(self._R, self._R_polar, *pos_on_body) return np.rad2deg(lat_) - self._lat @@ -134,7 +132,7 @@ class EclipseEvent(Event): Parameters ---------- - orbit: poliastro.twobody.orbit.Orbit + orbit: hapsira.twobody.orbit.Orbit Orbit of the satellite. terminal: bool, optional Whether to terminate integration when the event occurs, defaults to False. @@ -169,7 +167,7 @@ class PenumbraEvent(EclipseEvent): Parameters ---------- - orbit: poliastro.twobody.orbit.Orbit + orbit: hapsira.twobody.orbit.Orbit Orbit of the satellite. terminal: bool, optional Whether to terminate integration when the event occurs, defaults to False. @@ -203,7 +201,7 @@ class UmbraEvent(EclipseEvent): Parameters ---------- - orbit: poliastro.twobody.orbit.Orbit + orbit: hapsira.twobody.orbit.Orbit Orbit of the satellite. terminal: bool, optional Whether to terminate integration when the event occurs, defaults to False. @@ -255,7 +253,7 @@ class LosEvent(Event): Parameters ---------- - attractor: ~poliastro.bodies.body + attractor: ~hapsira.bodies.body The central attractor with respect to which the position vectors of the satellites are defined. pos_coords: ~astropy.quantity.Quantity A list of position coordinates for the secondary body. These coordinates @@ -280,9 +278,7 @@ def __call__(self, t, u_, k): "The norm of the position vector of the primary body is less than the radius of the attractor." ) - pos_coord = ( - self._pos_coords.pop(0) if self._pos_coords else self._last_coord - ) + pos_coord = self._pos_coords.pop(0) if self._pos_coords else self._last_coord # Need to cast `pos_coord` to array since `norm` inside numba only works for arrays, not lists. delta_angle = line_of_sight_fast(u_[:3], np.array(pos_coord), self._R) diff --git a/src/poliastro/twobody/mean_elements.py b/src/hapsira/twobody/mean_elements.py similarity index 76% rename from src/poliastro/twobody/mean_elements.py rename to src/hapsira/twobody/mean_elements.py index fccf3e345..0b5910d5e 100644 --- a/src/poliastro/twobody/mean_elements.py +++ b/src/hapsira/twobody/mean_elements.py @@ -2,9 +2,9 @@ from astropy.coordinates.solar_system import PLAN94_BODY_NAME_TO_PLANET_INDEX import erfa -from poliastro.constants import J2000 -from poliastro.frames import Planes -from poliastro.twobody.states import RVState +from hapsira.constants import J2000 +from hapsira.frames import Planes +from hapsira.twobody.states import RVState def get_mean_elements(body, epoch=J2000): @@ -12,7 +12,7 @@ def get_mean_elements(body, epoch=J2000): Parameters ---------- - body : ~poliastro.bodies.SolarSystemPlanet + body : ~hapsira.bodies.SolarSystemPlanet Body. epoch : astropy.time.Time Epoch. @@ -36,9 +36,7 @@ def get_mean_elements(body, epoch=J2000): except KeyError as e: raise ValueError( - f"No available mean elements for {body}. It must be an instance of `poliastro.bodies.SolarSystemPlanet`" + f"No available mean elements for {body}. It must be an instance of `hapsira.bodies.SolarSystemPlanet`" ) from e - return RVState( - body.parent, (r, v), plane=Planes.EARTH_ECLIPTIC - ).to_classical() + return RVState(body.parent, (r, v), plane=Planes.EARTH_ECLIPTIC).to_classical() diff --git a/src/hapsira/twobody/orbit/__init__.py b/src/hapsira/twobody/orbit/__init__.py new file mode 100644 index 000000000..bb583decb --- /dev/null +++ b/src/hapsira/twobody/orbit/__init__.py @@ -0,0 +1,3 @@ +from hapsira.twobody.orbit.scalar import Orbit + +__all__ = ["Orbit"] diff --git a/src/poliastro/twobody/orbit/creation.py b/src/hapsira/twobody/orbit/creation.py similarity index 91% rename from src/poliastro/twobody/orbit/creation.py rename to src/hapsira/twobody/orbit/creation.py index ee7cad33e..16d24ad9d 100644 --- a/src/poliastro/twobody/orbit/creation.py +++ b/src/hapsira/twobody/orbit/creation.py @@ -3,22 +3,22 @@ from astropy import units as u import numpy as np -from poliastro.constants import J2000 -from poliastro.frames import Planes -from poliastro.frames.util import get_frame -from poliastro.twobody.elements import ( +from hapsira.constants import J2000 +from hapsira.frames import Planes +from hapsira.frames.util import get_frame +from hapsira.twobody.elements import ( get_eccentricity_critical_argp, get_eccentricity_critical_inc, get_inclination_critical_argp, heliosynchronous, ) -from poliastro.twobody.mean_elements import get_mean_elements -from poliastro.twobody.states import ( +from hapsira.twobody.mean_elements import get_mean_elements +from hapsira.twobody.states import ( ClassicalState, ModifiedEquinoctialState, RVState, ) -from poliastro.util import find_closest_value +from hapsira.util import find_closest_value class OrbitCreationMixin: @@ -29,9 +29,7 @@ def __init__(self, *_, **__): # HACK stub to make mypy happy @classmethod @u.quantity_input(r=u.m, v=u.m / u.s) - def from_vectors( - cls, attractor, r, v, epoch=J2000, plane=Planes.EARTH_EQUATOR - ): + def from_vectors(cls, attractor, r, v, epoch=J2000, plane=Planes.EARTH_EQUATOR): """Return `Orbit` from position and velocity vectors. Parameters @@ -44,7 +42,7 @@ def from_vectors( Velocity vector. epoch : ~astropy.time.Time, optional Epoch, default to J2000. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. """ @@ -77,7 +75,7 @@ def from_coords(cls, attractor, coord, plane=Planes.EARTH_EQUATOR): coord : ~astropy.coordinates.SkyCoord or ~astropy.coordinates.BaseCoordinateFrame Position and velocity vectors in any reference frame. Note that coord must have a representation and its differential with respect to time. - plane : ~poliastro.frames.Planes, optional + plane : ~hapsira.frames.Planes, optional Final orbit plane, default to Earth Equator. """ @@ -96,9 +94,7 @@ def from_coords(cls, attractor, coord, plane=Planes.EARTH_EQUATOR): # Get an inertial reference frame parallel to ICRS and centered at # attractor - inertial_frame_at_body_centre = get_frame( - attractor, plane, coord.obstime - ) + inertial_frame_at_body_centre = get_frame(attractor, plane, coord.obstime) if not coord.is_equivalent_frame(inertial_frame_at_body_centre): coord_in_irf = coord.transform_to(inertial_frame_at_body_centre) @@ -108,14 +104,10 @@ def from_coords(cls, attractor, coord, plane=Planes.EARTH_EQUATOR): pos = coord_in_irf.cartesian.xyz vel = coord_in_irf.cartesian.differentials["s"].d_xyz - return cls.from_vectors( - attractor, pos, vel, epoch=coord.obstime, plane=plane - ) + return cls.from_vectors(attractor, pos, vel, epoch=coord.obstime, plane=plane) @classmethod - @u.quantity_input( - a=u.m, ecc=u.one, inc=u.rad, raan=u.rad, argp=u.rad, nu=u.rad - ) + @u.quantity_input(a=u.m, ecc=u.one, inc=u.rad, raan=u.rad, argp=u.rad, nu=u.rad) def from_classical( cls, attractor, @@ -148,7 +140,7 @@ def from_classical( True anomaly. epoch : ~astropy.time.Time, optional Epoch, default to J2000. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. """ @@ -157,9 +149,7 @@ def from_classical( raise ValueError(f"Elements must be scalar, got {element}") if ecc == 1.0 * u.one: - raise ValueError( - "For parabolic orbits use Orbit.parabolic instead" - ) + raise ValueError("For parabolic orbits use Orbit.parabolic instead") if not 0 * u.deg <= inc <= 180 * u.deg: raise ValueError("Inclination must be between 0 and 180 degrees") @@ -169,9 +159,9 @@ def from_classical( if not -np.pi * u.rad <= nu < np.pi * u.rad: warn("Wrapping true anomaly to -π <= nu < π", stacklevel=2) - nu = ( - (nu + np.pi * u.rad) % (2 * np.pi * u.rad) - np.pi * u.rad - ).to(nu.unit) + nu = ((nu + np.pi * u.rad) % (2 * np.pi * u.rad) - np.pi * u.rad).to( + nu.unit + ) ss = ClassicalState( attractor, (a * (1 - ecc**2), ecc, inc, raan, argp, nu), plane @@ -212,7 +202,7 @@ def from_equinoctial( True longitude. epoch : ~astropy.time.Time, optional Epoch, default to J2000. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. """ @@ -228,17 +218,15 @@ def from_ephem(cls, attractor, ephem, epoch): Parameters ---------- - ephem : ~poliastro.ephem.Ephem + ephem : ~hapsira.ephem.Ephem Ephemerides object to use. - attractor : ~poliastro.bodies.Body + attractor : ~hapsira.bodies.Body Body to use as attractor. epoch : ~astropy.time.Time Epoch to retrieve the osculating orbit at. """ - return cls.from_vectors( - attractor, *ephem.rv(epoch), epoch, ephem.plane - ) + return cls.from_vectors(attractor, *ephem.rv(epoch), epoch, ephem.plane) @classmethod def from_sbdb(cls, name, **kwargs): @@ -253,16 +241,16 @@ def from_sbdb(cls, name, **kwargs): Returns ------- - ss: poliastro.twobody.orbit.Orbit + ss: hapsira.twobody.orbit.Orbit Orbit corresponding to body_name Examples -------- - >>> from poliastro.twobody.orbit import Orbit + >>> from hapsira.twobody.orbit import Orbit >>> apophis_orbit = Orbit.from_sbdb('apophis') # doctest: +REMOTE_DATA """ - from poliastro.io import orbit_from_sbdb + from hapsira.io import orbit_from_sbdb return orbit_from_sbdb(name, **kwargs) @@ -294,7 +282,7 @@ def circular( Argument of latitude, default to 0 deg. epoch : ~astropy.time.Time, optional Epoch, default to J2000. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. """ @@ -382,7 +370,7 @@ def synchronous( Argument of latitude, default to 0 deg. epoch : ~astropy.time.Time, optional Epoch, default to J2000. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. Returns @@ -413,9 +401,7 @@ def synchronous( nu = arglat - argp r_pericenter = (1 - ecc) * a_sync if r_pericenter < attractor.R: - raise ValueError( - "The orbit for the given parameters doesn't exist" - ) + raise ValueError("The orbit for the given parameters doesn't exist") return cls.from_classical( attractor=attractor, @@ -460,7 +446,7 @@ def heliosynchronous( Parameters ---------- - attractor : ~poliastro.bodies.SolarSystemPlanet + attractor : ~hapsira.bodies.SolarSystemPlanet Attractor. a : ~astropy.units.Quantity Semi-major axis. @@ -476,15 +462,14 @@ def heliosynchronous( True anomaly. epoch : ~astropy.time.Time, optional Epoch, default to J2000. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. """ mean_elements = get_mean_elements(attractor) n_sunsync = ( - np.sqrt(mean_elements.attractor.k / abs(mean_elements.a**3)) - * u.one + np.sqrt(mean_elements.attractor.k / abs(mean_elements.a**3)) * u.one ).to(1 / u.s) try: @@ -492,9 +477,7 @@ def heliosynchronous( attractor.k, attractor.R, attractor.J2, n_sunsync, a, ecc, inc ) except FloatingPointError: - raise ValueError( - "No SSO orbit with given parameters can be found." - ) + raise ValueError("No SSO orbit with given parameters can be found.") ss = cls.from_classical( attractor=attractor, @@ -541,13 +524,11 @@ def parabolic( True anomaly. epoch : ~astropy.time.Time, optional Epoch, default to J2000. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. """ - ss = ClassicalState( - attractor, (p, 1.0 * u.one, inc, raan, argp, nu), plane - ) + ss = ClassicalState(attractor, (p, 1.0 * u.one, inc, raan, argp, nu), plane) return cls(ss, epoch) @classmethod @@ -627,7 +608,7 @@ def frozen( Eccentricity, default to the eccentricity of the Moon's orbit around the Earth epoch : ~astropy.time.Time, optional Epoch, default to J2000. - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. """ @@ -681,9 +662,7 @@ def frozen( ) inc = critical_inclinations[0] if inc is None else inc - critical_inclination = find_closest_value( - inc, critical_inclinations - ) + critical_inclination = find_closest_value(inc, critical_inclinations) if np.isclose(inc, critical_inclination, 1e-8, 1e-5 * u.rad): ecc = get_eccentricity_critical_inc(ecc) return cls.from_classical( diff --git a/src/poliastro/twobody/orbit/scalar.py b/src/hapsira/twobody/orbit/scalar.py similarity index 92% rename from src/poliastro/twobody/orbit/scalar.py rename to src/hapsira/twobody/orbit/scalar.py index abf704e08..c7e27949a 100644 --- a/src/poliastro/twobody/orbit/scalar.py +++ b/src/hapsira/twobody/orbit/scalar.py @@ -10,21 +10,23 @@ ) import numpy as np -from poliastro.bodies import Earth -from poliastro.core.events import elevation_function as elevation_function_fast -from poliastro.frames.util import get_frame -from poliastro.threebody.soi import laplace_radius -from poliastro.twobody.elements import eccentricity_vector, energy, t_p -from poliastro.twobody.orbit.creation import OrbitCreationMixin -from poliastro.twobody.propagation import FarnocchiaPropagator, PropagatorKind -from poliastro.twobody.sampling import TrueAnomalyBounds -from poliastro.util import norm, wrap_angle -from poliastro.warnings import PatchedConicsWarning +from hapsira.bodies import Earth +from hapsira.core.events import elevation_function as elevation_function_fast +from hapsira.frames.util import get_frame +from hapsira.threebody.soi import laplace_radius +from hapsira.twobody.elements import eccentricity_vector, energy, t_p +from hapsira.twobody.orbit.creation import OrbitCreationMixin +from hapsira.twobody.propagation import FarnocchiaPropagator, PropagatorKind +from hapsira.twobody.sampling import TrueAnomalyBounds +from hapsira.util import norm, wrap_angle +from hapsira.warnings import PatchedConicsWarning ORBIT_FORMAT = "{r_p:.0f} x {r_a:.0f} x {inc:.1f} ({frame}) orbit around {body} at epoch {epoch} ({scale})" # String representation for orbits around bodies without predefined # Reference frame -ORBIT_NO_FRAME_FORMAT = "{r_p:.0f} x {r_a:.0f} x {inc:.1f} orbit around {body} at epoch {epoch} ({scale})" +ORBIT_NO_FRAME_FORMAT = ( + "{r_p:.0f} x {r_a:.0f} x {inc:.1f} orbit around {body} at epoch {epoch} ({scale})" +) class Orbit(OrbitCreationMixin): @@ -209,14 +211,14 @@ def change_attractor(self, new_attractor, force=False): Parameters ---------- - new_attractor : poliastro.bodies.Body + new_attractor : hapsira.bodies.Body Desired new attractor. force : bool If `True`, changes attractor even if physically has no-sense. Returns ------- - ss: poliastro.twobody.orbit.Orbit + ss: hapsira.twobody.orbit.Orbit Orbit with new attractor """ @@ -224,9 +226,7 @@ def change_attractor(self, new_attractor, force=False): return self elif self.attractor == new_attractor.parent: # "Sun -> Earth" r_soi = laplace_radius(new_attractor) - barycentric_position = get_body_barycentric( - new_attractor.name, self.epoch - ) + barycentric_position = get_body_barycentric(new_attractor.name, self.epoch) # Transforming new_attractor's frame into frame of attractor new_attractor_r = ( ICRS(barycentric_position) @@ -246,9 +246,7 @@ def change_attractor(self, new_attractor, force=False): "Orbit is out of new attractor's SOI. If required, use 'force=True'." ) elif self.ecc < 1.0 and not force: - raise ValueError( - "Orbit will never leave the SOI of its current attractor" - ) + raise ValueError("Orbit will never leave the SOI of its current attractor") else: warn( "Leaving the SOI of the current attractor", @@ -269,7 +267,7 @@ def change_plane(self, plane): Parameters ---------- - plane : ~poliastro.frames.Planes + plane : ~hapsira.frames.Planes Fundamental plane of the frame. """ @@ -301,7 +299,7 @@ def represent_as(self, representation, differential_class=None): Examples -------- - >>> from poliastro.examples import iss + >>> from hapsira.examples import iss >>> from astropy.coordinates import SphericalRepresentation >>> iss.represent_as(CartesianRepresentation) >> from astropy import units as u - >>> from poliastro.examples import iss + >>> from hapsira.examples import iss >>> iss.sample() # doctest: +ELLIPSIS >> iss.sample(10) # doctest: +ELLIPSIS @@ -622,20 +616,20 @@ def plot(self, backend=None, label=None): Parameters ---------- - backend : ~poliastro.plotting.orbit.backends._base.OrbitPlotterBackend + backend : ~hapsira.plotting.orbit.backends._base.OrbitPlotterBackend An instance of ``OrbitPlotterBackend`` for rendendering the scene. label : str, optional Label for the orbit, defaults to empty. Returns ------- - ~poliastro.plotting.orbit.OrbitPlotter + ~hapsira.plotting.orbit.OrbitPlotter An object for plotting orbits. """ # HACK: avoid circular dependency - from poliastro.plotting.orbit.backends import Matplotlib2D, Plotly2D - from poliastro.plotting.orbit.plotter import OrbitPlotter + from hapsira.plotting.orbit.backends import Matplotlib2D, Plotly2D + from hapsira.plotting.orbit.plotter import OrbitPlotter # Select the best backend depending if it is an interactive or batch # session @@ -681,7 +675,7 @@ def elevation(self, lat, theta, h): Notes ----- Local sideral time needs to be precomputed. If Earth is the attractor, it can - be computed using `poliastro.earth.util.get_local_sidereal_time`. + be computed using `hapsira.earth.util.get_local_sidereal_time`. """ if self.attractor != Earth: raise NotImplementedError( diff --git a/src/poliastro/twobody/propagation/__init__.py b/src/hapsira/twobody/propagation/__init__.py similarity index 75% rename from src/poliastro/twobody/propagation/__init__.py rename to src/hapsira/twobody/propagation/__init__.py index 064d21053..f3e790730 100644 --- a/src/poliastro/twobody/propagation/__init__.py +++ b/src/hapsira/twobody/propagation/__init__.py @@ -1,5 +1,5 @@ """The following script holds the different high level functions for the -different propagators available at poliastro: +different propagators available at hapsira: +-------------+------------+-----------------+-----------------+ | Propagator | Elliptical | Parabolic | Hyperbolic | @@ -24,16 +24,16 @@ +-------------+------------+-----------------+-----------------+ """ -from poliastro.twobody.propagation.cowell import CowellPropagator -from poliastro.twobody.propagation.danby import DanbyPropagator -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.propagation.farnocchia import FarnocchiaPropagator -from poliastro.twobody.propagation.gooding import GoodingPropagator -from poliastro.twobody.propagation.markley import MarkleyPropagator -from poliastro.twobody.propagation.mikkola import MikkolaPropagator -from poliastro.twobody.propagation.pimienta import PimientaPropagator -from poliastro.twobody.propagation.recseries import RecseriesPropagator -from poliastro.twobody.propagation.vallado import ValladoPropagator +from hapsira.twobody.propagation.cowell import CowellPropagator +from hapsira.twobody.propagation.danby import DanbyPropagator +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.propagation.farnocchia import FarnocchiaPropagator +from hapsira.twobody.propagation.gooding import GoodingPropagator +from hapsira.twobody.propagation.markley import MarkleyPropagator +from hapsira.twobody.propagation.mikkola import MikkolaPropagator +from hapsira.twobody.propagation.pimienta import PimientaPropagator +from hapsira.twobody.propagation.recseries import RecseriesPropagator +from hapsira.twobody.propagation.vallado import ValladoPropagator from ._compat import propagate diff --git a/src/poliastro/twobody/propagation/_compat.py b/src/hapsira/twobody/propagation/_compat.py similarity index 94% rename from src/poliastro/twobody/propagation/_compat.py rename to src/hapsira/twobody/propagation/_compat.py index a45e2ca5f..074f50325 100644 --- a/src/poliastro/twobody/propagation/_compat.py +++ b/src/hapsira/twobody/propagation/_compat.py @@ -18,5 +18,5 @@ def propagate(*args, **kwargs): "or Orbit.to_ephem if you want to compute all the trajectory. " "This error message will be removed in a future release " "and you will get a 'ImportError: cannot import name 'propagate' " - "from 'poliastro.twobody.propagation''." + "from 'hapsira.twobody.propagation''." ) diff --git a/src/poliastro/twobody/propagation/cowell.py b/src/hapsira/twobody/propagation/cowell.py similarity index 80% rename from src/poliastro/twobody/propagation/cowell.py rename to src/hapsira/twobody/propagation/cowell.py index 26b8af2df..693369ecb 100644 --- a/src/poliastro/twobody/propagation/cowell.py +++ b/src/hapsira/twobody/propagation/cowell.py @@ -2,10 +2,10 @@ from astropy import units as u -from poliastro.core.propagation import cowell -from poliastro.core.propagation.base import func_twobody -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.states import RVState +from hapsira.core.propagation import cowell +from hapsira.core.propagation.base import func_twobody +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.states import RVState from ._compat import OldPropagatorModule @@ -24,9 +24,7 @@ class CowellPropagator: """ kind = ( - PropagatorKind.ELLIPTIC - | PropagatorKind.PARABOLIC - | PropagatorKind.HYPERBOLIC + PropagatorKind.ELLIPTIC | PropagatorKind.PARABOLIC | PropagatorKind.HYPERBOLIC ) def __init__(self, rtol=1e-11, events=None, f=func_twobody): @@ -65,7 +63,7 @@ def propagate_many(self, state, tofs): ) # TODO: This should probably return a RVStateArray instead, - # see discussion at https://github.com/poliastro/poliastro/pull/1492 + # see discussion at https://github.com/hapsira/hapsira/pull/1492 return ( rrs << u.km, vvs << (u.km / u.s), diff --git a/src/poliastro/twobody/propagation/danby.py b/src/hapsira/twobody/propagation/danby.py similarity index 83% rename from src/poliastro/twobody/propagation/danby.py rename to src/hapsira/twobody/propagation/danby.py index b5266c573..e8c4c3d43 100644 --- a/src/poliastro/twobody/propagation/danby.py +++ b/src/hapsira/twobody/propagation/danby.py @@ -2,9 +2,9 @@ from astropy import units as u -from poliastro.core.propagation import danby_coe as danby_fast -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.states import ClassicalState +from hapsira.core.propagation import danby_coe as danby_fast +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.states import ClassicalState from ._compat import OldPropagatorModule diff --git a/src/poliastro/twobody/propagation/enums.py b/src/hapsira/twobody/propagation/enums.py similarity index 100% rename from src/poliastro/twobody/propagation/enums.py rename to src/hapsira/twobody/propagation/enums.py diff --git a/src/poliastro/twobody/propagation/farnocchia.py b/src/hapsira/twobody/propagation/farnocchia.py similarity index 82% rename from src/poliastro/twobody/propagation/farnocchia.py rename to src/hapsira/twobody/propagation/farnocchia.py index 23892028a..4b26f57d6 100644 --- a/src/poliastro/twobody/propagation/farnocchia.py +++ b/src/hapsira/twobody/propagation/farnocchia.py @@ -3,12 +3,12 @@ from astropy import units as u import numpy as np -from poliastro.core.propagation.farnocchia import ( +from hapsira.core.propagation.farnocchia import ( farnocchia_coe as farnocchia_coe_fast, farnocchia_rv as farnocchia_rv_fast, ) -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.states import ClassicalState +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.states import ClassicalState from ._compat import OldPropagatorModule @@ -27,9 +27,7 @@ class FarnocchiaPropagator: """ kind = ( - PropagatorKind.ELLIPTIC - | PropagatorKind.PARABOLIC - | PropagatorKind.HYPERBOLIC + PropagatorKind.ELLIPTIC | PropagatorKind.PARABOLIC | PropagatorKind.HYPERBOLIC ) def propagate(self, state, tof): @@ -55,7 +53,7 @@ def propagate_many(self, state, tofs): rv0 = state.to_value() # TODO: This should probably return a ClassicalStateArray instead, - # see discussion at https://github.com/poliastro/poliastro/pull/1492 + # see discussion at https://github.com/hapsira/hapsira/pull/1492 results = np.array( [farnocchia_rv_fast(k, *rv0, tof) for tof in tofs.to_value(u.s)] ) diff --git a/src/poliastro/twobody/propagation/gooding.py b/src/hapsira/twobody/propagation/gooding.py similarity index 86% rename from src/poliastro/twobody/propagation/gooding.py rename to src/hapsira/twobody/propagation/gooding.py index 9eb5dc314..3c0da8fcd 100644 --- a/src/poliastro/twobody/propagation/gooding.py +++ b/src/hapsira/twobody/propagation/gooding.py @@ -2,9 +2,9 @@ from astropy import units as u -from poliastro.core.propagation import gooding_coe as gooding_fast -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.states import ClassicalState +from hapsira.core.propagation import gooding_coe as gooding_fast +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.states import ClassicalState from ._compat import OldPropagatorModule diff --git a/src/poliastro/twobody/propagation/markley.py b/src/hapsira/twobody/propagation/markley.py similarity index 83% rename from src/poliastro/twobody/propagation/markley.py rename to src/hapsira/twobody/propagation/markley.py index e00f1b3e7..ed99efec2 100644 --- a/src/poliastro/twobody/propagation/markley.py +++ b/src/hapsira/twobody/propagation/markley.py @@ -2,9 +2,9 @@ from astropy import units as u -from poliastro.core.propagation import markley_coe as markley_fast -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.states import ClassicalState +from hapsira.core.propagation import markley_coe as markley_fast +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.states import ClassicalState from ._compat import OldPropagatorModule diff --git a/src/poliastro/twobody/propagation/mikkola.py b/src/hapsira/twobody/propagation/mikkola.py similarity index 83% rename from src/poliastro/twobody/propagation/mikkola.py rename to src/hapsira/twobody/propagation/mikkola.py index 64b963245..1f5233af7 100644 --- a/src/poliastro/twobody/propagation/mikkola.py +++ b/src/hapsira/twobody/propagation/mikkola.py @@ -2,9 +2,9 @@ from astropy import units as u -from poliastro.core.propagation import mikkola_coe as mikkola_fast -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.states import ClassicalState +from hapsira.core.propagation import mikkola_coe as mikkola_fast +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.states import ClassicalState from ._compat import OldPropagatorModule diff --git a/src/poliastro/twobody/propagation/pimienta.py b/src/hapsira/twobody/propagation/pimienta.py similarity index 85% rename from src/poliastro/twobody/propagation/pimienta.py rename to src/hapsira/twobody/propagation/pimienta.py index 2a4ff6010..0e21908db 100644 --- a/src/poliastro/twobody/propagation/pimienta.py +++ b/src/hapsira/twobody/propagation/pimienta.py @@ -2,9 +2,9 @@ from astropy import units as u -from poliastro.core.propagation import pimienta_coe as pimienta_fast -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.states import ClassicalState +from hapsira.core.propagation import pimienta_coe as pimienta_fast +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.states import ClassicalState from ._compat import OldPropagatorModule diff --git a/src/poliastro/twobody/propagation/recseries.py b/src/hapsira/twobody/propagation/recseries.py similarity index 88% rename from src/poliastro/twobody/propagation/recseries.py rename to src/hapsira/twobody/propagation/recseries.py index 6e7f4ebe9..cff5a0c23 100644 --- a/src/poliastro/twobody/propagation/recseries.py +++ b/src/hapsira/twobody/propagation/recseries.py @@ -2,9 +2,9 @@ from astropy import units as u -from poliastro.core.propagation import recseries_coe as recseries_fast -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.states import ClassicalState +from hapsira.core.propagation import recseries_coe as recseries_fast +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.states import ClassicalState from ._compat import OldPropagatorModule diff --git a/src/poliastro/twobody/propagation/vallado.py b/src/hapsira/twobody/propagation/vallado.py similarity index 83% rename from src/poliastro/twobody/propagation/vallado.py rename to src/hapsira/twobody/propagation/vallado.py index 9e14e3c3f..06d203929 100644 --- a/src/poliastro/twobody/propagation/vallado.py +++ b/src/hapsira/twobody/propagation/vallado.py @@ -3,9 +3,9 @@ from astropy import units as u import numpy as np -from poliastro.core.propagation import vallado as vallado_fast -from poliastro.twobody.propagation.enums import PropagatorKind -from poliastro.twobody.states import RVState +from hapsira.core.propagation import vallado as vallado_fast +from hapsira.twobody.propagation.enums import PropagatorKind +from hapsira.twobody.states import RVState from ._compat import OldPropagatorModule @@ -40,9 +40,7 @@ class ValladoPropagator: """ kind = ( - PropagatorKind.ELLIPTIC - | PropagatorKind.PARABOLIC - | PropagatorKind.HYPERBOLIC + PropagatorKind.ELLIPTIC | PropagatorKind.PARABOLIC | PropagatorKind.HYPERBOLIC ) def __init__(self, numiter=350): diff --git a/src/poliastro/twobody/sampling.py b/src/hapsira/twobody/sampling.py similarity index 90% rename from src/poliastro/twobody/sampling.py rename to src/hapsira/twobody/sampling.py index c793038c1..89f4bcf73 100644 --- a/src/poliastro/twobody/sampling.py +++ b/src/hapsira/twobody/sampling.py @@ -2,10 +2,10 @@ from astropy.coordinates import CartesianDifferential, CartesianRepresentation import numpy as np -from poliastro.twobody.angles import E_to_nu, nu_to_E -from poliastro.twobody.elements import coe2rv_many, hyp_nu_limit, t_p -from poliastro.twobody.propagation import FarnocchiaPropagator -from poliastro.util import alinspace, wrap_angle +from hapsira.twobody.angles import E_to_nu, nu_to_E +from hapsira.twobody.elements import coe2rv_many, hyp_nu_limit, t_p +from hapsira.twobody.propagation import FarnocchiaPropagator +from hapsira.util import alinspace, wrap_angle @u.quantity_input(ecc=u.one, min_nu=u.rad, max_nu=u.rad) @@ -45,9 +45,7 @@ def sample_closed(ecc, min_nu, max_nu=None, num_values=100): @u.quantity_input(min_nu=u.rad, ecc=u.one, max_nu=u.rad, nu_limit=u.rad) -def sample_open( - ecc, min_nu=None, max_nu=None, num_values=100, *, nu_limit=None -): +def sample_open(ecc, min_nu=None, max_nu=None, num_values=100, *, nu_limit=None): """Sample an open orbit. Notes @@ -93,7 +91,7 @@ def sample(self, orbit): # However, we are also returning the epochs # (since computing them here is more efficient than doing it from the outside) # but there are open questions around StateArrays and epochs. - # See discussion at https://github.com/poliastro/poliastro/pull/1492 + # See discussion at https://github.com/hapsira/hapsira/pull/1492 cartesian = CartesianRepresentation( rr, differentials=CartesianDifferential(vv, xyz_axis=1), xyz_axis=1 ) @@ -101,9 +99,7 @@ def sample(self, orbit): class TrueAnomalyBounds(SamplingStrategy): - def __init__( - self, min_nu=None, max_nu=None, num_values=100, hyp_r_factor=3.0 - ): + def __init__(self, min_nu=None, max_nu=None, num_values=100, hyp_r_factor=3.0): self._min_nu = min_nu self._max_nu = max_nu self._hyp_r_factor = hyp_r_factor @@ -144,9 +140,7 @@ def sample(self, orbit): ] # Unwrap time increments to return monotonic increasing epochs # Notice that astropy.units does not support the period kwarg for np.unwrap - delta_ts = ( - np.unwrap(delta_ts, period=orbit.period.to_value(u.s)) << u.s - ) + delta_ts = np.unwrap(delta_ts, period=orbit.period.to_value(u.s)) << u.s epochs = orbit.epoch + (delta_ts - orbit.t_p) n = nu_values.shape[0] @@ -166,7 +160,7 @@ def sample(self, orbit): # However, we are also returning the epochs # (since computing them here is more efficient than doing it from the outside) # but there are open questions around StateArrays and epochs. - # See discussion at https://github.com/poliastro/poliastro/pull/1492 + # See discussion at https://github.com/hapsira/hapsira/pull/1492 cartesian = CartesianRepresentation( rr, differentials=CartesianDifferential(vv, xyz_axis=1), xyz_axis=1 ) diff --git a/src/poliastro/twobody/states.py b/src/hapsira/twobody/states.py similarity index 93% rename from src/poliastro/twobody/states.py rename to src/hapsira/twobody/states.py index af6744023..53899ca37 100644 --- a/src/poliastro/twobody/states.py +++ b/src/hapsira/twobody/states.py @@ -2,8 +2,8 @@ from astropy import units as u -from poliastro.core.elements import coe2mee, coe2rv, mee2coe, mee2rv, rv2coe -from poliastro.twobody.elements import mean_motion, period, t_p +from hapsira.core.elements import coe2mee, coe2rv, mee2coe, mee2rv, rv2coe +from hapsira.twobody.elements import mean_motion, period, t_p class BaseState: @@ -18,7 +18,7 @@ def __init__(self, attractor, elements, plane): Main attractor. elements : tuple Six-tuple of orbital elements for this state. - plane : ~poliastro.frames.enums.Planes + plane : ~hapsira.frames.enums.Planes Reference plane for the elements. """ @@ -171,13 +171,9 @@ def to_value(self): def to_vectors(self): """Converts to position and velocity vector representation.""" - r, v = coe2rv( - self.attractor.k.to_value(u.km**3 / u.s**2), *self.to_value() - ) + r, v = coe2rv(self.attractor.k.to_value(u.km**3 / u.s**2), *self.to_value()) - return RVState( - self.attractor, (r << u.km, v << u.km / u.s), self.plane - ) + return RVState(self.attractor, (r << u.km, v << u.km / u.s), self.plane) def to_classical(self): """Converts to classical orbital elements representation.""" @@ -334,6 +330,4 @@ def to_classical(self): def to_vectors(self): """Converts to position and velocity vector representation.""" r, v = mee2rv(*self.to_value()) - return RVState( - self.attractor, (r << u.km, v << u.km / u.s), self.plane - ) + return RVState(self.attractor, (r << u.km, v << u.km / u.s), self.plane) diff --git a/src/hapsira/twobody/thrust/__init__.py b/src/hapsira/twobody/thrust/__init__.py new file mode 100644 index 000000000..924fcb10a --- /dev/null +++ b/src/hapsira/twobody/thrust/__init__.py @@ -0,0 +1,13 @@ +from hapsira.twobody.thrust.change_a_inc import change_a_inc +from hapsira.twobody.thrust.change_argp import change_argp +from hapsira.twobody.thrust.change_ecc_inc import change_ecc_inc +from hapsira.twobody.thrust.change_ecc_quasioptimal import ( + change_ecc_quasioptimal, +) + +__all__ = [ + "change_a_inc", + "change_argp", + "change_ecc_quasioptimal", + "change_ecc_inc", +] diff --git a/src/poliastro/twobody/thrust/change_a_inc.py b/src/hapsira/twobody/thrust/change_a_inc.py similarity index 96% rename from src/poliastro/twobody/thrust/change_a_inc.py rename to src/hapsira/twobody/thrust/change_a_inc.py index 97c8775ae..fb391255f 100644 --- a/src/poliastro/twobody/thrust/change_a_inc.py +++ b/src/hapsira/twobody/thrust/change_a_inc.py @@ -1,6 +1,6 @@ from astropy import units as u -from poliastro.core.thrust.change_a_inc import ( +from hapsira.core.thrust.change_a_inc import ( change_a_inc as change_a_inc_fast, ) diff --git a/src/poliastro/twobody/thrust/change_argp.py b/src/hapsira/twobody/thrust/change_argp.py similarity index 94% rename from src/poliastro/twobody/thrust/change_argp.py rename to src/hapsira/twobody/thrust/change_argp.py index 4ef827723..cc574234e 100644 --- a/src/poliastro/twobody/thrust/change_argp.py +++ b/src/hapsira/twobody/thrust/change_argp.py @@ -9,7 +9,7 @@ """ from astropy import units as u -from poliastro.core.thrust.change_argp import change_argp as change_a_inc_fast +from hapsira.core.thrust.change_argp import change_argp as change_a_inc_fast def change_argp(k, a, ecc, argp_0, argp_f, f): diff --git a/src/poliastro/twobody/thrust/change_ecc_inc.py b/src/hapsira/twobody/thrust/change_ecc_inc.py similarity index 96% rename from src/poliastro/twobody/thrust/change_ecc_inc.py rename to src/hapsira/twobody/thrust/change_ecc_inc.py index 206c81573..4c3ca0c45 100644 --- a/src/poliastro/twobody/thrust/change_ecc_inc.py +++ b/src/hapsira/twobody/thrust/change_ecc_inc.py @@ -1,6 +1,6 @@ from astropy import units as u -from poliastro.core.thrust.change_ecc_inc import ( +from hapsira.core.thrust.change_ecc_inc import ( change_ecc_inc as change_ecc_inc_fast, ) diff --git a/src/poliastro/twobody/thrust/change_ecc_quasioptimal.py b/src/hapsira/twobody/thrust/change_ecc_quasioptimal.py similarity index 92% rename from src/poliastro/twobody/thrust/change_ecc_quasioptimal.py rename to src/hapsira/twobody/thrust/change_ecc_quasioptimal.py index 1bf7a3f55..c7f13305b 100644 --- a/src/poliastro/twobody/thrust/change_ecc_quasioptimal.py +++ b/src/hapsira/twobody/thrust/change_ecc_quasioptimal.py @@ -11,8 +11,8 @@ import numpy as np from numpy import cross -from poliastro.core.thrust.change_ecc_quasioptimal import extra_quantities -from poliastro.util import norm +from hapsira.core.thrust.change_ecc_quasioptimal import extra_quantities +from hapsira.util import norm def change_ecc_quasioptimal(orb_0, ecc_f, f): diff --git a/src/poliastro/util.py b/src/hapsira/util.py similarity index 92% rename from src/poliastro/util.py rename to src/hapsira/util.py index 016c39e53..d1886867a 100644 --- a/src/poliastro/util.py +++ b/src/hapsira/util.py @@ -4,8 +4,8 @@ from astropy.time import Time import numpy as np -from poliastro._math.linalg import norm as norm_fast -from poliastro.core.util import alinspace as alinspace_fast +from hapsira._math.linalg import norm as norm_fast +from hapsira.core.util import alinspace as alinspace_fast def norm(vec, axis=None): @@ -93,9 +93,7 @@ def alinspace(start, stop=None, *, num=50, endpoint=True): stop = start + 2 * np.pi * u.rad return ( - alinspace_fast( - start.to_value(u.rad), stop.to_value(u.rad), num, endpoint - ) + alinspace_fast(start.to_value(u.rad), stop.to_value(u.rad), num, endpoint) * u.rad ) diff --git a/src/poliastro/warnings.py b/src/hapsira/warnings.py similarity index 100% rename from src/poliastro/warnings.py rename to src/hapsira/warnings.py diff --git a/src/poliastro/core/propagation/__init__.py b/src/poliastro/core/propagation/__init__.py deleted file mode 100644 index ac23044af..000000000 --- a/src/poliastro/core/propagation/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -"""Low level propagation algorithms.""" - -from poliastro.core.propagation.base import func_twobody -from poliastro.core.propagation.cowell import cowell -from poliastro.core.propagation.danby import danby, danby_coe -from poliastro.core.propagation.farnocchia import ( - farnocchia_coe, - farnocchia_rv as farnocchia, -) -from poliastro.core.propagation.gooding import gooding, gooding_coe -from poliastro.core.propagation.markley import markley, markley_coe -from poliastro.core.propagation.mikkola import mikkola, mikkola_coe -from poliastro.core.propagation.pimienta import pimienta, pimienta_coe -from poliastro.core.propagation.recseries import recseries, recseries_coe -from poliastro.core.propagation.vallado import vallado - -__all__ = [ - "cowell", - "func_twobody", - "farnocchia_coe", - "farnocchia", - "vallado", - "mikkola_coe", - "mikkola", - "markley_coe", - "markley", - "pimienta_coe", - "pimienta", - "gooding_coe", - "gooding", - "danby_coe", - "danby", - "recseries_coe", - "recseries", -] diff --git a/src/poliastro/core/thrust/__init__.py b/src/poliastro/core/thrust/__init__.py deleted file mode 100644 index f257ea2ed..000000000 --- a/src/poliastro/core/thrust/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from poliastro.core.thrust.change_a_inc import change_a_inc -from poliastro.core.thrust.change_argp import change_argp -from poliastro.core.thrust.change_ecc_inc import change_ecc_inc - -__all__ = ["change_a_inc", "change_argp", "change_ecc_inc"] diff --git a/src/poliastro/earth/atmosphere/__init__.py b/src/poliastro/earth/atmosphere/__init__.py deleted file mode 100644 index 858140e6a..000000000 --- a/src/poliastro/earth/atmosphere/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from poliastro.earth.atmosphere.coesa62 import COESA62 -from poliastro.earth.atmosphere.coesa76 import COESA76 - -__all__ = ["COESA62", "COESA76"] diff --git a/src/poliastro/frames/__init__.py b/src/poliastro/frames/__init__.py deleted file mode 100644 index ab06c3af3..000000000 --- a/src/poliastro/frames/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from poliastro.frames.enums import Planes - -__all__ = [ - "Planes", -] diff --git a/src/poliastro/plotting/__init__.py b/src/poliastro/plotting/__init__.py deleted file mode 100644 index 17d10e83f..000000000 --- a/src/poliastro/plotting/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -from poliastro.plotting.gabbard import GabbardPlotter -from poliastro.plotting.orbit.plotter import OrbitPlotter -from poliastro.plotting.porkchop import PorkchopPlotter -from poliastro.plotting.tisserand import TisserandPlotter - -__all__ = [ - "OrbitPlotter", - "GabbardPlotter", - "PorkchopPlotter", - "TisserandPlotter", -] diff --git a/src/poliastro/twobody/__init__.py b/src/poliastro/twobody/__init__.py deleted file mode 100644 index 9cf3285c3..000000000 --- a/src/poliastro/twobody/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from poliastro.twobody.orbit import Orbit - -__all__ = ["Orbit"] diff --git a/src/poliastro/twobody/orbit/__init__.py b/src/poliastro/twobody/orbit/__init__.py deleted file mode 100644 index ccfc0f1db..000000000 --- a/src/poliastro/twobody/orbit/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from poliastro.twobody.orbit.scalar import Orbit - -__all__ = ["Orbit"] diff --git a/src/poliastro/twobody/thrust/__init__.py b/src/poliastro/twobody/thrust/__init__.py deleted file mode 100644 index 5b77eeee7..000000000 --- a/src/poliastro/twobody/thrust/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -from poliastro.twobody.thrust.change_a_inc import change_a_inc -from poliastro.twobody.thrust.change_argp import change_argp -from poliastro.twobody.thrust.change_ecc_inc import change_ecc_inc -from poliastro.twobody.thrust.change_ecc_quasioptimal import ( - change_ecc_quasioptimal, -) - -__all__ = [ - "change_a_inc", - "change_argp", - "change_ecc_quasioptimal", - "change_ecc_inc", -] diff --git a/tests/conftest.py b/tests/conftest.py index a7c710108..e99c92396 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,8 +3,8 @@ from astropy.time import Time import pytest -from poliastro.bodies import Earth, Sun -from poliastro.twobody import Orbit +from hapsira.bodies import Earth, Sun +from hapsira.twobody import Orbit solar_system_ephemeris.set("builtin") diff --git a/tests/test_bodies.py b/tests/test_bodies.py index 14076d4ef..4e6143460 100644 --- a/tests/test_bodies.py +++ b/tests/test_bodies.py @@ -4,8 +4,8 @@ from astropy.tests.helper import assert_quantity_allclose import pytest -from poliastro.bodies import Body, Earth, Jupiter, Sun -from poliastro.examples import iss +from hapsira.bodies import Body, Earth, Jupiter, Sun +from hapsira.examples import iss def test_body_has_k_given_in_constructor(): diff --git a/tests/test_czml.py b/tests/test_czml.py index b967cf4ca..653750b7f 100644 --- a/tests/test_czml.py +++ b/tests/test_czml.py @@ -7,19 +7,17 @@ # TODO: Should we have way to handle this configuration without importing numba? import pytest -from poliastro.bodies import Mars -from poliastro.examples import iss, molniya +from hapsira.bodies import Mars +from hapsira.examples import iss, molniya try: from czml3.core import Document - from poliastro.czml.extract_czml import CZMLExtractor + from hapsira.czml.extract_czml import CZMLExtractor except ImportError: pass -pytestmark = pytest.mark.skipif( - "czml3" not in sys.modules, reason="requires czml3" -) +pytestmark = pytest.mark.skipif("czml3" not in sys.modules, reason="requires czml3") def test_czml_get_document(): @@ -41,7 +39,9 @@ def test_czml_custom_packet(): sample_points = 10 - pr_map_url = "https://upload.wikimedia.org/wikipedia/commons/c/c4/Earthmap1000x500compac.jpg" + pr_map_url = ( + "https://upload.wikimedia.org/wikipedia/commons/c/c4/Earthmap1000x500compac.jpg" + ) scene = False expected_packet = """{ "id": "custom_properties", @@ -471,9 +471,7 @@ def test_czml_add_trajectory(expected_doc_add_trajectory): extractor = CZMLExtractor(start_epoch, end_epoch, sample_points) - extractor.add_trajectory( - positions, epochs, label_text="Test", path_color=color - ) + extractor.add_trajectory(positions, epochs, label_text="Test", path_color=color) assert repr(extractor.packets) == expected_doc_add_trajectory @@ -495,9 +493,7 @@ def test_czml_raises_error_if_length_of_points_and_epochs_not_same(): extractor = CZMLExtractor(start_epoch, end_epoch, sample_points) with pytest.raises(ValueError) as excinfo: - extractor.add_trajectory( - positions, epochs, label_text="Test", path_color=color - ) + extractor.add_trajectory(positions, epochs, label_text="Test", path_color=color) assert "Number of Points and Epochs must be equal." in excinfo.exconly() @@ -820,9 +816,7 @@ def test_czml_ground_station(): label_text="GS test", ) - extractor.add_ground_station( - [0.70930 * u.rad, 0.40046 * u.rad], label_show=False - ) + extractor.add_ground_station([0.70930 * u.rad, 0.40046 * u.rad], label_show=False) assert repr(extractor.packets) == expected_doc @@ -924,7 +918,4 @@ def test_czml_add_trajectory_raises_error_for_groundtrack_show(): with pytest.raises(NotImplementedError) as excinfo: extractor.add_trajectory(positions, epochs, groundtrack_show=True) - assert ( - "Ground tracking for trajectory not implemented yet" - in excinfo.exconly() - ) + assert "Ground tracking for trajectory not implemented yet" in excinfo.exconly() diff --git a/tests/test_ephem.py b/tests/test_ephem.py index 7dd060482..a940b36f2 100644 --- a/tests/test_ephem.py +++ b/tests/test_ephem.py @@ -12,19 +12,17 @@ import numpy as np import pytest -from poliastro.bodies import Earth, Venus -from poliastro.ephem import Ephem, SincInterpolator, SplineInterpolator -from poliastro.frames import Planes -from poliastro.twobody.orbit import Orbit -from poliastro.warnings import TimeScaleWarning +from hapsira.bodies import Earth, Venus +from hapsira.ephem import Ephem, SincInterpolator, SplineInterpolator +from hapsira.frames import Planes +from hapsira.twobody.orbit import Orbit +from hapsira.warnings import TimeScaleWarning AVAILABLE_INTERPOLATORS = [SincInterpolator(), SplineInterpolator()] AVAILABLE_PLANES = Planes.__members__.values() -def assert_coordinates_allclose( - actual, desired, rtol=1e-7, atol_scale=None, **kwargs -): +def assert_coordinates_allclose(actual, desired, rtol=1e-7, atol_scale=None, **kwargs): if atol_scale is None: atol_scale = 0 @@ -83,8 +81,7 @@ def test_ephem_fails_if_dimensions_are_not_correct(epochs, coordinates): with pytest.raises(ValueError) as excinfo: Ephem(epochs[0], coordinates, unused_plane) assert ( - "Coordinates and epochs must have dimension 1, got 0 and 1" - in excinfo.exconly() + "Coordinates and epochs must have dimension 1, got 0 and 1" in excinfo.exconly() ) @@ -142,18 +139,14 @@ def test_ephem_sample_scalar_epoch_and_coordinates_returns_exactly_same_input( @pytest.mark.parametrize("interpolator", AVAILABLE_INTERPOLATORS) -def test_ephem_sample_same_epochs_returns_same_input( - epochs, coordinates, interpolator -): +def test_ephem_sample_same_epochs_returns_same_input(epochs, coordinates, interpolator): unused_plane = Planes.EARTH_EQUATOR ephem = Ephem(coordinates, epochs, unused_plane) result_coordinates = ephem.sample(epochs, interpolator=interpolator) # TODO: Should it return exactly the same? - assert_coordinates_allclose( - result_coordinates, coordinates, atol_scale=1e-17 - ) + assert_coordinates_allclose(result_coordinates, coordinates, atol_scale=1e-17) @pytest.mark.parametrize("interpolator", AVAILABLE_INTERPOLATORS) @@ -166,9 +159,7 @@ def test_ephem_sample_existing_epochs_returns_corresponding_input( result_coordinates = ephem.sample(epochs[::2], interpolator=interpolator) # Exactly the same - assert_coordinates_allclose( - result_coordinates, coordinates[::2], atol_scale=1e-17 - ) + assert_coordinates_allclose(result_coordinates, coordinates[::2], atol_scale=1e-17) def test_rv_no_parameters_returns_input_vectors(coordinates, epochs): @@ -205,9 +196,7 @@ def test_rv_scalar_epoch_returns_scalar_vectors(coordinates, epochs): (Planes.EARTH_ECLIPTIC, BarycentricMeanEcliptic, 1e-5), ], ) -def test_ephem_from_body_has_expected_properties( - interpolator, plane, FrameClass, rtol -): +def test_ephem_from_body_has_expected_properties(interpolator, plane, FrameClass, rtol): epochs = Time( [ "2020-03-01 12:00:00", @@ -267,7 +256,7 @@ def test_from_body_scalar_epoch_uses_reshaped_epochs(): assert ephem.epochs == expected_epochs -@mock.patch("poliastro.ephem.Horizons") +@mock.patch("hapsira.ephem.Horizons") @pytest.mark.parametrize( "attractor,location_str", [(None, "@ssb"), (Earth, "500@399"), (Venus, "500@299")], @@ -294,9 +283,7 @@ def test_ephem_from_horizons_calls_horizons_with_correct_parameters( expected_coordinates = CartesianRepresentation( [(1, 0, 0)] * u.au, xyz_axis=1, - differentials=CartesianDifferential( - [(0, 1, 0)] * (u.au / u.day), xyz_axis=1 - ), + differentials=CartesianDifferential([(0, 1, 0)] * (u.au / u.day), xyz_axis=1), ) ephem = Ephem.from_horizons( @@ -320,7 +307,7 @@ def test_ephem_from_horizons_calls_horizons_with_correct_parameters( assert_coordinates_allclose(coordinates, expected_coordinates) -@mock.patch("poliastro.ephem.Horizons") +@mock.patch("hapsira.ephem.Horizons") def test_from_horizons_scalar_epoch_uses_reshaped_epochs(horizons_mock): unused_name = "Strange Object" unused_id_type = "id_type" diff --git a/tests/test_examples.py b/tests/test_examples.py index 8ab5fb1a5..34e2c07d7 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1,2 +1,2 @@ # This line tests all the statements so far -from poliastro import examples # noqa +from hapsira import examples # noqa diff --git a/tests/test_frames.py b/tests/test_frames.py index 3863fb70a..405e61487 100644 --- a/tests/test_frames.py +++ b/tests/test_frames.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from poliastro.bodies import ( +from hapsira.bodies import ( Earth, Jupiter, Mars, @@ -17,9 +17,9 @@ Uranus, Venus, ) -from poliastro.constants import J2000 -from poliastro.frames.ecliptic import GeocentricSolarEcliptic -from poliastro.frames.equatorial import ( +from hapsira.constants import J2000 +from hapsira.frames.ecliptic import GeocentricSolarEcliptic +from hapsira.frames.equatorial import ( GCRS, HCRS, ICRS, @@ -31,7 +31,7 @@ UranusICRS, VenusICRS, ) -from poliastro.frames.fixed import ( +from hapsira.frames.fixed import ( ITRS, JupiterFixed, MarsFixed, @@ -115,9 +115,7 @@ def test_icrs_body_position_to_planetary_frame_yields_zeros(body, frame): .represent_as(CartesianRepresentation) ) - assert_quantity_allclose( - vector_result.xyz, [0, 0, 0] * u.km, atol=1e-7 * u.km - ) + assert_quantity_allclose(vector_result.xyz, [0, 0, 0] * u.km, atol=1e-7 * u.km) @pytest.mark.parametrize( @@ -134,9 +132,7 @@ def test_icrs_body_position_to_planetary_frame_yields_zeros(body, frame): (Neptune, NeptuneFixed, NeptuneICRS), ], ) -def test_planetary_fixed_inertial_conversion( - body, fixed_frame, inertial_frame -): +def test_planetary_fixed_inertial_conversion(body, fixed_frame, inertial_frame): epoch = J2000 fixed_position = fixed_frame( 0 * u.deg, @@ -145,9 +141,7 @@ def test_planetary_fixed_inertial_conversion( obstime=epoch, representation_type="spherical", ) - inertial_position = fixed_position.transform_to( - inertial_frame(obstime=epoch) - ) + inertial_position = fixed_position.transform_to(inertial_frame(obstime=epoch)) assert_quantity_allclose( fixed_position.spherical.distance, body.R, atol=1e-7 * u.km ) @@ -170,9 +164,7 @@ def test_planetary_fixed_inertial_conversion( (Neptune, NeptuneFixed, NeptuneICRS), ], ) -def test_planetary_inertial_fixed_conversion( - body, fixed_frame, inertial_frame -): +def test_planetary_inertial_fixed_conversion(body, fixed_frame, inertial_frame): epoch = J2000 inertial_position = inertial_frame( 0 * u.deg, @@ -204,9 +196,7 @@ def test_planetary_inertial_fixed_conversion( (Neptune, NeptuneFixed, NeptuneICRS), ], ) -def test_planetary_inertial_roundtrip_vector( - body, fixed_frame, inertial_frame -): +def test_planetary_inertial_roundtrip_vector(body, fixed_frame, inertial_frame): epoch = J2000 sampling_time = 10 * u.s fixed_position = fixed_frame( @@ -249,9 +239,7 @@ def test_GeocentricSolarEcliptic_against_data(): def test_GeocentricSolarEcliptic_raises_error_nonscalar_obstime(): with pytest.raises(ValueError) as excinfo: gcrs = GCRS(ra="02h31m49.09s", dec="+89d15m50.8s", distance=200 * u.km) - gcrs.transform_to( - GeocentricSolarEcliptic(obstime=Time(["J3200", "J2000"])) - ) + gcrs.transform_to(GeocentricSolarEcliptic(obstime=Time(["J3200", "J2000"]))) assert ( "To perform this transformation the " "obstime Attribute must be a scalar." in str(excinfo.value) @@ -300,9 +288,7 @@ def test_GeocentricSolarEcliptic_raises_error_nonscalar_obstime(): ), ], ) -def test_fixed_frame_calculation_gives_expected_result( - body, fixed_frame, radecW -): +def test_fixed_frame_calculation_gives_expected_result(body, fixed_frame, radecW): epoch = J2000 fixed_position = fixed_frame( 0 * u.deg, diff --git a/tests/test_hyper.py b/tests/test_hyper.py index aa0fa3e46..1caf64fe7 100644 --- a/tests/test_hyper.py +++ b/tests/test_hyper.py @@ -3,7 +3,7 @@ import pytest from scipy import special -from poliastro._math.special import hyp2f1b as hyp2f1 +from hapsira._math.special import hyp2f1b as hyp2f1 @pytest.mark.parametrize("x", np.linspace(0, 1, num=11)) diff --git a/tests/test_iod.py b/tests/test_iod.py index 1dfe82ffa..ba44a1f37 100644 --- a/tests/test_iod.py +++ b/tests/test_iod.py @@ -2,9 +2,9 @@ from astropy.tests.helper import assert_quantity_allclose import pytest -from poliastro.bodies import Earth -from poliastro.core import iod -from poliastro.iod import izzo, vallado +from hapsira.bodies import Earth +from hapsira.core import iod +from hapsira.iod import izzo, vallado @pytest.mark.parametrize("lambert", [vallado.lambert, izzo.lambert]) @@ -119,9 +119,7 @@ def test_collinear_vectors_input(lambert): @pytest.mark.parametrize("M", [1, 2, 3]) def test_minimum_time_of_flight_convergence(M): ll = -1 - x_T_min_expected, T_min_expected = iod._compute_T_min( - ll, M, numiter=10, rtol=1e-8 - ) + x_T_min_expected, T_min_expected = iod._compute_T_min(ll, M, numiter=10, rtol=1e-8) y = iod._compute_y(x_T_min_expected, ll) T_min = iod._tof_equation_y(x_T_min_expected, y, 0.0, ll, M) assert T_min_expected == T_min @@ -173,6 +171,6 @@ def test_vallado_not_implemented_multirev(): with pytest.raises(NotImplementedError) as excinfo: vallado.lambert(k, r0, r, tof, M=1) assert ( - "Multi-revolution scenario not supported for Vallado. See issue https://github.com/poliastro/poliastro/issues/858" + "Multi-revolution scenario not supported for Vallado. See issue https://github.com/hapsira/hapsira/issues/858" in excinfo.exconly() ) diff --git a/tests/test_maneuver.py b/tests/test_maneuver.py index c36d9218d..41f2cb456 100644 --- a/tests/test_maneuver.py +++ b/tests/test_maneuver.py @@ -7,10 +7,10 @@ from numpy.testing import assert_allclose import pytest -from poliastro.bodies import Earth, Mercury, Moon -from poliastro.frames import Planes -from poliastro.maneuver import Maneuver -from poliastro.twobody import Orbit +from hapsira.bodies import Earth, Mercury, Moon +from hapsira.frames import Planes +from hapsira.maneuver import Maneuver +from hapsira.twobody import Orbit def test_maneuver_constructor_raises_error_if_invalid_delta_v(): @@ -19,9 +19,7 @@ def test_maneuver_constructor_raises_error_if_invalid_delta_v(): with pytest.raises(ValueError) as excinfo: with warnings.catch_warnings(): # Different length numpy arrays generate a deprecation warning. - warnings.simplefilter( - "ignore", category=np.VisibleDeprecationWarning - ) + warnings.simplefilter("ignore", category=np.VisibleDeprecationWarning) Maneuver((0 * u.s, dv1), (2 * u.s, dv2)) assert "Delta-V must be three dimensions vectors" in excinfo.exconly() @@ -95,9 +93,7 @@ def test_hohmann_maneuver(nu): man = Maneuver.hohmann(orb_i, Earth.R + alt_f) assert_quantity_allclose(man.get_total_cost(), expected_dv, rtol=1e-5) - assert_quantity_allclose( - man.get_total_time(), expected_total_time, rtol=1e-5 - ) + assert_quantity_allclose(man.get_total_time(), expected_total_time, rtol=1e-5) assert_quantity_allclose( orb_i.apply_maneuver(man).ecc, 0 * u.one, atol=1e-14 * u.one @@ -129,13 +125,9 @@ def test_bielliptic_maneuver(nu): man = Maneuver.bielliptic(orb_i, Earth.R + alt_b, Earth.R + alt_f) - assert_allclose( - orb_i.apply_maneuver(man).ecc, 0 * u.one, atol=1e-12 * u.one - ) + assert_allclose(orb_i.apply_maneuver(man).ecc, 0 * u.one, atol=1e-12 * u.one) assert_quantity_allclose(man.get_total_cost(), expected_dv, rtol=1e-5) - assert_quantity_allclose( - man.get_total_time(), expected_total_time, rtol=1e-6 - ) + assert_quantity_allclose(man.get_total_time(), expected_total_time, rtol=1e-6) def test_apply_maneuver_correct_dimensions(): @@ -161,17 +153,10 @@ def test_repr_maneuver(): alt_fi = 376310.0 * u.km orb_i = Orbit.from_vectors(Earth, r, v) - expected_hohmann_maneuver = ( - "Number of impulses: 2, Total cost: 3.060548 km / s" - ) - expected_bielliptic_maneuver = ( - "Number of impulses: 3, Total cost: 3.122556 km / s" - ) + expected_hohmann_maneuver = "Number of impulses: 2, Total cost: 3.060548 km / s" + expected_bielliptic_maneuver = "Number of impulses: 3, Total cost: 3.122556 km / s" - assert ( - repr(Maneuver.hohmann(orb_i, Earth.R + alt_f)) - == expected_hohmann_maneuver - ) + assert repr(Maneuver.hohmann(orb_i, Earth.R + alt_f)) == expected_hohmann_maneuver assert ( repr(Maneuver.bielliptic(orb_i, Earth.R + alt_b, Earth.R + alt_fi)) == expected_bielliptic_maneuver @@ -189,8 +174,7 @@ def test_repr_maneuver(): 0.001 * u.one, 0.7855682278773197 * u.rad, 2224141.03634 * u.s, - np.array([0, 0.0083290328315531, 0.00833186625871848]) - * (u.km / u.s), + np.array([0, 0.0083290328315531, 0.00833186625871848]) * (u.km / u.s), ), ], ) @@ -209,9 +193,7 @@ def test_correct_pericenter( maneuver = Maneuver.correct_pericenter(ss0, max_delta_r) assert_quantity_allclose(maneuver[0][0], expected_t) - assert_quantity_allclose( - maneuver[0][1].value.tolist(), expected_v.value.tolist() - ) + assert_quantity_allclose(maneuver[0][1].value.tolist(), expected_v.value.tolist()) def test_correct_pericenter_J2_exception(): diff --git a/tests/test_sensors.py b/tests/test_sensors.py index 61057bb45..02b7615f5 100644 --- a/tests/test_sensors.py +++ b/tests/test_sensors.py @@ -2,8 +2,8 @@ from astropy.tests.helper import assert_quantity_allclose import pytest -from poliastro.bodies import Earth -from poliastro.sensors import ( +from hapsira.bodies import Earth +from hapsira.sensors import ( ground_range_diff_at_azimuth, min_and_max_ground_range, ) @@ -33,9 +33,7 @@ def test_max_and_min_ground_range( altitude, fov, boresight, expected_lat_lon_max, expected_lat_lon_min ): R = Earth.R.to(u.km) - lat_lon_min, lat_lon_max = min_and_max_ground_range( - altitude, fov, boresight, R - ) + lat_lon_min, lat_lon_max = min_and_max_ground_range(altitude, fov, boresight, R) assert_quantity_allclose(lat_lon_max, expected_lat_lon_max, rtol=1e-4) assert_quantity_allclose(lat_lon_min, expected_lat_lon_min, rtol=1e-4) @@ -72,9 +70,7 @@ def test_ground_range_diff_at_azimuth( ground_range_diff, target_lat, target_lon = ground_range_diff_at_azimuth( altitude, fov, boresight, azimuth, nadir_lat, nadir_lon, R ) - assert_quantity_allclose( - ground_range_diff, expected_ground_range_diff, rtol=1e-5 - ) + assert_quantity_allclose(ground_range_diff, expected_ground_range_diff, rtol=1e-5) assert_quantity_allclose(target_lat, expected_target_lat, rtol=1e-6) assert_quantity_allclose(target_lon, expected_target_lon, rtol=1e-6) diff --git a/tests/test_spheroid_location.py b/tests/test_spheroid_location.py index 9f4e6bfb5..5babcbce0 100644 --- a/tests/test_spheroid_location.py +++ b/tests/test_spheroid_location.py @@ -2,8 +2,8 @@ from astropy.tests.helper import assert_quantity_allclose from hypothesis import given, settings, strategies as st -from poliastro.bodies import Earth -from poliastro.spheroid_location import SpheroidLocation +from hapsira.bodies import Earth +from hapsira.spheroid_location import SpheroidLocation @st.composite @@ -110,9 +110,7 @@ def test_cartesian_conversion_approximate(): @settings(deadline=None) @given( - lat=with_units( - elements=st.floats(min_value=-1e-2, max_value=1e-2), unit=u.rad - ), + lat=with_units(elements=st.floats(min_value=-1e-2, max_value=1e-2), unit=u.rad), ) def test_h_calculation_near_lat_singularity(lat): body = Earth diff --git a/tests/test_stumpff.py b/tests/test_stumpff.py index 6f889bed3..4ee7b0be5 100644 --- a/tests/test_stumpff.py +++ b/tests/test_stumpff.py @@ -1,7 +1,7 @@ from numpy import cos, cosh, sin, sinh from numpy.testing import assert_allclose -from poliastro._math.special import stumpff_c2 as c2, stumpff_c3 as c3 +from hapsira._math.special import stumpff_c2 as c2, stumpff_c3 as c3 def test_stumpff_functions_near_zero(): diff --git a/tests/test_util.py b/tests/test_util.py index e44c8ce2b..b264d79f6 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -3,7 +3,7 @@ from astropy.time import Time import pytest -from poliastro.util import time_range +from hapsira.util import time_range def test_time_range_spacing_num_values(): @@ -17,37 +17,26 @@ def test_time_range_spacing_num_values(): result_1 = time_range(start_time, spacing=spacing, num_values=num_values) result_2 = time_range(start_time, end=end_time, num_values=num_values) - result_3 = time_range( - Time(start_time), end=Time(end_time), num_values=num_values - ) + result_3 = time_range(Time(start_time), end=Time(end_time), num_values=num_values) assert len(result_1) == len(result_2) == len(result_3) == num_values assert result_1.scale == result_2.scale == result_3.scale == expected_scale - assert_quantity_allclose( - (result_1[-1] - result_1[0]).to(u.s), expected_duration - ) - assert_quantity_allclose( - (result_2[-1] - result_2[0]).to(u.s), expected_duration - ) - assert_quantity_allclose( - (result_3[-1] - result_3[0]).to(u.s), expected_duration - ) + assert_quantity_allclose((result_1[-1] - result_1[0]).to(u.s), expected_duration) + assert_quantity_allclose((result_2[-1] - result_2[0]).to(u.s), expected_duration) + assert_quantity_allclose((result_3[-1] - result_3[0]).to(u.s), expected_duration) def test_time_range_requires_keyword_arguments(): with pytest.raises(TypeError) as excinfo: time_range(0, 0) # type: ignore assert ( - "TypeError: time_range() takes 1 positional argument but" - in excinfo.exconly() + "TypeError: time_range() takes 1 positional argument but" in excinfo.exconly() ) def test_time_range_raises_error_wrong_arguments(): - exception_message = ( - "ValueError: Either 'end' or 'spacing' must be specified" - ) + exception_message = "ValueError: Either 'end' or 'spacing' must be specified" with pytest.raises(ValueError) as excinfo_1: time_range("2017-10-12 00:00") diff --git a/tests/tests_core/test_core_propagation.py b/tests/tests_core/test_core_propagation.py index 410d51e2a..3c9f7e100 100644 --- a/tests/tests_core/test_core_propagation.py +++ b/tests/tests_core/test_core_propagation.py @@ -2,15 +2,15 @@ from astropy.tests.helper import assert_quantity_allclose import pytest -from poliastro.core.propagation import ( +from hapsira.core.propagation import ( danby_coe, gooding_coe, markley_coe, mikkola_coe, pimienta_coe, ) -from poliastro.core.propagation.farnocchia import farnocchia_coe -from poliastro.examples import iss +from hapsira.core.propagation.farnocchia import farnocchia_coe +from hapsira.examples import iss @pytest.mark.parametrize( diff --git a/tests/tests_core/test_core_util.py b/tests/tests_core/test_core_util.py index 13faff0ae..cc613dc58 100644 --- a/tests/tests_core/test_core_util.py +++ b/tests/tests_core/test_core_util.py @@ -8,22 +8,22 @@ from numpy.testing import assert_allclose, assert_array_equal import pytest -from poliastro.core.util import ( +from hapsira.core.util import ( alinspace, - rotation_matrix as rotation_matrix_poliastro, + rotation_matrix as rotation_matrix_hapsira, spherical_to_cartesian, ) def _test_rotation_matrix_with_v(v, angle, axis): exp = rotation_matrix_astropy(np.degrees(-angle), "xyz"[axis]) @ v - res = rotation_matrix_poliastro(angle, axis) @ v + res = rotation_matrix_hapsira(angle, axis) @ v assert_allclose(exp, res) def _test_rotation_matrix(angle, axis): expected = rotation_matrix_astropy(-np.rad2deg(angle), "xyz"[axis]) - result = rotation_matrix_poliastro(angle, axis) + result = rotation_matrix_hapsira(angle, axis) assert_allclose(expected, result) @@ -37,15 +37,15 @@ def test_rotation_matrix(): # These tests are adapted from astropy: # https://github.com/astropy/astropy/blob/main/astropy/coordinates/tests/test_matrix_utilities.py def test_rotation_matrix_astropy(): - assert_array_equal(rotation_matrix_poliastro(0, 0), np.eye(3)) + assert_array_equal(rotation_matrix_hapsira(0, 0), np.eye(3)) assert_allclose( - rotation_matrix_poliastro(np.deg2rad(-90), 1), + rotation_matrix_hapsira(np.deg2rad(-90), 1), [[0, 0, -1], [0, 1, 0], [1, 0, 0]], atol=1e-12, ) assert_allclose( - rotation_matrix_poliastro(np.deg2rad(90), 2), + rotation_matrix_hapsira(np.deg2rad(90), 2), [[0, -1, 0], [1, 0, 0], [0, 0, 1]], atol=1e-12, ) @@ -53,7 +53,7 @@ def test_rotation_matrix_astropy(): # make sure it also works for very small angles assert_allclose( rotation_matrix_astropy(-0.000001, "x"), - rotation_matrix_poliastro(np.deg2rad(0.000001), 0), + rotation_matrix_hapsira(np.deg2rad(0.000001), 0), ) @@ -81,9 +81,7 @@ def test_spherical_to_cartesian(): result = spherical_to_cartesian( np.array([[0.5, np.pi / 4, -np.pi / 4], [0.5, -np.pi / 4, np.pi / 4]]) ) - expected = np.array( - [[0.25, -0.25, 0.35355339], [-0.25, -0.25, 0.35355339]] - ) + expected = np.array([[0.25, -0.25, 0.35355339], [-0.25, -0.25, 0.35355339]]) assert np.allclose(expected, result) diff --git a/tests/tests_core/tests_threebody/test_cr3bp_quantities_calculations.py b/tests/tests_core/tests_threebody/test_cr3bp_quantities_calculations.py index 01a80041f..0421659c1 100644 --- a/tests/tests_core/tests_threebody/test_cr3bp_quantities_calculations.py +++ b/tests/tests_core/tests_threebody/test_cr3bp_quantities_calculations.py @@ -2,8 +2,8 @@ from astropy.tests.helper import assert_quantity_allclose import pytest -from poliastro.bodies import Earth, Moon -from poliastro.core.threebody.cr3bp_quantities_calculations import ( +from hapsira.bodies import Earth, Moon +from hapsira.core.threebody.cr3bp_quantities_calculations import ( calculate_mu, calculate_tstar, ) diff --git a/tests/tests_earth/test_earth_util.py b/tests/tests_earth/test_earth_util.py index 80b499015..aad204577 100644 --- a/tests/tests_earth/test_earth_util.py +++ b/tests/tests_earth/test_earth_util.py @@ -2,7 +2,7 @@ from astropy.tests.helper import assert_quantity_allclose from astropy.time import Time -from poliastro.earth.util import get_local_sidereal_time, raan_from_ltan +from hapsira.earth.util import get_local_sidereal_time, raan_from_ltan def test_raan_from_ltan_metopb(): @@ -21,9 +21,7 @@ def test_raan_from_ltan_metopb(): raan = raan_from_ltan(epoch, ltan) - assert_quantity_allclose( - raan.wrap_at(360 * u.deg), expected_raan, atol=0.3 * u.deg - ) + assert_quantity_allclose(raan.wrap_at(360 * u.deg), expected_raan, atol=0.3 * u.deg) def test_raan_from_ltan_sentinel5p(): @@ -41,9 +39,7 @@ def test_raan_from_ltan_sentinel5p(): raan = raan_from_ltan(epoch, ltan) - assert_quantity_allclose( - raan.wrap_at(360 * u.deg), expected_raan, atol=0.3 * u.deg - ) + assert_quantity_allclose(raan.wrap_at(360 * u.deg), expected_raan, atol=0.3 * u.deg) def test_local_sidereal_time(): diff --git a/tests/tests_earth/test_earthsatellite.py b/tests/tests_earth/test_earthsatellite.py index f61af884d..cf656c919 100644 --- a/tests/tests_earth/test_earthsatellite.py +++ b/tests/tests_earth/test_earthsatellite.py @@ -2,11 +2,11 @@ import numpy as np import pytest -from poliastro.bodies import Earth, Mars -from poliastro.earth import EarthSatellite -from poliastro.earth.enums import EarthGravity -from poliastro.spacecraft import Spacecraft -from poliastro.twobody.orbit import Orbit +from hapsira.bodies import Earth, Mars +from hapsira.earth import EarthSatellite +from hapsira.earth.enums import EarthGravity +from hapsira.spacecraft import Spacecraft +from hapsira.twobody.orbit import Orbit def test_earth_satellite_orbit(): diff --git a/tests/tests_earth/tests_atmosphere/test_coesa62.py b/tests/tests_earth/tests_atmosphere/test_coesa62.py index cb7f8d73c..9f1ce7c16 100644 --- a/tests/tests_earth/tests_atmosphere/test_coesa62.py +++ b/tests/tests_earth/tests_atmosphere/test_coesa62.py @@ -3,7 +3,7 @@ from astropy.units import imperial import pytest -from poliastro.earth.atmosphere import COESA62 +from hapsira.earth.atmosphere import COESA62 coesa62 = COESA62() @@ -29,36 +29,21 @@ def test_get_index_coesa62(): coesa62_solutions = { 0.5 * u.km: [284.900 * u.K, 9.54612e2 * u.mbar, 1.1673 * u.kg / u.m**3], 1.0 * u.km: [281.651 * u.K, 8.98762e2 * u.mbar, 1.1117 * u.kg / u.m**3], - 10.0 - * u.km: [223.252 * u.K, 2.64999e2 * u.mbar, 4.1351e-1 * u.kg / u.m**3], - 77.0 - * u.km: [192.340 * u.K, 1.7725e-2 * u.mbar, 3.210e-5 * u.kg / u.m**3], - 86.0 - * u.km: [180.65 * u.K, 3.4313e-3 * u.mbar, 6.617e-6 * u.kg / u.m**3], - 97.0 - * u.km: [201.65 * u.K, 4.8709e-4 * u.mbar, 8.415e-7 * u.kg / u.m**3], - 103.0 - * u.km: [225.65 * u.K, 1.9074e-4 * u.mbar, 2.945e-7 * u.kg / u.m**3], - 115.0 - * u.km: [310.65 * u.K, 4.1224e-5 * u.mbar, 4.623e-8 * u.kg / u.m**3], - 132.0 - * u.km: [600.65 * u.K, 1.0909e-5 * u.mbar, 6.327e-9 * u.kg / u.m**3], - 157.0 - * u.km: [1065.65 * u.K, 4.0409e-6 * u.mbar, 1.321e-9 * u.kg / u.m**3], - 183.0 - * u.km: [1301.65 * u.K, 1.9979e-6 * u.mbar, 5.347e-10 * u.kg / u.m**3], - 201.0 - * u.km: [1405.65 * u.K, 1.3037e-6 * u.mbar, 3.231e-10 * u.kg / u.m**3], - 258.0 - * u.km: [1662.65 * u.K, 4.0061e-7 * u.mbar, 8.394e-11 * u.kg / u.m**3], - 340.0 - * u.km: [1962.65 * u.K, 9.8014e-8 * u.mbar, 1.740e-11 * u.kg / u.m**3], - 482.0 - * u.km: [2373.85 * u.K, 1.3667e-8 * u.mbar, 2.006e-12 * u.kg / u.m**3], - 576.0 - * u.km: [2549.85 * u.K, 4.5072e-9 * u.mbar, 6.158e-13 * u.kg / u.m**3], - 698.0 - * u.km: [2698.45 * u.K, 1.2165e-9 * u.mbar, 1.570e-13 * u.kg / u.m**3], + 10.0 * u.km: [223.252 * u.K, 2.64999e2 * u.mbar, 4.1351e-1 * u.kg / u.m**3], + 77.0 * u.km: [192.340 * u.K, 1.7725e-2 * u.mbar, 3.210e-5 * u.kg / u.m**3], + 86.0 * u.km: [180.65 * u.K, 3.4313e-3 * u.mbar, 6.617e-6 * u.kg / u.m**3], + 97.0 * u.km: [201.65 * u.K, 4.8709e-4 * u.mbar, 8.415e-7 * u.kg / u.m**3], + 103.0 * u.km: [225.65 * u.K, 1.9074e-4 * u.mbar, 2.945e-7 * u.kg / u.m**3], + 115.0 * u.km: [310.65 * u.K, 4.1224e-5 * u.mbar, 4.623e-8 * u.kg / u.m**3], + 132.0 * u.km: [600.65 * u.K, 1.0909e-5 * u.mbar, 6.327e-9 * u.kg / u.m**3], + 157.0 * u.km: [1065.65 * u.K, 4.0409e-6 * u.mbar, 1.321e-9 * u.kg / u.m**3], + 183.0 * u.km: [1301.65 * u.K, 1.9979e-6 * u.mbar, 5.347e-10 * u.kg / u.m**3], + 201.0 * u.km: [1405.65 * u.K, 1.3037e-6 * u.mbar, 3.231e-10 * u.kg / u.m**3], + 258.0 * u.km: [1662.65 * u.K, 4.0061e-7 * u.mbar, 8.394e-11 * u.kg / u.m**3], + 340.0 * u.km: [1962.65 * u.K, 9.8014e-8 * u.mbar, 1.740e-11 * u.kg / u.m**3], + 482.0 * u.km: [2373.85 * u.K, 1.3667e-8 * u.mbar, 2.006e-12 * u.kg / u.m**3], + 576.0 * u.km: [2549.85 * u.K, 4.5072e-9 * u.mbar, 6.158e-13 * u.kg / u.m**3], + 698.0 * u.km: [2698.45 * u.K, 1.2165e-9 * u.mbar, 1.570e-13 * u.kg / u.m**3], } diff --git a/tests/tests_earth/tests_atmosphere/test_coesa76.py b/tests/tests_earth/tests_atmosphere/test_coesa76.py index 7e8ddb3ff..774a70498 100644 --- a/tests/tests_earth/tests_atmosphere/test_coesa76.py +++ b/tests/tests_earth/tests_atmosphere/test_coesa76.py @@ -2,8 +2,8 @@ from astropy.tests.helper import assert_quantity_allclose import pytest -from poliastro.earth.atmosphere import COESA76 -from poliastro.earth.atmosphere.coesa76 import p_coeff, rho_coeff +from hapsira.earth.atmosphere import COESA76 +from hapsira.earth.atmosphere.coesa76 import p_coeff, rho_coeff coesa76 = COESA76() @@ -42,13 +42,8 @@ def test_coefficients_over_86km(): -12.89844, ] - assert ( - coesa76._get_coefficients_avobe_86(350 * u.km, p_coeff) == expected_p - ) - assert ( - coesa76._get_coefficients_avobe_86(350 * u.km, rho_coeff) - == expected_rho - ) + assert coesa76._get_coefficients_avobe_86(350 * u.km, p_coeff) == expected_p + assert coesa76._get_coefficients_avobe_86(350 * u.km, rho_coeff) == expected_rho # SOLUTIONS DIRECTLY TAKEN FROM COESA76 REPORT @@ -56,14 +51,11 @@ def test_coefficients_over_86km(): 0.5 * u.km: [284.90 * u.K, 9.5461e2 * u.mbar, 1.1673 * u.kg / u.m**3], 1.0 * u.km: [281.651 * u.K, 8.9876e2 * u.mbar, 1.1117 * u.kg / u.m**3], 10 * u.km: [223.252 * u.K, 2.6499e2 * u.mbar, 4.1351e-1 * u.kg / u.m**3], - 77 - * u.km: [204.493 * u.K, 1.7286e-2 * u.mbar, 2.9448e-5 * u.kg / u.m**3], + 77 * u.km: [204.493 * u.K, 1.7286e-2 * u.mbar, 2.9448e-5 * u.kg / u.m**3], 86 * u.km: [186.87 * u.K, 3.7338e-3 * u.mbar, 6.958e-6 * u.kg / u.m**3], 92 * u.km: [186.96 * u.K, 1.2887e-3 * u.mbar, 2.393e-6 * u.kg / u.m**3], - 230 - * u.km: [915.78 * u.K, 3.9276e-7 * u.mbar, 1.029e-10 * u.kg / u.m**3], - 1000 - * u.km: [1000.0 * u.K, 7.5138e-11 * u.mbar, 3.561e-15 * u.kg / u.m**3], + 230 * u.km: [915.78 * u.K, 3.9276e-7 * u.mbar, 1.029e-10 * u.kg / u.m**3], + 1000 * u.km: [1000.0 * u.K, 7.5138e-11 * u.mbar, 3.561e-15 * u.kg / u.m**3], } diff --git a/tests/tests_earth/tests_atmosphere/test_jacchia77.py b/tests/tests_earth/tests_atmosphere/test_jacchia77.py index e8ae11289..584854f5d 100644 --- a/tests/tests_earth/tests_atmosphere/test_jacchia77.py +++ b/tests/tests_earth/tests_atmosphere/test_jacchia77.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from poliastro.earth.atmosphere.jacchia import Jacchia77 +from hapsira.earth.atmosphere.jacchia import Jacchia77 # SOLUTIONS DIRECTLY TAKEN FROM JACCHIA77 REPORT AND # https://git.mysmce.com/ccmc-share/modelwebarchive/-/raw/main/Jacchi-Reference-Atmosphere/t1000.out diff --git a/tests/tests_plotting/test_gabbard.py b/tests/tests_plotting/test_gabbard.py index 335416e6d..ee399212f 100644 --- a/tests/tests_plotting/test_gabbard.py +++ b/tests/tests_plotting/test_gabbard.py @@ -2,10 +2,10 @@ from matplotlib import pyplot as plt import pytest -from poliastro.bodies import Earth -from poliastro.examples import iss -from poliastro.plotting.gabbard import GabbardPlotter -from poliastro.twobody import Orbit +from hapsira.bodies import Earth +from hapsira.examples import iss +from hapsira.plotting.gabbard import GabbardPlotter +from hapsira.twobody import Orbit def test_axes_labels_and_title(): diff --git a/tests/tests_plotting/test_misc.py b/tests/tests_plotting/test_misc.py index 983016926..f6e919983 100644 --- a/tests/tests_plotting/test_misc.py +++ b/tests/tests_plotting/test_misc.py @@ -1,9 +1,9 @@ from matplotlib import pyplot as plt import pytest -from poliastro.plotting.misc import plot_solar_system -from poliastro.plotting.orbit.backends import DEFAULT_ORBIT_PLOTTER_BACKENDS -from poliastro.plotting.orbit.backends._base import OrbitPlotterBackend +from hapsira.plotting.misc import plot_solar_system +from hapsira.plotting.orbit.backends import DEFAULT_ORBIT_PLOTTER_BACKENDS +from hapsira.plotting.orbit.backends._base import OrbitPlotterBackend @pytest.mark.parametrize("outer, expected", [(True, 8), (False, 4)]) diff --git a/tests/tests_plotting/test_orbit_plotter.py b/tests/tests_plotting/test_orbit_plotter.py index 82195b0e3..b769979f8 100644 --- a/tests/tests_plotting/test_orbit_plotter.py +++ b/tests/tests_plotting/test_orbit_plotter.py @@ -6,21 +6,21 @@ from matplotlib import pyplot as plt import pytest -from poliastro.bodies import Earth, Jupiter, Mars, Sun -from poliastro.constants import J2000_TDB -from poliastro.ephem import Ephem -from poliastro.examples import churi, iss, molniya -from poliastro.frames import Planes -from poliastro.maneuver import Maneuver -from poliastro.plotting import OrbitPlotter -from poliastro.plotting.orbit.backends import ( +from hapsira.bodies import Earth, Jupiter, Mars, Sun +from hapsira.constants import J2000_TDB +from hapsira.ephem import Ephem +from hapsira.examples import churi, iss, molniya +from hapsira.frames import Planes +from hapsira.maneuver import Maneuver +from hapsira.plotting import OrbitPlotter +from hapsira.plotting.orbit.backends import ( DEFAULT_ORBIT_PLOTTER_BACKENDS, DEFAULT_ORBIT_PLOTTER_BACKENDS_2D, DEFAULT_ORBIT_PLOTTER_BACKENDS_3D, Matplotlib2D, ) -from poliastro.twobody import Orbit -from poliastro.util import time_range +from hapsira.twobody import Orbit +from hapsira.util import time_range # @pytest.mark.parametrize("backend", SUPPORTED_ORBIT_PLOTTER_BACKENDS) # def test_get_figure_has_expected_properties(backend): @@ -159,9 +159,7 @@ def test_set_view(Backend): [(True, (0.0, 0.0, 0.0, 1.0)), (False, (1.0, 1.0, 1.0, 1))], ) @pytest.mark.parametrize("MatplotlibBackend", [Matplotlib2D]) -def test_dark_theme_backend_matplotlib( - MatplotlibBackend, is_dark, expected_bg -): +def test_dark_theme_backend_matplotlib(MatplotlibBackend, is_dark, expected_bg): backend = MatplotlibBackend(use_dark_theme=is_dark) plotter = OrbitPlotter(backend=backend) assert plotter.backend.scene.get_facecolor() == expected_bg @@ -244,7 +242,7 @@ def test_set_frame_plots_same_colors(): def test_redraw_keeps_trajectories(): - # See https://github.com/poliastro/poliastro/issues/518 + # See https://github.com/hapsira/hapsira/issues/518 op = OrbitPlotter() trajectory = churi.sample() op.plot_body_orbit(Mars, J2000_TDB, label="Mars") @@ -262,18 +260,14 @@ def test_plot_ephem_different_plane_raises_error(): unused_coordinates = CartesianRepresentation( [(1, 0, 0)] * u.au, xyz_axis=1, - differentials=CartesianDifferential( - [(0, 1, 0)] * (u.au / u.day), xyz_axis=1 - ), + differentials=CartesianDifferential([(0, 1, 0)] * (u.au / u.day), xyz_axis=1), ) op = OrbitPlotter(plane=Planes.EARTH_ECLIPTIC) op.set_attractor(Sun) op.set_body_frame(Earth) with pytest.raises(ValueError) as excinfo: - op.plot_ephem( - Ephem(unused_epochs, unused_coordinates, Planes.EARTH_EQUATOR) - ) + op.plot_ephem(Ephem(unused_epochs, unused_coordinates, Planes.EARTH_EQUATOR)) assert ( "sample the ephemerides using a different plane or create a new plotter" @@ -348,9 +342,7 @@ def test_plot_ephem_epoch(): epoch = Time("2020-02-14 00:00:00") ephem = Ephem.from_horizons( "2020 CD3", - time_range( - Time("2020-02-13 12:00:00"), end=Time("2020-02-14 12:00:00") - ), + time_range(Time("2020-02-13 12:00:00"), end=Time("2020-02-14 12:00:00")), attractor=Earth, ) @@ -371,9 +363,7 @@ def test_plot_ephem_no_epoch(): epoch = Time("2020-02-14 00:00:00") ephem = Ephem.from_horizons( "2020 CD3", - time_range( - Time("2020-02-13 12:00:00"), end=Time("2020-02-14 12:00:00") - ), + time_range(Time("2020-02-13 12:00:00"), end=Time("2020-02-14 12:00:00")), attractor=Earth, ) @@ -391,7 +381,7 @@ def test_plot_ephem_no_epoch(): def test_body_frame_raises_warning_if_time_is_not_tdb_with_proper_time( recwarn, ): - from poliastro.warnings import TimeScaleWarning + from hapsira.warnings import TimeScaleWarning body = Jupiter epoch = Time("2017-09-29 07:31:26", scale="utc") @@ -405,9 +395,7 @@ def test_body_frame_raises_warning_if_time_is_not_tdb_with_proper_time( assert expected_epoch_string in str(w.message) -@pytest.mark.xfail( - sys.maxsize < 2**32, reason="not supported for 32 bit systems" -) +@pytest.mark.xfail(sys.maxsize < 2**32, reason="not supported for 32 bit systems") @pytest.mark.mpl_image_compare def test_plot_maneuver_using_matplotlib2D_backend(): # Data from Vallado, example 6.1 diff --git a/tests/tests_plotting/test_porkchop.py b/tests/tests_plotting/test_porkchop.py index 95fb915e5..f501e94ff 100644 --- a/tests/tests_plotting/test_porkchop.py +++ b/tests/tests_plotting/test_porkchop.py @@ -1,9 +1,9 @@ from matplotlib import pyplot as plt import pytest -from poliastro.bodies import Earth, Mars -from poliastro.plotting.porkchop import PorkchopPlotter -from poliastro.util import time_range +from hapsira.bodies import Earth, Mars +from hapsira.plotting.porkchop import PorkchopPlotter +from hapsira.util import time_range @pytest.mark.mpl_image_compare @@ -12,9 +12,7 @@ def test_porkchop_plotting(): launch_span = time_range("2005-04-30", end="2005-10-07") arrival_span = time_range("2005-11-16", end="2006-12-21") - porkchop_plot = PorkchopPlotter( - Earth, Mars, launch_span, arrival_span, ax=ax - ) + porkchop_plot = PorkchopPlotter(Earth, Mars, launch_span, arrival_span, ax=ax) dv_dpt, dv_arr, c3dpt, c3arr, tof = porkchop_plot.porkchop() return fig diff --git a/tests/tests_plotting/test_tisserand.py b/tests/tests_plotting/test_tisserand.py index 44ff0a5b7..db4d3fcfb 100644 --- a/tests/tests_plotting/test_tisserand.py +++ b/tests/tests_plotting/test_tisserand.py @@ -2,9 +2,9 @@ from matplotlib import pyplot as plt import pytest -from poliastro.bodies import Earth, Mars, Venus -from poliastro.plotting.tisserand import TisserandKind, TisserandPlotter -from poliastro.plotting.util import BODY_COLORS +from hapsira.bodies import Earth, Mars, Venus +from hapsira.plotting.tisserand import TisserandKind, TisserandPlotter +from hapsira.plotting.util import BODY_COLORS @pytest.mark.mpl_image_compare diff --git a/tests/tests_spacecraft/test_spacecraft.py b/tests/tests_spacecraft/test_spacecraft.py index 27ad06122..befc0e2c3 100644 --- a/tests/tests_spacecraft/test_spacecraft.py +++ b/tests/tests_spacecraft/test_spacecraft.py @@ -2,7 +2,7 @@ from astropy.tests.helper import assert_quantity_allclose import numpy as np -from poliastro.spacecraft import Spacecraft +from hapsira.spacecraft import Spacecraft def test_spacecraft_init(): diff --git a/tests/tests_threebody/test_cr3bp_char_quant.py b/tests/tests_threebody/test_cr3bp_char_quant.py index df0bd8e2b..322a04fea 100644 --- a/tests/tests_threebody/test_cr3bp_char_quant.py +++ b/tests/tests_threebody/test_cr3bp_char_quant.py @@ -2,12 +2,12 @@ from astropy.tests.helper import assert_quantity_allclose import pytest -from poliastro.bodies import Earth, Moon -from poliastro.core.threebody.cr3bp_quantities_calculations import ( +from hapsira.bodies import Earth, Moon +from hapsira.core.threebody.cr3bp_quantities_calculations import ( calculate_mu, calculate_tstar, ) -from poliastro.threebody.cr3bp_char_quant import SystemChars +from hapsira.threebody.cr3bp_char_quant import SystemChars @pytest.mark.parametrize( diff --git a/tests/tests_threebody/test_flybys.py b/tests/tests_threebody/test_flybys.py index fdd657774..d565a4a88 100644 --- a/tests/tests_threebody/test_flybys.py +++ b/tests/tests_threebody/test_flybys.py @@ -2,8 +2,8 @@ from astropy.tests.helper import assert_quantity_allclose import pytest -from poliastro.bodies import Venus -from poliastro.threebody.flybys import compute_flyby +from hapsira.bodies import Venus +from hapsira.threebody.flybys import compute_flyby @pytest.mark.parametrize( @@ -21,11 +21,7 @@ def test_flyby_curtis(theta, expected_V_2_v): expected_delta = 103.6 * u.deg - V_2_v, delta = compute_flyby( - V_1_v, V, Venus.k, Venus.R + periapsis_h, theta - ) + V_2_v, delta = compute_flyby(V_1_v, V, Venus.k, Venus.R + periapsis_h, theta) - assert_quantity_allclose( - V_2_v, expected_V_2_v, rtol=1e-3, atol=1e-15 * u.km / u.s - ) + assert_quantity_allclose(V_2_v, expected_V_2_v, rtol=1e-3, atol=1e-15 * u.km / u.s) assert_quantity_allclose(delta, expected_delta, rtol=1e-3) diff --git a/tests/tests_threebody/test_restricted.py b/tests/tests_threebody/test_restricted.py index 68749851c..fd85d74c3 100644 --- a/tests/tests_threebody/test_restricted.py +++ b/tests/tests_threebody/test_restricted.py @@ -3,8 +3,8 @@ from astropy import units as u from astropy.tests.helper import assert_quantity_allclose -from poliastro.bodies import Earth, Moon -from poliastro.threebody.restricted import lagrange_points_vec +from hapsira.bodies import Earth, Moon +from hapsira.threebody.restricted import lagrange_points_vec def test_lagrange_points_vec(): diff --git a/tests/tests_threebody/test_soi.py b/tests/tests_threebody/test_soi.py index f44b10b88..9879393c8 100644 --- a/tests/tests_threebody/test_soi.py +++ b/tests/tests_threebody/test_soi.py @@ -2,7 +2,7 @@ from astropy.tests.helper import assert_quantity_allclose import pytest -from poliastro.bodies import ( +from hapsira.bodies import ( Earth, Jupiter, Mars, @@ -12,7 +12,7 @@ Uranus, Venus, ) -from poliastro.threebody.soi import hill_radius, laplace_radius +from hapsira.threebody.soi import hill_radius, laplace_radius @pytest.mark.parametrize( @@ -38,9 +38,7 @@ def test_laplace_radius(body, expected_r_SOI): @pytest.mark.parametrize( "body, expected_r_SOI", [ - pytest.param( - Mercury, 2.21e8 * u.m, marks=pytest.mark.xfail - ), # Chebotarev + pytest.param(Mercury, 2.21e8 * u.m, marks=pytest.mark.xfail), # Chebotarev (Mercury, 1.75e8 * u.m), # Our result (Venus, 1.03e9 * u.m), (Earth, 1.49e9 * u.m), diff --git a/tests/tests_twobody/test_angles.py b/tests/tests_twobody/test_angles.py index 9157ca88d..45da70fc3 100644 --- a/tests/tests_twobody/test_angles.py +++ b/tests/tests_twobody/test_angles.py @@ -4,9 +4,9 @@ from numpy.testing import assert_allclose import pytest -from poliastro.bodies import Earth -from poliastro.core.elements import coe2mee, coe2rv, mee2coe, rv2coe -from poliastro.twobody.angles import ( +from hapsira.bodies import Earth +from hapsira.core.elements import coe2mee, coe2rv, mee2coe, rv2coe +from hapsira.twobody.angles import ( E_to_M, E_to_nu, F_to_M, diff --git a/tests/tests_twobody/test_elements.py b/tests/tests_twobody/test_elements.py index 68532a450..192e1530e 100644 --- a/tests/tests_twobody/test_elements.py +++ b/tests/tests_twobody/test_elements.py @@ -1,7 +1,7 @@ from astropy import units as u from astropy.tests.helper import assert_quantity_allclose -from poliastro.twobody.elements import circular_velocity +from hapsira.twobody.elements import circular_velocity def test_simple_circular_velocity(): diff --git a/tests/tests_twobody/test_events.py b/tests/tests_twobody/test_events.py index 19c9116b5..b24e7cb01 100644 --- a/tests/tests_twobody/test_events.py +++ b/tests/tests_twobody/test_events.py @@ -5,13 +5,13 @@ from numpy.linalg import norm import pytest -from poliastro.bodies import Earth -from poliastro.constants import H0_earth, rho0_earth -from poliastro.core.events import line_of_sight -from poliastro.core.perturbations import atmospheric_drag_exponential -from poliastro.core.propagation import func_twobody -from poliastro.twobody import Orbit -from poliastro.twobody.events import ( +from hapsira.bodies import Earth +from hapsira.constants import H0_earth, rho0_earth +from hapsira.core.events import line_of_sight +from hapsira.core.perturbations import atmospheric_drag_exponential +from hapsira.core.propagation import func_twobody +from hapsira.twobody import Orbit +from hapsira.twobody.events import ( AltitudeCrossEvent, LatitudeCrossEvent, LithobrakeEvent, @@ -20,7 +20,7 @@ PenumbraEvent, UmbraEvent, ) -from poliastro.twobody.propagation import CowellPropagator +from hapsira.twobody.propagation import CowellPropagator @pytest.mark.slow @@ -141,9 +141,7 @@ def test_umbra_event_not_triggering_is_ok(): def test_umbra_event_crossing(): - expected_umbra_t = Time( - "2020-01-01 00:04:51.328", scale="utc" - ) # From Orekit. + expected_umbra_t = Time("2020-01-01 00:04:51.328", scale="utc") # From Orekit. attractor = Earth tof = 2 * u.d epoch = Time("2020-01-01", scale="utc") @@ -170,9 +168,7 @@ def test_umbra_event_crossing(): def test_penumbra_event_crossing(): - expected_penumbra_t = Time( - "2020-01-01 00:04:26.060", scale="utc" - ) # From Orekit. + expected_penumbra_t = Time("2020-01-01 00:04:26.060", scale="utc") # From Orekit. attractor = Earth tof = 2 * u.d epoch = Time("2020-01-01", scale="utc") @@ -194,9 +190,7 @@ def test_penumbra_event_crossing(): [tof] * u.s, ) - assert expected_penumbra_t.isclose( - epoch + penumbra_event.last_t, atol=1 * u.s - ) + assert expected_penumbra_t.isclose(epoch + penumbra_event.last_t, atol=1 * u.s) def test_node_cross_event(): @@ -241,9 +235,7 @@ def test_orbit_propagation_continues_if_events_terminal_is_False(): thresh_lat = 60 * u.deg # Event occurs at ~1701.7 s. - latitude_cross_event = LatitudeCrossEvent( - orbit, thresh_lat, terminal=False - ) + latitude_cross_event = LatitudeCrossEvent(orbit, thresh_lat, terminal=False) events = [latitude_cross_event] # The last two tofs are after the detection of the event. @@ -277,9 +269,7 @@ def test_orbit_propagation_position_vector_does_not_repeat_if_events_terminal_is ) # Check position vector doesn't repeat if terminal set to True. - assert ( - len(rr) == 4 - ) # From the 5th tof in tofs, position vector starts repeating. + assert len(rr) == 4 # From the 5th tof in tofs, position vector starts repeating. @pytest.mark.parametrize( diff --git a/tests/tests_twobody/test_mean_elements.py b/tests/tests_twobody/test_mean_elements.py index 2fb91c59a..f4c25bc2f 100644 --- a/tests/tests_twobody/test_mean_elements.py +++ b/tests/tests_twobody/test_mean_elements.py @@ -1,7 +1,7 @@ import pytest -from poliastro.bodies import Sun -from poliastro.twobody.mean_elements import get_mean_elements +from hapsira.bodies import Sun +from hapsira.twobody.mean_elements import get_mean_elements def test_get_mean_elements_raises_error_if_invalid_body(): @@ -10,6 +10,6 @@ def test_get_mean_elements_raises_error_if_invalid_body(): with pytest.raises(ValueError) as excinfo: get_mean_elements(body) assert ( - f"No available mean elements for {body}. It must be an instance of `poliastro.bodies.SolarSystemPlanet`" + f"No available mean elements for {body}. It must be an instance of `hapsira.bodies.SolarSystemPlanet`" in excinfo.exconly() ) diff --git a/tests/tests_twobody/test_orbit.py b/tests/tests_twobody/test_orbit.py index 1bba79b5d..5eb5e63f7 100644 --- a/tests/tests_twobody/test_orbit.py +++ b/tests/tests_twobody/test_orbit.py @@ -17,7 +17,7 @@ from numpy.testing import assert_allclose, assert_array_equal import pytest -from poliastro.bodies import ( +from hapsira.bodies import ( Body, Earth, Jupiter, @@ -30,12 +30,12 @@ Uranus, Venus, ) -from poliastro.constants import J2000, J2000_TDB -from poliastro.ephem import Ephem -from poliastro.examples import iss -from poliastro.frames.ecliptic import HeliocentricEclipticJ2000 -from poliastro.frames.enums import Planes -from poliastro.frames.equatorial import ( +from hapsira.constants import J2000, J2000_TDB +from hapsira.ephem import Ephem +from hapsira.examples import iss +from hapsira.frames.ecliptic import HeliocentricEclipticJ2000 +from hapsira.frames.enums import Planes +from hapsira.frames.equatorial import ( GCRS, HCRS, JupiterICRS, @@ -46,12 +46,12 @@ UranusICRS, VenusICRS, ) -from poliastro.frames.util import get_frame -from poliastro.plotting.orbit.backends import DEFAULT_ORBIT_PLOTTER_BACKENDS -from poliastro.twobody.angles import E_to_M, nu_to_E -from poliastro.twobody.orbit import Orbit -from poliastro.twobody.sampling import TrueAnomalyBounds -from poliastro.warnings import PatchedConicsWarning +from hapsira.frames.util import get_frame +from hapsira.plotting.orbit.backends import DEFAULT_ORBIT_PLOTTER_BACKENDS +from hapsira.twobody.angles import E_to_M, nu_to_E +from hapsira.twobody.orbit import Orbit +from hapsira.twobody.sampling import TrueAnomalyBounds +from hapsira.warnings import PatchedConicsWarning @pytest.fixture() @@ -116,9 +116,7 @@ def test_orbit_from_classical_wraps_out_of_range_anomaly_and_warns(): _ = 0.5 * u.one # Unused dimensionless value _a = 1.0 * u.deg # Unused angle out_angle = np.pi * u.rad - with pytest.warns( - UserWarning, match="Wrapping true anomaly to -π <= nu < π" - ): + with pytest.warns(UserWarning, match="Wrapping true anomaly to -π <= nu < π"): Orbit.from_classical( attractor=Sun, a=_d, ecc=_, inc=_a, raan=_a, argp=_a, nu=out_angle ) @@ -161,8 +159,7 @@ def test_bad_inclination_raises_exception(): attractor=_body, a=_d, ecc=_, inc=bad_inc, raan=_a, argp=_a, nu=_a ) assert ( - "ValueError: Inclination must be between 0 and 180 degrees" - in excinfo.exconly() + "ValueError: Inclination must be between 0 and 180 degrees" in excinfo.exconly() ) @@ -182,9 +179,7 @@ def test_bad_hyperbolic_raises_exception(): argp=_a, nu=_a, ) - assert ( - "Hyperbolic orbits have negative semimajor axis" in excinfo.exconly() - ) + assert "Hyperbolic orbits have negative semimajor axis" in excinfo.exconly() def test_apply_maneuver_changes_epoch(): @@ -228,9 +223,7 @@ def test_circular_has_proper_semimajor_axis(): def test_circular_raises_error_if_negative_altitude(): with pytest.raises(ValueError) as excinfo: - Orbit.circular( - Earth, -1 * u.m, epoch=Time(0.0, format="jd", scale="tdb") - ) + Orbit.circular(Earth, -1 * u.m, epoch=Time(0.0, format="jd", scale="tdb")) assert "Altitude of an orbit cannot be negative." in excinfo.exconly() @@ -358,17 +351,13 @@ def test_frozen_orbit_no_args(attractor, alt, expected_inc, expected_argp): def test_frozen_orbit_with_non_critical_argp( attractor, alt, argp, expected_inc, ecc, expected_ecc ): - orbit = Orbit.frozen( - attractor, alt, argp=argp, ecc=ecc - ) # Non-critical value + orbit = Orbit.frozen(attractor, alt, argp=argp, ecc=ecc) # Non-critical value assert_allclose(orbit.inc, expected_inc) assert_allclose(orbit.ecc, expected_ecc) def test_frozen_orbit_non_critical_inclination(): - orbit = Orbit.frozen( - Earth, 1e3 * u.km, inc=0 * u.deg - ) # Non-critical value + orbit = Orbit.frozen(Earth, 1e3 * u.km, inc=0 * u.deg) # Non-critical value assert orbit.argp in [np.pi / 2, 3 * np.pi / 2] * u.rad @@ -384,8 +373,7 @@ def test_frozen_orbit_non_spherical_arguments(): Orbit.frozen(Jupiter, 1 * u.m) assert excinfo.type == AttributeError assert ( - "Attractor Jupiter has not spherical harmonics implemented" - in excinfo.exconly() + "Attractor Jupiter has not spherical harmonics implemented" in excinfo.exconly() ) @@ -431,7 +419,7 @@ def test_sample_numpoints(): def test_sample_big_orbits(): - # See https://github.com/poliastro/poliastro/issues/265 + # See https://github.com/hapsira/hapsira/issues/265 ss = Orbit.from_vectors( Sun, [-9_018_878.6, -94_116_055, 22_619_059] * u.km, @@ -528,9 +516,7 @@ def test_orbit_accepts_ecliptic_plane(): ss = Orbit.from_vectors(Sun, r, v, plane=Planes.EARTH_ECLIPTIC) - assert ss.get_frame().is_equivalent_frame( - HeliocentricEclipticJ2000(obstime=J2000) - ) + assert ss.get_frame().is_equivalent_frame(HeliocentricEclipticJ2000(obstime=J2000)) def test_orbit_represent_as_produces_correct_data(): @@ -549,8 +535,7 @@ def test_orbit_represent_as_produces_correct_data(): # https://github.com/astropy/astropy/issues/7793 assert (result.xyz == expected_result.xyz).all() assert ( - result.differentials["s"].d_xyz - == expected_result.differentials["s"].d_xyz + result.differentials["s"].d_xyz == expected_result.differentials["s"].d_xyz ).all() @@ -655,9 +640,7 @@ def test_synchronous_orbit_pericenter_smaller_than_atractor_radius( with pytest.raises(ValueError) as excinfo: Orbit.synchronous(attractor=attractor, ecc=ecc) assert excinfo.type == ValueError - assert ( - "The orbit for the given parameters doesn't exist" in excinfo.exconly() - ) + assert "The orbit for the given parameters doesn't exist" in excinfo.exconly() @pytest.mark.parametrize( @@ -703,12 +686,8 @@ def test_synchronous_orbit_supersynchronous( ), ], ) -def test_synchronous_orbit_semisynchronous( - attractor, ecc, expected_a, expected_period -): - ss = Orbit.synchronous( - attractor=attractor, ecc=ecc, period_mul=0.5 * u.one - ) +def test_synchronous_orbit_semisynchronous(attractor, ecc, expected_a, expected_period): + ss = Orbit.synchronous(attractor=attractor, ecc=ecc, period_mul=0.5 * u.one) assert_quantity_allclose(ss.ecc, ecc, rtol=1.0e-3) assert_quantity_allclose(ss.a, expected_a, rtol=1.0e-3) assert_quantity_allclose(ss.period, expected_period, rtol=1.0e-3) @@ -765,9 +744,7 @@ def test_heliosynchronous_orbit_raises_floating_point_error_if_invalid_input(): with pytest.raises(ValueError) as excinfo: Orbit.heliosynchronous(Earth, a=a, inc=inc) - assert ( - "No SSO orbit with given parameters can be found." in excinfo.exconly() - ) + assert "No SSO orbit with given parameters can be found." in excinfo.exconly() def test_perigee_and_apogee(): @@ -818,9 +795,7 @@ def test_expected_angular_momentum(): ) orbit_h_mag = orbit.h_mag - assert_quantity_allclose( - orbit_h_mag.value, expected_ang_mag.value, rtol=1e-2 - ) + assert_quantity_allclose(orbit_h_mag.value, expected_ang_mag.value, rtol=1e-2) def test_expected_last_perifocal_passage(): @@ -958,13 +933,9 @@ def test_orbit_creation_using_skycoord(attractor): attractor, Planes.EARTH_EQUATOR, obstime=coord.obstime ) - coord_transformed_to_irf = coord.transform_to( - inertial_frame_at_body_centre - ) + coord_transformed_to_irf = coord.transform_to(inertial_frame_at_body_centre) pos_transformed_to_irf = coord_transformed_to_irf.cartesian.xyz - vel_transformed_to_irf = coord_transformed_to_irf.cartesian.differentials[ - "s" - ].d_xyz + vel_transformed_to_irf = coord_transformed_to_irf.cartesian.differentials["s"].d_xyz assert (o.r == pos_transformed_to_irf).all() assert (o.v == vel_transformed_to_irf).all() @@ -991,19 +962,13 @@ def test_orbit_creation_using_frame_obj(attractor, frame, obstime): attractor, Planes.EARTH_EQUATOR, obstime=coord.obstime ) - coord_transformed_to_irf = coord.transform_to( - inertial_frame_at_body_centre - ) + coord_transformed_to_irf = coord.transform_to(inertial_frame_at_body_centre) pos_transformed_to_irf = coord_transformed_to_irf.cartesian.xyz - vel_transformed_to_irf = coord_transformed_to_irf.cartesian.differentials[ - "s" - ].d_xyz + vel_transformed_to_irf = coord_transformed_to_irf.cartesian.differentials["s"].d_xyz assert_quantity_allclose(o.r, pos_transformed_to_irf, atol=1e-5 * u.km) - assert_quantity_allclose( - o.v, vel_transformed_to_irf, atol=1e-5 * u.km / u.s - ) + assert_quantity_allclose(o.v, vel_transformed_to_irf, atol=1e-5 * u.km / u.s) @pytest.mark.parametrize("obstime", [J2000, J2000_TDB]) @@ -1014,9 +979,7 @@ def test_from_coord_fails_for_multiple_positions(obstime): cartrep = CartesianRepresentation( [[1, 0, 0], [0.9, 0.1, 0]] * u.km, differentials=cartdiff, xyz_axis=1 ) - coords = GCRS( - cartrep, representation_type=CartesianRepresentation, obstime=obstime - ) + coords = GCRS(cartrep, representation_type=CartesianRepresentation, obstime=obstime) with pytest.raises(ValueError) as excinfo: Orbit.from_coords(Earth, coords) @@ -1030,12 +993,8 @@ def test_from_coord_if_coord_is_not_of_shape_zero(): pos = [0, 1, 0] vel = [1, 0, 0] cartdiff = CartesianDifferential([vel] * u.km / u.s, xyz_axis=1) - cartrep = CartesianRepresentation( - [pos] * u.km, differentials=cartdiff, xyz_axis=1 - ) - coords = GCRS( - cartrep, representation_type=CartesianRepresentation, obstime=J2000 - ) + cartrep = CartesianRepresentation([pos] * u.km, differentials=cartdiff, xyz_axis=1) + coords = GCRS(cartrep, representation_type=CartesianRepresentation, obstime=J2000) ss = Orbit.from_coords(Earth, coords) @@ -1044,7 +1003,7 @@ def test_from_coord_if_coord_is_not_of_shape_zero(): def test_propagate_to_anomaly_gives_expected_result(): - # From "Going to Jupiter with Python using Jupyter and poliastro.ipynb" + # From "Going to Jupiter with Python using Jupyter and hapsira.ipynb" ic1 = Orbit.from_vectors( Sun, [1.02465527e08, -1.02313505e08, -4.43533465e07] * u.km, @@ -1059,12 +1018,11 @@ def test_propagate_to_anomaly_gives_expected_result(): def test_sample_with_out_of_range_anomaly_works(): - # From "Going to Jupiter with Python using Jupyter and poliastro.ipynb" + # From "Going to Jupiter with Python using Jupyter and hapsira.ipynb" ic1 = Orbit.from_vectors( Sun, [1.02465527e08, -1.02313505e08, -4.43533465e07] << u.km, - [2198705.82621226, 1897186.74383856, 822370.88977487] - << (u.km / u.day), + [2198705.82621226, 1897186.74383856, 822370.88977487] << (u.km / u.day), Time("2011-08-05 16:26:06.183", scale="tdb"), ) coordinates = ic1.to_ephem( @@ -1124,10 +1082,7 @@ def test_from_vectors_wrong_dimensions_fails(): with pytest.raises(ValueError) as excinfo: Orbit.from_vectors(Earth, bad_r, bad_v) - assert ( - "ValueError: Vectors must have dimension 1, got 2 and 3" - in excinfo.exconly() - ) + assert "ValueError: Vectors must have dimension 1, got 2 and 3" in excinfo.exconly() def test_from_classical_wrong_dimensions_fails(): @@ -1139,9 +1094,7 @@ def test_from_classical_wrong_dimensions_fails(): Orbit.from_classical( attractor=Earth, a=bad_a, ecc=_, inc=_a, raan=_a, argp=_a, nu=_a ) - assert ( - "ValueError: Elements must be scalar, got [1.] AU" in excinfo.exconly() - ) + assert "ValueError: Elements must be scalar, got [1.] AU" in excinfo.exconly() def test_orbit_change_attractor_returns_self(): @@ -1158,9 +1111,7 @@ def test_orbit_change_attractor_out_of_SOI(): with pytest.raises(ValueError) as excinfo: ss.change_attractor(Earth) - assert ( - "ValueError: Orbit is out of new attractor's SOI" in excinfo.exconly() - ) + assert "ValueError: Orbit is out of new attractor's SOI" in excinfo.exconly() def test_orbit_change_attractor_force(): @@ -1180,9 +1131,7 @@ def test_orbit_change_attractor_force(): def test_orbit_change_attractor_unrelated_body(): with pytest.raises(ValueError) as excinfo: iss.change_attractor(Mars) - assert ( - "ValueError: Cannot change to unrelated attractor" in excinfo.exconly() - ) + assert "ValueError: Cannot change to unrelated attractor" in excinfo.exconly() def test_orbit_change_attractor_closed(): @@ -1233,9 +1182,7 @@ def with_units(draw, elements, unit): return value * unit -angles = partial( - st.floats, min_value=-np.pi, max_value=np.pi, exclude_max=True -) +angles = partial(st.floats, min_value=-np.pi, max_value=np.pi, exclude_max=True) angles_q = partial(with_units, elements=angles(), unit=u.rad) @@ -1252,16 +1199,14 @@ def test_time_to_anomaly(expected_nu): # In some corner cases the resulting anomaly goes out of range, # and rather than trying to fix it right now # we will wait until we remove the round tripping, - # see https://github.com/poliastro/poliastro/issues/921 + # see https://github.com/hapsira/hapsira/issues/921 # FIXME: Add test that verifies that `orbit.nu` is always within range - assert_quantity_allclose( - iss_propagated.nu, expected_nu, atol=1e-12 * u.rad - ) + assert_quantity_allclose(iss_propagated.nu, expected_nu, atol=1e-12 * u.rad) @pytest.mark.xfail def test_can_set_iss_attractor_to_earth(): - # See https://github.com/poliastro/poliastro/issues/798 + # See https://github.com/hapsira/hapsira/issues/798 epoch = Time("2019-11-10 12:00:00") ephem = Ephem.from_horizons( "International Space Station", @@ -1290,7 +1235,7 @@ def test_issue_916(mock_query): def test_near_parabolic_M_does_not_hang(near_parabolic): - # See https://github.com/poliastro/poliastro/issues/907 + # See https://github.com/hapsira/hapsira/issues/907 expected_nu = -168.65 * u.deg orb = near_parabolic.propagate_to_anomaly(expected_nu) @@ -1308,7 +1253,7 @@ def test_propagation_near_parabolic_orbits_zero_seconds_gives_same_anomaly( def test_propagation_near_parabolic_orbits_does_not_hang(near_parabolic): - # See https://github.com/poliastro/poliastro/issues/475 + # See https://github.com/hapsira/hapsira/issues/475 orb_final = near_parabolic.propagate(near_parabolic.period) # Smoke test diff --git a/tests/tests_twobody/test_perturbations.py b/tests/tests_twobody/test_perturbations.py index dc0da66ba..630a41b7e 100644 --- a/tests/tests_twobody/test_perturbations.py +++ b/tests/tests_twobody/test_perturbations.py @@ -8,10 +8,10 @@ from numpy.linalg import norm import pytest -from poliastro.bodies import Earth, Moon, Sun -from poliastro.constants import H0_earth, Wdivc_sun, rho0_earth -from poliastro.core.elements import rv2coe -from poliastro.core.perturbations import ( +from hapsira.bodies import Earth, Moon, Sun +from hapsira.constants import H0_earth, Wdivc_sun, rho0_earth +from hapsira.core.elements import rv2coe +from hapsira.core.perturbations import ( J2_perturbation, J3_perturbation, atmospheric_drag, @@ -19,13 +19,13 @@ radiation_pressure, third_body, ) -from poliastro.core.propagation import func_twobody -from poliastro.earth.atmosphere import COESA76 -from poliastro.ephem import build_ephem_interpolant -from poliastro.twobody import Orbit -from poliastro.twobody.events import LithobrakeEvent -from poliastro.twobody.propagation import CowellPropagator -from poliastro.util import time_range +from hapsira.core.propagation import func_twobody +from hapsira.earth.atmosphere import COESA76 +from hapsira.ephem import build_ephem_interpolant +from hapsira.twobody import Orbit +from hapsira.twobody.events import LithobrakeEvent +from hapsira.twobody.propagation import CowellPropagator +from hapsira.util import time_range @pytest.mark.slow @@ -52,9 +52,7 @@ def f(t0, u_, k): k = Earth.k.to(u.km**3 / u.s**2).value _, _, _, raan0, argp0, _ = rv2coe(k, r0, v0) - _, _, _, raan, argp, _ = rv2coe( - k, rr[0].to(u.km).value, vv[0].to(u.km / u.s).value - ) + _, _, _, raan, argp, _ = rv2coe(k, rr[0].to(u.km).value, vv[0].to(u.km / u.s).value) raan_variation_rate = (raan - raan0) / tofs[0].to(u.s).value # type: ignore argp_variation_rate = (argp - argp0) / tofs[0].to(u.s).value # type: ignore @@ -62,12 +60,8 @@ def f(t0, u_, k): raan_variation_rate = (raan_variation_rate * u.rad / u.s).to(u.deg / u.h) argp_variation_rate = (argp_variation_rate * u.rad / u.s).to(u.deg / u.h) - assert_quantity_allclose( - raan_variation_rate, -0.172 * u.deg / u.h, rtol=1e-2 - ) - assert_quantity_allclose( - argp_variation_rate, 0.282 * u.deg / u.h, rtol=1e-2 - ) + assert_quantity_allclose(raan_variation_rate, -0.172 * u.deg / u.h, rtol=1e-2) + assert_quantity_allclose(argp_variation_rate, 0.282 * u.deg / u.h, rtol=1e-2) @pytest.mark.slow @@ -142,9 +136,7 @@ def f_combined(t0, u_, k): du_kep = func_twobody(t0, u_, k) ax, ay, az = J2_perturbation( t0, u_, k, J2=Earth.J2.value, R=Earth.R.to_value(u.km) - ) + J3_perturbation( - t0, u_, k, J3=Earth.J3.value, R=Earth.R.to_value(u.km) - ) + ) + J3_perturbation(t0, u_, k, J3=Earth.J3.value, R=Earth.R.to_value(u.km)) du_ad = np.array([0, 0, 0, ax, ay, az]) return du_kep + du_ad @@ -196,12 +188,8 @@ def f_combined(t0, u_, k): ) dinc_max = np.max(np.abs(inc_values_J2 - inc_values_J3)) - assert_quantity_allclose( - dinc_max, test_params["dinc_max"], rtol=1e-1, atol=1e-7 - ) - assert_quantity_allclose( - decc_max, test_params["decc_max"], rtol=1e-1, atol=1e-7 - ) + assert_quantity_allclose(dinc_max, test_params["dinc_max"], rtol=1e-1, atol=1e-7) + assert_quantity_allclose(decc_max, test_params["decc_max"], rtol=1e-1, atol=1e-7) try: assert_quantity_allclose(da_max * u.km, test_params["da_max"]) except AssertionError: @@ -233,9 +221,7 @@ def test_atmospheric_drag_exponential(): H0 = H0_earth.to(u.km).value # km tof = 100000 # s - dr_expected = ( - -B * rho0 * np.exp(-(norm(r0) - R) / H0) * np.sqrt(k * norm(r0)) * tof - ) + dr_expected = -B * rho0 * np.exp(-(norm(r0) - R) / H0) * np.sqrt(k * norm(r0)) * tof # Assuming the atmospheric decay during tof is small, # dr_expected = F_r * tof (Newton's integration formula), where # F_r = -B rho(r) |r|^2 sqrt(k / |r|^3) = -B rho(r) sqrt(k |r|) @@ -296,9 +282,7 @@ def f(t0, u_, k): tofs, ) - assert_quantity_allclose( - norm(rr[0].to(u.km).value), R, atol=1 - ) # Below 1km + assert_quantity_allclose(norm(rr[0].to(u.km).value), R, atol=1) # Below 1km assert_quantity_allclose(lithobrake_event.last_t, t_decay, rtol=1e-2) @@ -361,9 +345,7 @@ def f(t0, u_, k): tofs, ) - assert_quantity_allclose( - norm(rr[0].to(u.km).value), R, atol=1 - ) # Below 1km + assert_quantity_allclose(norm(rr[0].to(u.km).value), R, atol=1) # Below 1km assert_quantity_allclose(lithobrake_event.last_t, t_decay, rtol=1e-2) @@ -648,9 +630,7 @@ def test_solar_pressure(t_days, deltas_expected, sun_r): tof = 600 * u.day epoch = Time(j_date, format="jd", scale="tdb") - with pytest.warns( - UserWarning, match="Wrapping true anomaly to -π <= nu < π" - ): + with pytest.warns(UserWarning, match="Wrapping true anomaly to -π <= nu < π"): initial = Orbit.from_classical( attractor=Earth, a=10085.44 * u.km, @@ -692,9 +672,7 @@ def f(t0, u_, k): for ri, vi in zip(rr.to(u.km).value, vv.to(u.km / u.s).value): orbit_params = rv2coe(Earth.k.to(u.km**3 / u.s**2).value, ri, vi) delta_eccs.append(orbit_params[1] - initial.ecc.value) - delta_incs.append( - (orbit_params[2] * u.rad).to(u.deg).value - initial.inc.value - ) + delta_incs.append((orbit_params[2] * u.rad).to(u.deg).value - initial.inc.value) delta_raans.append( (orbit_params[3] * u.rad).to(u.deg).value - initial.raan.value ) diff --git a/tests/tests_twobody/test_propagation.py b/tests/tests_twobody/test_propagation.py index 1e2827231..0d20983bf 100644 --- a/tests/tests_twobody/test_propagation.py +++ b/tests/tests_twobody/test_propagation.py @@ -7,14 +7,14 @@ import pytest from pytest import approx -from poliastro.bodies import Earth, Moon, Sun -from poliastro.constants import J2000 -from poliastro.core.elements import rv2coe -from poliastro.core.propagation import func_twobody -from poliastro.examples import iss -from poliastro.frames import Planes -from poliastro.twobody import Orbit -from poliastro.twobody.propagation import ( +from hapsira.bodies import Earth, Moon, Sun +from hapsira.constants import J2000 +from hapsira.core.elements import rv2coe +from hapsira.core.propagation import func_twobody +from hapsira.examples import iss +from hapsira.frames import Planes +from hapsira.twobody import Orbit +from hapsira.twobody.propagation import ( ALL_PROPAGATORS, ELLIPTIC_PROPAGATORS, HYPERBOLIC_PROPAGATORS, @@ -27,7 +27,7 @@ RecseriesPropagator, ValladoPropagator, ) -from poliastro.util import norm +from hapsira.util import norm @pytest.fixture(scope="module") @@ -150,9 +150,7 @@ def test_propagating_to_certain_nu_is_correct(): for nu in np.random.uniform(low=-np.pi, high=np.pi, size=10): elliptic = elliptic.propagate_to_anomaly(nu * u.rad) r, _ = elliptic.rv() - assert_quantity_allclose( - norm(r), a * (1.0 - ecc**2) / (1 + ecc * np.cos(nu)) - ) + assert_quantity_allclose(norm(r), a * (1.0 - ecc**2) / (1 + ecc * np.cos(nu))) def test_propagate_to_anomaly_in_the_past_fails_for_open_orbits(): @@ -160,9 +158,7 @@ def test_propagate_to_anomaly_in_the_past_fails_for_open_orbits(): v0 = [0, 15, 0] * u.km / u.s orb = Orbit.from_vectors(Earth, r0, v0) - with pytest.raises( - ValueError, match="True anomaly -0.02 rad not reachable" - ): + with pytest.raises(ValueError, match="True anomaly -0.02 rad not reachable"): orb.propagate_to_anomaly(orb.nu - 1 * u.deg) @@ -266,9 +262,7 @@ def test_apply_zero_maneuver_returns_equal_state(): dv = [0, 0, 0] * u.km / u.s orbit_new = ss.apply_maneuver([(dt, dv)]) assert_allclose(orbit_new.r.to(u.km).value, ss.r.to(u.km).value) - assert_allclose( - orbit_new.v.to(u.km / u.s).value, ss.v.to(u.km / u.s).value - ) + assert_allclose(orbit_new.v.to(u.km / u.s).value, ss.v.to(u.km / u.s).value) def test_cowell_propagation_with_zero_acceleration_equals_kepler(): @@ -351,7 +345,7 @@ def test_propagate_to_date_has_proper_epoch(): ) def test_propagate_long_times_keeps_geometry(method): # TODO: Extend to other propagators? - # See https://github.com/poliastro/poliastro/issues/265 + # See https://github.com/hapsira/hapsira/issues/265 time_of_flight = 100 * u.year res = iss.propagate(time_of_flight, method=method) @@ -417,17 +411,13 @@ def with_units(draw, elements, unit): unit=u.year, ) ) -@pytest.mark.parametrize( - "method", [FarnocchiaPropagator(), ValladoPropagator()] -) +@pytest.mark.parametrize("method", [FarnocchiaPropagator(), ValladoPropagator()]) def test_long_propagation_preserves_orbit_elements(tof, method, halley): expected_slow_classical = halley.classical()[:-1] slow_classical = halley.propagate(tof, method=method).classical()[:-1] - for element, expected_element in zip( - slow_classical, expected_slow_classical - ): + for element, expected_element in zip(slow_classical, expected_slow_classical): assert_quantity_allclose(element, expected_element) @@ -444,7 +434,7 @@ def test_propagation_sets_proper_epoch(): def test_sample_around_moon_works(): - # See https://github.com/poliastro/poliastro/issues/649 + # See https://github.com/hapsira/hapsira/issues/649 orbit = Orbit.circular(Moon, 100 << u.km) coords = orbit.sample(10) @@ -454,7 +444,7 @@ def test_sample_around_moon_works(): def test_propagate_around_moon_works(): - # See https://github.com/poliastro/poliastro/issues/649 + # See https://github.com/hapsira/hapsira/issues/649 orbit = Orbit.circular(Moon, 100 << u.km) new_orbit = orbit.propagate(1 << u.h) diff --git a/tests/tests_twobody/test_sampling.py b/tests/tests_twobody/test_sampling.py index 5930cf5df..042ef2cd2 100644 --- a/tests/tests_twobody/test_sampling.py +++ b/tests/tests_twobody/test_sampling.py @@ -6,8 +6,8 @@ import numpy as np import pytest -from poliastro.examples import iss -from poliastro.twobody.sampling import TrueAnomalyBounds, sample_closed +from hapsira.examples import iss +from hapsira.twobody.sampling import TrueAnomalyBounds, sample_closed angles = partial(st.floats, min_value=-2 * np.pi, max_value=2 * np.pi) eccentricities = partial(st.floats, min_value=0, max_value=1, exclude_max=True) @@ -41,9 +41,7 @@ def test_sample_closed_is_always_between_minus_pi_and_pi(min_nu, ecc, max_nu): @settings(deadline=None) @given( min_nu=with_units( - elements=st.floats( - min_value=-np.pi, max_value=np.pi, exclude_max=True - ), + elements=st.floats(min_value=-np.pi, max_value=np.pi, exclude_max=True), unit=u.rad, ), ecc=eccentricities_q(), diff --git a/tests/tests_twobody/test_states.py b/tests/tests_twobody/test_states.py index 8f2db209a..aa70d385c 100644 --- a/tests/tests_twobody/test_states.py +++ b/tests/tests_twobody/test_states.py @@ -3,8 +3,8 @@ import numpy as np import pytest -from poliastro.bodies import Earth, Sun -from poliastro.twobody.states import ClassicalState, RVState +from hapsira.bodies import Earth, Sun +from hapsira.twobody.states import ClassicalState, RVState def test_state_has_attractor_given_in_constructor(): @@ -23,9 +23,7 @@ def test_classical_state_has_elements_given_in_constructor(): raan = 49.562 * u.deg argp = 286.537 * u.deg nu = 23.33 * u.deg - ss = ClassicalState( - Sun, (a * (1 - ecc**2), ecc, inc, raan, argp, nu), None - ) + ss = ClassicalState(Sun, (a * (1 - ecc**2), ecc, inc, raan, argp, nu), None) assert ss.p == a * (1 - ecc**2) assert ss.ecc == ecc assert ss.inc == inc @@ -72,9 +70,7 @@ def test_coe_to_mee_raises_singularity_error_orbit_equatorial_and_retrograde(): argp = 286.537 * u.deg nu = 23.33 * u.deg - ss = ClassicalState( - Sun, (a * (1 - ecc**2), ecc, inc, raan, argp, nu), None - ) + ss = ClassicalState(Sun, (a * (1 - ecc**2), ecc, inc, raan, argp, nu), None) with pytest.raises(ValueError) as excinfo: ss.to_equinoctial() assert ( diff --git a/tests/tests_twobody/test_thrust.py b/tests/tests_twobody/test_thrust.py index 21445381d..38a1b65f2 100644 --- a/tests/tests_twobody/test_thrust.py +++ b/tests/tests_twobody/test_thrust.py @@ -3,16 +3,16 @@ from numpy.testing import assert_allclose import pytest -from poliastro.bodies import Earth -from poliastro.core.propagation import func_twobody -from poliastro.core.thrust import ( +from hapsira.bodies import Earth +from hapsira.core.propagation import func_twobody +from hapsira.core.thrust import ( change_a_inc as change_a_inc_fast, change_argp as change_argp_fast, ) -from poliastro.core.thrust.change_ecc_inc import beta as beta_change_ecc_inc -from poliastro.twobody import Orbit -from poliastro.twobody.propagation import CowellPropagator -from poliastro.twobody.thrust import ( +from hapsira.core.thrust.change_ecc_inc import beta as beta_change_ecc_inc +from hapsira.twobody import Orbit +from hapsira.twobody.propagation import CowellPropagator +from hapsira.twobody.thrust import ( change_a_inc, change_argp, change_ecc_inc, @@ -78,9 +78,7 @@ def f_leo_geo(t0, u_, k): du_ad = np.array([0, 0, 0, ax, ay, az]) return du_kep + du_ad - sf = s0.propagate( - t_f * u.s, method=CowellPropagator(rtol=1e-6, f=f_leo_geo) - ) + sf = s0.propagate(t_f * u.s, method=CowellPropagator(rtol=1e-6, f=f_leo_geo)) assert_allclose(sf.a.to(u.km).value, a_f, rtol=1e-3) assert_allclose(sf.ecc.value, 0.0, atol=1e-2) @@ -139,9 +137,7 @@ def f_ss0_disposal(t0, u_, k): du_ad = np.array([0, 0, 0, ax, ay, az]) return du_kep + du_ad - sf = s0.propagate( - t_f * u.s, method=CowellPropagator(rtol=1e-8, f=f_ss0_disposal) - ) + sf = s0.propagate(t_f * u.s, method=CowellPropagator(rtol=1e-8, f=f_ss0_disposal)) assert_allclose(sf.ecc.value, ecc_f, rtol=1e-4, atol=1e-4) @@ -156,9 +152,7 @@ def f_ss0_disposal(t0, u_, k): [0.8, 10.0, 16.304, 1.9799], ], ) -def test_geo_cases_beta_dnd_delta_v( - ecc_0, inc_f, expected_beta, expected_delta_V -): +def test_geo_cases_beta_dnd_delta_v(ecc_0, inc_f, expected_beta, expected_delta_V): a = 42164 # km ecc_f = 0.0 inc_0 = 0.0 # rad, baseline @@ -181,9 +175,7 @@ def test_geo_cases_beta_dnd_delta_v( beta = beta_change_ecc_inc( ecc_0=ecc_0, ecc_f=ecc_f, inc_0=inc_0, inc_f=inc_f, argp=argp ) - _, delta_V, _ = change_ecc_inc( - orb_0=s0, ecc_f=ecc_f, inc_f=inc_f * u.rad, f=f - ) + _, delta_V, _ = change_ecc_inc(orb_0=s0, ecc_f=ecc_f, inc_f=inc_f * u.rad, f=f) assert_allclose(delta_V.to_value(u.km / u.s), expected_delta_V, rtol=1e-2) assert_allclose(beta, expected_beta, rtol=1e-2) diff --git a/tox.ini b/tox.ini index bf516a601..c50d7affe 100644 --- a/tox.ini +++ b/tox.ini @@ -33,7 +33,7 @@ setenv = online: PYTEST_EXTRA_ARGS = --remote-data=any slow: PYTEST_EXTRA_ARGS = images: PYTEST_EXTRA_ARGS = --mpl - coverage: PYTEST_EXTRA_ARGS = --cov=poliastro --cov-report=term --cov-report=xml:.cov/xml --cov-report=html:.cov/html + coverage: PYTEST_EXTRA_ARGS = --cov=hapsira --cov-report=term --cov-report=xml:.cov/xml --cov-report=html:.cov/html passenv = * extras = @@ -48,7 +48,7 @@ commands = pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} {posargs:-vv} [testenv:style] -description = checks poliastro code style guidelines +description = checks hapsira code style guidelines deps = build pre-commit @@ -61,7 +61,7 @@ commands = [testenv:docs] description = invoke sphinx-build to build the HTML docs setenv = - READTHEDOCS_PROJECT = poliastro + READTHEDOCS_PROJECT = hapsira READTHEDOCS_VERSION = latest extras = doc