Skip to content

Commit

Permalink
Added the Jamaica script. Started working on geodesics.
Browse files Browse the repository at this point in the history
  • Loading branch information
alinnman committed Jan 9, 2025
1 parent 4b5f9b0 commit 0c6db09
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 119 deletions.
32 changes: 24 additions & 8 deletions starfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ def get_refraction (apparent_angle : int | float, temperature : float, pressure
h = apparent_angle
d = h + 7.31 / (h + 4.4)
d2 = d*q
return (1 / tan (d2))*(pressure / 101.1)*(283.0/(273.0 + temperature))
retval = (1 / tan (d2))*(pressure / 101.1)*(283.0/(273.0 + temperature))
return retval

# Data formatting

Expand Down Expand Up @@ -840,6 +841,12 @@ def get_terrestrial_position (point_a1 : LatLon,
return intersection, a, b, fitness, diag_output
#pylint: enable=R0913

# Geodesics

def get_geocentric_alt (estimated_position : LatLon, geodesic_alt : float, gp : LatLon) -> float:
return 0.0
# TODO

# Celestial Navigation

#pylint: disable=R0902
Expand All @@ -855,19 +862,23 @@ def __init__ (self, \
gha_time_1 : str,
decl_time_0 : str,
measured_alt : str,
estimated_position : LatLon | NoneType = None,
# If estimated_position <> None then measured_alt represents a geodesic reading
# TODO Document this in README.md
decl_time_1 : NoneType | str = None,
sha_diff : NoneType | str = None,
observer_height : int | float = 0,
artificial_horizon : bool = False,
index_error_minutes : int = 0,
index_error_minutes : int | float = 0,
semi_diameter_correction : int | float = 0,
horizontal_parallax : int | float = 0,
sextant : NoneType | Sextant = None,
chronometer : NoneType | Chronometer = None,
temperature : float = 10.0,
dt_dh : float = -0.01,
pressure : float = 101.0,
ho_obs : bool = False):
ho_obs : bool = False,
no_dip : bool = False):
self.temperature = temperature
self.dt_dh = dt_dh
self.pressure = pressure
Expand All @@ -879,12 +890,12 @@ def __init__ (self, \
self.gha_time_1 += 360
if decl_time_1 is None:
decl_time_1 = decl_time_0
self.decl_time_0 = parse_angle_string (decl_time_0)
self.decl_time_1 = parse_angle_string (decl_time_1)
self.decl_time_0 = parse_angle_string (decl_time_0)
self.decl_time_1 = parse_angle_string (decl_time_1)
if self.decl_time_0 < -90 or self.decl_time_0 > 90 or \
self.decl_time_1 < -90 or self.decl_time_1 > 90:
raise ValueError ("Declination values must be within [-90,90]")
self.measured_alt = parse_angle_string (measured_alt)
self.measured_alt = parse_angle_string (measured_alt)
if sha_diff is not None:
self.sha_diff = parse_angle_string (sha_diff)
else:
Expand Down Expand Up @@ -912,8 +923,13 @@ def __init__ (self, \
self.__correct_for_horizontal_parallax (horizontal_parallax)
if not ho_obs:
self.__correct_for_refraction ()
self.__correct_dip_of_horizon ()
if not no_dip:
self.__correct_dip_of_horizon ()
self.gp = self.__calculate_gp ()
if estimated_position is not None:
# We have a geodesic reading and need to adjust it to a geocentric position
# TODO
self.measured_alt = get_geocentric_alt (estimated_position, self.measured_alt, self.gp)
#pylint: enable=R0912
#pylint: enable=R0913
#pylint: enable=R0914
Expand Down Expand Up @@ -1140,7 +1156,7 @@ def get_intersections\
fitness_sum = 0
for cp in chosen_points:
selected_coord = coords [cp][0]
fitness_here = coords [cp][1]
fitness_here = (coords [cp][1])**3
fitness_sum += fitness_here
rect_vec = to_rectangular (selected_coord)
summation_vec =\
Expand Down
43 changes: 22 additions & 21 deletions xtras/starfixdata_xtra_aus_fb.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@

# Our starfix data

a = Sight ( object_name = "Acrux", \
set_time = "2024-08-31 11:10+00:00" ,\
gha_time_0 = "145:7", \
gha_time_1 = "160:9.4", \
decl_time_0 = "-63:14.2", \
measured_alt = "40", \
sha_diff = "173:1.1" \
a = Sight ( object_name = "Acrux",
set_time = "2024-08-31 11:10+00:00",
gha_time_0 = "145:7",
gha_time_1 = "160:9.4",
decl_time_0 = "-63:14.2",
measured_alt = "40",
sha_diff = "173:1.1"
)

b = Sight ( object_name = "Canopus", \
set_time = "2024-08-31 11:10+00:00" ,\
gha_time_0 = "145:7", \
gha_time_1 = "160:9.4", \
decl_time_0 = "-52:42.1", \
measured_alt = "20", \
sha_diff = "263:52.8" \
b = Sight ( object_name = "Canopus",
set_time = "2024-08-31 11:10+00:00",
gha_time_0 = "145:7",
gha_time_1 = "160:9.4",
decl_time_0 = "-52:42.1",
measured_alt = "20",
sha_diff = "263:52.8"
)

c = Sight ( object_name = "Achernar", \
set_time = "2024-08-31 11:10+00:00" ,\
gha_time_0 = "145:7", \
gha_time_1 = "160:9.4", \
decl_time_0 = "-57:6.4", \
measured_alt = "50", \
sha_diff = "335:20" \
c = Sight ( object_name = "Achernar",
set_time = "2024-08-31 11:10+00:00",
gha_time_0 = "145:7",
gha_time_1 = "160:9.4",
decl_time_0 = "-57:6.4",
measured_alt = "50",
sha_diff = "335:20"
)


Expand All @@ -81,6 +81,7 @@
intersections, fitness, diag_output = collection.get_intersections (limit=500)
except IntersectError as ve:
print ("Cannot perform a sight reduction. Bad sight data.")
print ("Check the circles! " + collection.get_map_developers_string())
exit ()
endtime = time ()
takenMs = round((endtime-starttime)*1000,2)
Expand Down
51 changes: 22 additions & 29 deletions xtras/starfixdata_xtra_gotland.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,35 @@
from starfix import Sight, SightCollection, get_representation,\
get_google_map_string, IntersectError, LatLon

#from setuptools import setup, find_packages
#setup(
# name = 'celestial_navigation',
# packages = find_packages(),
#)
#from starfix import Sight, SightCollection, get_representation,\
# get_google_map_string, IntersectError, LatLon

starttime = time ()

# Our starfix data

a = Sight ( object_name = "Sun", \
set_time = "2024-06-29 08:21:00+00:00", \
gha_time_0 = "299:6.6", \
gha_time_1 = "314:6.5", \
decl_time_0 = "23:11.6", \
decl_time_1 = "23:11.4", \
measured_alt = "46:23" \
a = Sight ( object_name = "Sun",
set_time = "2024-06-29 08:21:00+00:00",
gha_time_0 = "299:6.6",
gha_time_1 = "314:6.5",
decl_time_0 = "23:11.6",
decl_time_1 = "23:11.4",
measured_alt = "46:23"
)

b = Sight ( object_name = "Sun", \
set_time = "2024-06-29 12:51:00+00:00", \
gha_time_0 = "359:6.1", \
gha_time_1 = "14:6.6", \
decl_time_0 = "23:11.1", \
decl_time_1 = "23:10.8", \
measured_alt = "49:18" \
b = Sight ( object_name = "Sun",
set_time = "2024-06-29 12:51:00+00:00",
gha_time_0 = "359:6.1",
gha_time_1 = "14:6.6",
decl_time_0 = "23:11.1",
decl_time_1 = "23:10.8",
measured_alt = "49:18"
)

c = Sight ( object_name = "Sun", \
set_time = "2024-06-28 15:36:00+00:00", \
gha_time_0 = "44:5.7", \
gha_time_1 = "59:5.6", \
decl_time_0 = "23:10.5", \
decl_time_1 = "23:10.4", \
measured_alt = "29:20" \
c = Sight ( object_name = "Sun",
set_time = "2024-06-28 15:36:00+00:00",
gha_time_0 = "44:5.7",
gha_time_1 = "59:5.6",
decl_time_0 = "23:10.5",
decl_time_1 = "23:10.4",
measured_alt = "29:20"
)


Expand All @@ -65,6 +57,7 @@
intersections, fitness, diag_output = collection.get_intersections ()
except IntersectError as ve:
print ("Cannot perform a sight reduction. Bad sight data.")
print ("Check the circles! " + collection.get_map_developers_string())
exit ()
endtime = time ()
takenMs = round((endtime-starttime)*1000,2)
Expand Down
43 changes: 22 additions & 21 deletions xtras/starfixdata_xtra_home.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,30 @@
set_time_deviation_seconds = 0,\
drift_sec_per_day = 0.3)

S1 = Sight ( object_name = "Sun", \
set_time = "2024-06-14 05:57:50+00:00", \
gha_time_0 = "254:54.8", \
gha_time_1 = "269:54.7", \
decl_time_0 = "23:17.1", \
decl_time_1 = "23:17.3", \
measured_alt = "57:8", \
artificial_horizon = True,\
index_error_minutes = 0,\
semi_diameter_correction = 15.7,\
sextant = mySextant,\
S1 = Sight ( object_name = "Sun",
set_time = "2024-06-14 05:57:50+00:00",
gha_time_0 = "254:54.8",
gha_time_1 = "269:54.7",
decl_time_0 = "23:17.1",
decl_time_1 = "23:17.3",
measured_alt = "57:8",
artificial_horizon = True,
index_error_minutes = 0,
semi_diameter_correction = 15.7,
sextant = mySextant,
chronometer = myChronometer
)

S2 = Sight ( object_name = "Sun", \
set_time = "2024-06-15 14:49:07+00:00", \
gha_time_0 = "29:50.4", \
gha_time_1 = "44:50.2", \
decl_time_0 = "23:20.5", \
decl_time_1 = "23:20.6", \
measured_alt = "70:17", \
artificial_horizon = True,\
index_error_minutes = 0,\
sextant = mySextant,\
S2 = Sight ( object_name = "Sun",
set_time = "2024-06-15 14:49:07+00:00",
gha_time_0 = "29:50.4",
gha_time_1 = "44:50.2",
decl_time_0 = "23:20.5",
decl_time_1 = "23:20.6",
measured_alt = "70:17",
artificial_horizon = True,
index_error_minutes = 0,
sextant = mySextant,
chronometer = myChronometer
)

Expand All @@ -78,6 +78,7 @@
collection.get_intersections (estimated_position = LatLon(59,19))
except IntersectError as ve:
print ("Cannot perform a sight reduction. Bad sight data.")
print ("Check the circles! " + collection.get_map_developers_string())
exit ()

endtime = time ()
Expand Down
70 changes: 30 additions & 40 deletions xtras/starfixdata_xtra_testfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,58 +29,48 @@

TEMPERATURE = 18

a = Sight ( object_name = "Sabik", \
set_time = "2024-10-01 17:13:00+00:00", \
gha_time_0 = "265:55.1", \
gha_time_1 = "280:57.5", \
decl_time_0 = "-15:45.3", \
sha_diff = "102:3.2", \
measured_alt = "57:36.8", \
observer_height = 2.5, \
temperature = TEMPERATURE, \
ho_obs = True \
a = Sight ( object_name = "Sabik",
set_time = "2024-10-01 17:13:00+00:00",
gha_time_0 = "265:55.1",
gha_time_1 = "280:57.5",
decl_time_0 = "-15:45.3",
sha_diff = "102:3.2",
measured_alt = "57:36.8",
observer_height = 2.5,
temperature = TEMPERATURE,
ho_obs = True
)

b = Sight ( object_name = "Venus", \
set_time = "2024-10-01 17:13:00+00:00", \
gha_time_0 = "47:57.8", \
gha_time_1 = "62:57.3", \
decl_time_0 = "-15:14.8", \
decl_time_1 = "-15:15.9", \
measured_alt = "25:8.4", \
observer_height = 2.5, \
temperature = TEMPERATURE, \
ho_obs = True \
b = Sight ( object_name = "Venus",
set_time = "2024-10-01 17:13:00+00:00",
gha_time_0 = "47:57.8",
gha_time_1 = "62:57.3",
decl_time_0 = "-15:14.8",
decl_time_1 = "-15:15.9",
measured_alt = "25:8.4",
observer_height = 2.5,
temperature = TEMPERATURE,
ho_obs = True
)

c = Sight ( object_name = "Saturn",\
set_time = "2024-10-01 17:13:00+00:00", \
gha_time_0 = "279:30.9", \
gha_time_1 = "294:33.5", \
decl_time_0 = "-8:11.8", \
measured_alt = "30:20.2", \
observer_height = 2.5, \
temperature = TEMPERATURE, \
ho_obs = True \
c = Sight ( object_name = "Saturn",
set_time = "2024-10-01 17:13:00+00:00",
gha_time_0 = "279:30.9",
gha_time_1 = "294:33.5",
decl_time_0 = "-8:11.8",
measured_alt = "30:20.2",
observer_height = 2.5,
temperature = TEMPERATURE,
ho_obs = True
)


#collection = SightCollection ([a, b])
#intersections, fitness, diag_output = collection.get_intersections (limit = 100)
#print ("GM = " + get_google_map_string(intersections,4))
#collection = SightCollection ([a, c])
#intersections, fitness, diag_output = collection.get_intersections (limit = 100)
#print ("GM = " + get_google_map_string(intersections,4))
#collection = SightCollection ([b, c])
#intersections, fitness, diag_output = collection.get_intersections (limit = 100)
#print ("GM = " + get_google_map_string(intersections,4))

collection = SightCollection ([a, b, c])
try:
intersections, fitness, diag_output =\
collection.get_intersections (limit=100)
except IntersectError as ve:
print ("Cannot perform a sight reduction. Bad sight data.")
print ("Check the circles! " + collection.get_map_developers_string())
exit ()
endtime = time ()
takenMs = round((endtime-starttime)*1000,2)
Expand Down

0 comments on commit 0c6db09

Please sign in to comment.