Skip to content

Commit

Permalink
Merge branch 'main' into features
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme Deuchnord committed Jan 9, 2022
2 parents 7171947 + 6f2a9a5 commit 9aa5e7d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# [Version 1.0.2](https://github.com/Kosmorro/lib/compare/v1.0.1...v1.0.2) (2022-01-09)


### Bug Fixes

* fix Python support for NumPy ([#40](https://github.com/Kosmorro/lib/issues/40)) ([a99ef9d](https://github.com/Kosmorro/lib/commit/a99ef9d6a6b174f653abe2887d8211c809b3a732))
* make the opposition detection more reliable ([#39](https://github.com/Kosmorro/lib/issues/39)) ([761ec4e](https://github.com/Kosmorro/lib/commit/761ec4ef21b95473829672d69320330f52d1890b))
* remove NumPy direct dependency ([#41](https://github.com/Kosmorro/lib/issues/41)) ([f0b4267](https://github.com/Kosmorro/lib/commit/f0b42679853d2d8310005cdde2afd1c7674ccaf9))

Note that Numpy is still a dependency of Skyfield and its dependencies, so NumPy is actually still needed to run Kosmorrolib. But now, it is not used anymore here.

# [Version 1.0.1](https://github.com/Kosmorro/lib/compare/v1.0.0...v1.0.1) (2021-11-01)


Expand Down
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ Before writing the code, first create a fork of the repository and clone it. You

Then create a new branch and start coding. Finally, commit and push, then open a PR on this project. If your project is not complete, feel free to open it as Draft (if you forgot to activate the Draft status, just edit the first comment to say it), then mark it as ready for review when you're done.

### Choosing the right target branch
### Choosing the right branch

Whatever you are doing, always base your working branch on `master`.
When you create your PR, please consider selecting the right target branch:
When you create your PR, please select the right base and target branch depending on what you are doing:

- If you are fixing a bug or optimizing something, then target the `master` branch.
- If you are doing anything else, then target the `feature` branch.
- If you are fixing a bug or optimizing something, target the `main` branch.
- If you are adding a new feature, target the `features` branch.

This allows to make easier to publish patch releases, which have a higher priority than the minor releases.

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black:
poetry run black kosmorrolib setup.py
poetry run black kosmorrolib

.PHONY: tests
tests: doctests
Expand Down
8 changes: 5 additions & 3 deletions kosmorrolib/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
from skyfield.searchlib import find_discrete, find_maxima, find_minima
from skyfield.units import Angle
from skyfield import almanac, eclipselib
from numpy import pi
from math import pi

from kosmorrolib.model import (
Object,
Event,
Object,
Star,
Expand Down Expand Up @@ -153,6 +152,9 @@ def _search_oppositions(start_time: Time, end_time: Time, timezone: int) -> [Eve
>>> _search_oppositions(get_timescale().utc(2021, 3, 20), get_timescale().utc(2021, 3, 21), 0)
[]
>>> _search_oppositions(get_timescale().utc(2022, 12, 24), get_timescale().utc(2022, 12, 25), 0)
[]
"""
earth = get_skf_objects()["earth"]
sun = get_skf_objects()["sun"]
Expand Down Expand Up @@ -187,7 +189,7 @@ def get_angle(time: Time):

times, _ = find_discrete(start_time, end_time, is_oppositing)
for time in times:
if get_angle(time) < 0:
if int(get_angle(time)) != 180:
# If the angle is negative, then it is actually a false positive.
# Just ignoring it.
continue
Expand Down
5 changes: 2 additions & 3 deletions kosmorrolib/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
from abc import ABC, abstractmethod
from typing import Union
from datetime import datetime, timezone

import numpy
from math import asin

from skyfield.api import Topos, Time, Angle
from skyfield.vectorlib import VectorSum as SkfPlanet
Expand Down Expand Up @@ -180,7 +179,7 @@ def get_apparent_radius(self, for_date: Union[Time, datetime]) -> Angle:
.radec()
)

return Angle(radians=numpy.arcsin(self.radius / distance.km) * 2.0)
return Angle(radians=asin(self.radius / distance.km) * 2.0)

def serialize(self) -> dict:
"""Serialize the given object
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "kosmorrolib"
version = "1.0.1"
version = "1.0.2"
authors = ["Jérôme Deuchnord <jerome@deuchnord.fr>"]
homepage = "https://kosmorro.space/lib"
repository = "https://github.com/Kosmorro/lib"
Expand All @@ -20,10 +20,9 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.7"
python = ">=3.7,<3.11"
skyfield = "^1.21"
skyfield-data = "^3.0"
numpy = "^1.17"
python-dateutil = "^2.8"

[tool.poetry.dev-dependencies]
Expand Down

0 comments on commit 9aa5e7d

Please sign in to comment.