Skip to content

Commit

Permalink
Further tweaks to the resolution script
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-rhodes committed Oct 25, 2020
1 parent dc7341d commit 9a718e7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions design/resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ def main():
ts = load.timescale()
t = ts.utc(2020, 10, 24)
for attribute in ATTRIBUTES:
step_width = measure_step_width(ts, t.whole, attribute)
step_width, up, down = measure_step_width(ts, t.whole, attribute)
step_width_s = step_width * 24 * 60 * 60
print('{:20} {:.4g} seconds'.format(attribute, step_width_s))
print('{:14} {:12.6g} seconds {} steps up, {} steps down'.format(
attribute, step_width_s, up, down))

def measure_step_width(ts, whole, attribute):
samples = np.arange(-500, 501)
widths = []

for tenth in 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9:
for tenth in 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0:
exp = -30
while True:
tt_fraction = tenth + samples * 10 ** exp
Expand All @@ -38,7 +39,7 @@ def measure_step_width(ts, whole, attribute):
step_width = (tt_fraction[-1] - tt_fraction[0]) / steps
widths.append(step_width)

return max(widths)
return max(widths), steps_up, steps_down

if __name__ == '__main__':
main()

0 comments on commit 9a718e7

Please sign in to comment.