Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Remove use of units in poliastro.core #1375

merged 5 commits into from
Nov 12, 2021


Copy link

Fix #1256, and enforce it forever using import-linter.

I had to make several other changes along the way:

  • Refactor atmospheric_drag to take the density as a float rather than a callable. This introduces a minor redundancy because the user needs to compute the height outside, but the advantage is that the perturbation can be jitted, and no units are needed.
  • Disable the atmosphere perturbation in EarthSatellite. The design of the class is not very flexible and does not support the new atmospheric_drag function easily. Rather than trying to find a way out, since these classes are experimental, I temporarily introduced a NotImplementedError until we find a better solution.
  • Add a lint-imports command to our test environment in tox, since import-linter requires the package to be installed.

Copy link
Member Author

Also, notice I ended up preventing the whole astropy in poliastro.core, see seddonym/import-linter#111

Copy link

codecov bot commented Nov 1, 2021

Codecov Report

Merging #1375 (020c54a) into main (e022f9d) will decrease coverage by 0.12%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1375      +/-   ##
- Coverage   92.08%   91.96%   -0.13%     
  Files          82       82              
  Lines        4346     4342       -4     
  Branches      363      362       -1     
- Hits         4002     3993       -9     
- Misses        255      259       +4     
- Partials       89       90       +1     
Impacted Files Coverage Δ
src/poliastro/earth/ 95.23% <50.00%> (-4.77%) ⬇️
src/poliastro/core/ 100.00% <100.00%> (ø)
src/poliastro/spacecraft/ 85.71% <0.00%> (-14.29%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e022f9d...020c54a. Read the comment docs.

Copy link
Member Author

Found a workaround for import-linter, merging!

@astrojuanlu astrojuanlu merged commit ef6b51e into poliastro:main Nov 12, 2021
@astrojuanlu astrojuanlu deleted the core-imports branch November 12, 2021 15:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet

Successfully merging this pull request may close these issues.

Avoid units in poliastro.core
1 participant