Skip to content

Commit

Permalink
Fix / allowance for no tick factor match by using the lowest-resoluti…
Browse files Browse the repository at this point in the history
…on match instead of throwing an error.
  • Loading branch information
briantrice committed Apr 23, 2024
1 parent 4eee542 commit c05ef44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SlideRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,9 @@ def pat_auto(self, y_off, sc, al, x_start=None, x_end=None, include_last=False):
# Ensure a reasonable visual density of numerals
frac_w = sc.offset_between(x_start, x_end, 1)
step_num = 10 ** max(int(math.log10(x_end - x_start) - 0.5 * frac_w) + num_digits, 0)
sub_div4 = next(TF_BY_MIN[i] for i in TF_MIN if i <= step_num
and sc.min_offset_for_delta(x_start, x_end, step_num / i / sf, scale_w) >= min_tick_offset)
sub_div4 = next((TF_BY_MIN[i] for i in TF_MIN if i <= step_num
and sc.min_offset_for_delta(x_start, x_end, step_num / i / sf, scale_w) >= min_tick_offset),
TF_BY_MIN[1])
(_, step2, step3, step4) = t_s(step_num, sub_div4)
# Iteration Setup
i_start = int(x_start * sf)
Expand Down

0 comments on commit c05ef44

Please sign in to comment.