@@ -1,3 +1,14 @@ | |||||
# [v0.6.1](https://github.com/Deuchnord/kosmorro/compare/v0.6.0...v0.6.1) (2020-03-08) | |||||
### Bug Fixes | |||||
* **events:** prevent false detection of conjunctions ([c7bc757](https://github.com/Deuchnord/kosmorro/commit/c7bc7574df1b0469aad1226887495ce013b615f1)) | |||||
* handle KeyboardInterrupt exception ([a7cb46e](https://github.com/Deuchnord/kosmorro/commit/a7cb46e857e2ca8e55c61fba522b911fcabdc86c)) | |||||
* remove the "timezone" word in the PDF output’s introduction ([5ec56c4](https://github.com/Deuchnord/kosmorro/commit/5ec56c40b1ad80c81a7f5c4e1f63d099403f0a5d)) | |||||
# [v0.6.0](https://github.com/Deuchnord/kosmorro/compare/v0.5.2...v0.6.0) (2020-03-01) | # [v0.6.0](https://github.com/Deuchnord/kosmorro/compare/v0.5.2...v0.6.0) (2020-03-01) | ||||
@@ -23,4 +23,7 @@ from kosmorrolib.main import main | |||||
locale.setlocale(locale.LC_ALL, '') | locale.setlocale(locale.LC_ALL, '') | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
sys.exit(main()) | |||||
try: | |||||
sys.exit(main()) | |||||
except KeyboardInterrupt: | |||||
sys.exit(1) |
@@ -263,7 +263,7 @@ class _LatexDumper(Dumper): | |||||
"It aims to help you to prepare your observation session. " | "It aims to help you to prepare your observation session. " | ||||
"All the hours are given in {timezone}.").format( | "All the hours are given in {timezone}.").format( | ||||
date=self.get_date_as_string(), | date=self.get_date_as_string(), | ||||
timezone='UTC+%d timezone' % self.timezone if self.timezone != 0 else 'UTC' | |||||
timezone='UTC+%d' % self.timezone if self.timezone != 0 else 'UTC' | |||||
), | ), | ||||
_("Don't forget to check the weather forecast before you go out with your material.") | _("Don't forget to check the weather forecast before you go out with your material.") | ||||
])) \ | ])) \ | ||||
@@ -20,6 +20,7 @@ from datetime import date as date_type | |||||
from skyfield.timelib import Time | from skyfield.timelib import Time | ||||
from skyfield.searchlib import find_discrete, find_maxima | from skyfield.searchlib import find_discrete, find_maxima | ||||
from numpy import pi | |||||
from .data import Event, Planet, ASTERS | from .data import Event, Planet, ASTERS | ||||
from .core import get_timescale, get_skf_objects, flatten_list | from .core import get_timescale, get_skf_objects, flatten_list | ||||
@@ -32,15 +33,12 @@ def _search_conjunction(start_time: Time, end_time: Time) -> [Event]: | |||||
def is_in_conjunction(time: Time): | def is_in_conjunction(time: Time): | ||||
earth_pos = earth.at(time) | earth_pos = earth.at(time) | ||||
aster1_pos = earth_pos.observe(get_skf_objects()[aster1.skyfield_name]).apparent() | |||||
aster2_pos = earth_pos.observe(get_skf_objects()[aster2.skyfield_name]).apparent() | |||||
_, aster1_lon, _ = earth_pos.observe(aster1.get_skyfield_object()).apparent().ecliptic_latlon() | |||||
_, aster2_lon, _ = earth_pos.observe(aster2.get_skyfield_object()).apparent().ecliptic_latlon() | |||||
aster_1_right_ascension, _, _ = aster1_pos.radec() | |||||
aster_2_right_ascension, _, _ = aster2_pos.radec() | |||||
return ((aster1_lon.radians - aster2_lon.radians) / pi % 2.0).astype('int8') == 0 | |||||
return aster_1_right_ascension.hours - aster_2_right_ascension.hours < 0 | |||||
is_in_conjunction.rough_period = 1.0 | |||||
is_in_conjunction.rough_period = 60.0 | |||||
computed = [] | computed = [] | ||||
conjunctions = [] | conjunctions = [] | ||||
@@ -54,10 +52,11 @@ def _search_conjunction(start_time: Time, end_time: Time) -> [Event]: | |||||
if not isinstance(aster2, Planet) or aster2 == aster1 or aster2 in computed: | if not isinstance(aster2, Planet) or aster2 == aster1 or aster2 in computed: | ||||
continue | continue | ||||
times, _ = find_discrete(start_time, end_time, is_in_conjunction) | |||||
times, is_conjs = find_discrete(start_time, end_time, is_in_conjunction) | |||||
for time in times: | |||||
conjunctions.append(Event('CONJUNCTION', [aster1, aster2], time.utc_datetime())) | |||||
for i, time in enumerate(times): | |||||
if is_conjs[i]: | |||||
conjunctions.append(Event('CONJUNCTION', [aster1, aster2], time.utc_datetime())) | |||||
computed.append(aster1) | computed.append(aster1) | ||||
@@ -6,9 +6,9 @@ | |||||
#, fuzzy | #, fuzzy | ||||
msgid "" | msgid "" | ||||
msgstr "" | msgstr "" | ||||
"Project-Id-Version: kosmorro 0.6.0\n" | |||||
"Project-Id-Version: kosmorro 0.6.1\n" | |||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||||
"POT-Creation-Date: 2020-03-04 08:05+0100\n" | |||||
"POT-Creation-Date: 2020-03-08 10:46+0100\n" | |||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||||
"Language-Team: LANGUAGE <LL@li.org>\n" | "Language-Team: LANGUAGE <LL@li.org>\n" | ||||
@@ -16,4 +16,4 @@ | |||||
# You should have received a copy of the GNU Affero General Public License | # You should have received a copy of the GNU Affero General Public License | ||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | # along with this program. If not, see <https://www.gnu.org/licenses/>. | ||||
VERSION = '0.6.0' | |||||
VERSION = '0.6.1' |
@@ -29,11 +29,16 @@ class MyTestCase(unittest.TestCase): | |||||
self.assertEqual('Mars is in opposition', o[0].get_description()) | self.assertEqual('Mars is in opposition', o[0].get_description()) | ||||
def test_find_conjunctions(self): | def test_find_conjunctions(self): | ||||
# Test case: Mars opposition | |||||
# Source of the information: https://promenade.imcce.fr/en/pages6/887.html#mar | |||||
c1 = (events.search_events(date(2020, 1, 2)), [(['MERCURY', 'JUPITER BARYCENTER'], '^2020-01-02T15:20')]) | |||||
c2 = (events.search_events(date(2020, 1, 12)), [(['MERCURY', 'SATURN BARYCENTER'], '^2020-01-12T04:34'), | |||||
(['MERCURY', 'PLUTO BARYCENTER'], '^2020-01-12T06:56')]) | |||||
MERCURY = 'MERCURY' | |||||
JUPITER = 'JUPITER BARYCENTER' | |||||
SATURN = 'SATURN BARYCENTER' | |||||
PLUTO = 'PLUTO BARYCENTER' | |||||
c1 = (events.search_events(date(2020, 1, 2)), [([MERCURY, JUPITER], '^2020-01-02T16:41')]) | |||||
c2 = (events.search_events(date(2020, 1, 12)), [([MERCURY, SATURN], '^2020-01-12T09:51'), | |||||
([MERCURY, PLUTO], '^2020-01-12T10:13'), | |||||
([SATURN, PLUTO], '^2020-01-12T16:57')]) | |||||
c3 = (events.search_events(date(2020, 2, 7)), []) | |||||
for (c, expected_dates) in [c1, c2]: | for (c, expected_dates) in [c1, c2]: | ||||
self.assertEqual(len(expected_dates), len(c), | self.assertEqual(len(expected_dates), len(c), | ||||