File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -443,10 +443,13 @@ def normalize_plus_or_minus_pi(radians):
443
443
ha_adjustment = desired_ha - ha .radians
444
444
ha_adjustment = (ha_adjustment + pi ) % tau - pi
445
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
446
+ # Figure out how fast the target's HA is changing. After two
447
+ # iterations, just keep using the same value, in case t_diff
448
+ # gets so small that ha_diff drops to zero.
449
+ 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
450
453
451
454
# Remember this iteration's HA and `t` for the next iteration.
452
455
old_ha_radians = ha .radians
You can’t perform that action at this time.
0 commit comments