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
merged 5 commits into from
Nov 12, 2021

Conversation

astrojuanlu
Copy link
Member

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.

@astrojuanlu
Copy link
Member Author

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

@codecov
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/__init__.py 95.23% <50.00%> (-4.77%) ⬇️
src/poliastro/core/perturbations.py 100.00% <100.00%> (ø)
src/poliastro/spacecraft/__init__.py 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.

@astrojuanlu
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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid units in poliastro.core
1 participant