Browse Source

Merge branch 'main' into features

pull/44/head
Jérôme Deuchnord 2 years ago
parent
commit
9aa5e7dbd1
6 changed files with 25 additions and 15 deletions
  1. +11
    -0
      CHANGELOG.md
  2. +4
    -5
      CONTRIBUTING.md
  3. +1
    -1
      Makefile
  4. +5
    -3
      kosmorrolib/events.py
  5. +2
    -3
      kosmorrolib/model.py
  6. +2
    -3
      pyproject.toml

+ 11
- 0
CHANGELOG.md View File

@@ -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)




+ 4
- 5
CONTRIBUTING.md View File

@@ -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.



+ 1
- 1
Makefile View File

@@ -1,5 +1,5 @@
black:
poetry run black kosmorrolib setup.py
poetry run black kosmorrolib

.PHONY: tests
tests: doctests


+ 5
- 3
kosmorrolib/events.py View File

@@ -23,10 +23,9 @@ from skyfield.timelib import Time
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,
@@ -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"]
@@ -187,7 +189,7 @@ def _search_oppositions(start_time: Time, end_time: Time, timezone: int) -> [Eve

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


+ 2
- 3
kosmorrolib/model.py View File

@@ -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
@@ -180,7 +179,7 @@ class Object(Serializable):
.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


+ 2
- 3
pyproject.toml View File

@@ -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"
@@ -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]


Loading…
Cancel
Save