Skip to content

Commit 7f440f6

Browse files
committed
RA conversion fix
I failed. INDI had it right. Thank you to INDI for showing me how the centisecond conversion works.
1 parent 167bd3d commit 7f440f6

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ My goal in writing this is to eventually package it up and use it as a library f
1414
Some of this is written in a way that requires Python > 3.7. There are also Python requirements in the `requirements.txt` file.
1515

1616
## Running
17-
You will need to have your `PYTHONPATH` set up to run these right now, since it's not properly modularized.
17+
You will need to have your `PYTHONPATH` set up to run these right now, since it's not properly modularized. e.g.:
18+
19+
set PYTHONPATH=%PYTHONPATH%;x:\GitHub\ioptron-python
20+
$Env:PYTHONPATH = "x:\GitHub\ioptron-python"
1821

1922
## Citations and sources
2023

ioptron/utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ def convert_arc_seconds_to_degrees(seconds):
1616

1717
def convert_arc_seconds_to_hms(seconds):
1818
"""Converts arc seconds at 0.01 precision to arc HH:MM:SS"""
19-
hours = (((seconds*0.01)*(math.pi/648000))/(math.pi/12))
20-
minutes = Decimal(hours) % 1
21-
seconds = Decimal(minutes) % 1
22-
milliseconds = Decimal(seconds) % 1
23-
return (int(hours), int(minutes), int(seconds), round(float(milliseconds), 2))
19+
hours = seconds / (15.0 * 60.0 * 60.0 * 100.0) #Thank you INDI.
20+
print(hours)
21+
minutes = (Decimal(hours) % 1) * 60
22+
print(minutes)
23+
seconds = (Decimal(minutes) % 1) * 60
24+
print(seconds)
25+
return (int(hours), int(minutes), int(seconds))
2426

2527
def convert_j2k_to_unix_utc(sec, offset = 0):
2628
"""Convert J2000 in 0.01 seconds to formatted UNIX in ms with offset if needed."""

tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ def test_convert_arc_seconds_to_hms(self):
2626

2727
# Run two tests
2828
with self.subTest():
29-
self.assertEqual(utils.convert_arc_seconds_to_hms(twelve_hours), (12, 0, 0, 0.0))
29+
self.assertEqual(utils.convert_arc_seconds_to_hms(twelve_hours), (12, 0, 0))
3030
with self.subTest():
31-
self.assertEqual(utils.convert_arc_seconds_to_hms(twenty_four_hours), (24, 0, 0, 0.0))
31+
self.assertEqual(utils.convert_arc_seconds_to_hms(twenty_four_hours), (24, 0, 0))
3232

3333
#TODO: More tests to see if this actually works
3434

0 commit comments

Comments
 (0)