We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 55ad886 commit 767b1cbCopy full SHA for 767b1cb
skyfield/almanac.py
@@ -443,10 +443,13 @@ def normalize_plus_or_minus_pi(radians):
443
ha_adjustment = desired_ha - ha.radians
444
ha_adjustment = (ha_adjustment + pi) % tau - pi
445
446
- # Figure out how fast the target's HA is changing.
447
- ha_diff = normalize(ha.radians - old_ha_radians)
448
- t_diff = t - old_t
449
- ha_per_day = ha_diff / t_diff
+ # Figure out how fast the target's HA is changing. After two
+ # iterations, just keep using the same value, in case t_diff
+ # gets so small that ha_diff drops to zero.
+ if i < 2:
450
+ ha_diff = normalize(ha.radians - old_ha_radians)
451
+ t_diff = t - old_t
452
+ ha_per_day = ha_diff / t_diff
453
454
# Remember this iteration's HA and `t` for the next iteration.
455
old_ha_radians = ha.radians
0 commit comments