Skip to content

Commit

Permalink
Update starfix.py
Browse files Browse the repository at this point in the history
Fixed a bug in refraction calculation
  • Loading branch information
alinnman committed May 21, 2024
1 parent df46b5f commit 08d48bf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions starfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,18 @@ def distanceBetweenPoints (lonLat1, lonLat2):
return distance

# Atmospheric refraction

def getRefraction (apparentAngle):
'''
Bennett's formula
See: https://en.wikipedia.org/wiki/Atmospheric_refraction#Calculating_refraction
'''
assert (type(apparentAngle) == float or type (apparentAngle) == int)
h = apparentAngle*(pi/180)
return (1 / tan( h + 7.31 / (h + 4.4) ))
q = pi/180
h = apparentAngle
d = h + 7.31 / (h + 4.4)
d2 = d*q
return 1 / tan (d2)

# Data formatting

Expand Down Expand Up @@ -206,8 +209,8 @@ def __init__ (self, \

def correctForRefraction (self):
madDecimal = 90-self.getAngle ()
refraction = getRefraction (90-madDecimal)/60
newMad = madDecimal + refraction
refraction = getRefraction (madDecimal)/60
newMad = madDecimal - refraction
d, m, s = getDMS (newMad)
self.measured_alt_degrees = d
self.measured_alt_minutes = m
Expand Down

0 comments on commit 08d48bf

Please sign in to comment.