Stuff I did a while ago
This commit is contained in:
parent
d5f93944b1
commit
1f416411c7
1 changed files with 8 additions and 5 deletions
|
@ -36,11 +36,13 @@ def main():
|
||||||
print("Usage: plot_numberdealers.py <numberdealers.json> <numberdealers-ng.json>")
|
print("Usage: plot_numberdealers.py <numberdealers.json> <numberdealers-ng.json>")
|
||||||
return 1
|
return 1
|
||||||
with open(sys.argv[1], encoding="utf-8") as fh:
|
with open(sys.argv[1], encoding="utf-8") as fh:
|
||||||
numbers_og, _errors = parse_numberdealers.parse(fh)
|
numbers_og, _errors = parse_numberdealers.parse(fh, parse_numberdealers.ErrorStyle.NUMBERDEALERS)
|
||||||
with open(sys.argv[2], encoding="utf-8") as fh:
|
with open(sys.argv[2], encoding="utf-8") as fh:
|
||||||
numbers_ng, _errors = parse_numberdealers.parse(fh)
|
numbers_ng, _errors = parse_numberdealers.parse(fh, parse_numberdealers.ErrorStyle.NUMBERDEALERS_NG)
|
||||||
|
|
||||||
start_of_current_slope = find(numbers_og, lambda msg: msg.create_at >= numbers_ng[0].create_at)
|
start_at_numberdealers_ng_number = 1
|
||||||
|
|
||||||
|
start_of_current_slope = find(numbers_og, lambda msg: msg.create_at >= numbers_ng[start_at_numberdealers_ng_number].create_at)
|
||||||
# a = (y2-y1) / (x2-x1)
|
# a = (y2-y1) / (x2-x1)
|
||||||
slope_og = (
|
slope_og = (
|
||||||
numbers_og[-1].recognized_number - numbers_og[start_of_current_slope].recognized_number
|
numbers_og[-1].recognized_number - numbers_og[start_of_current_slope].recognized_number
|
||||||
|
@ -51,9 +53,9 @@ def main():
|
||||||
intercept_og = numbers_og[-1].recognized_number - slope_og * numbers_og[-1].create_at/1000
|
intercept_og = numbers_og[-1].recognized_number - slope_og * numbers_og[-1].create_at/1000
|
||||||
|
|
||||||
slope_ng = (
|
slope_ng = (
|
||||||
numbers_ng[-1].recognized_number - numbers_ng[0].recognized_number
|
numbers_ng[-1].recognized_number - numbers_ng[start_at_numberdealers_ng_number].recognized_number
|
||||||
) / (
|
) / (
|
||||||
numbers_ng[-1].create_at/1000 - numbers_ng[0].create_at/1000
|
numbers_ng[-1].create_at/1000 - numbers_ng[start_at_numberdealers_ng_number].create_at/1000
|
||||||
)
|
)
|
||||||
intercept_ng = numbers_ng[-1].recognized_number - slope_ng * numbers_ng[-1].create_at/1000
|
intercept_ng = numbers_ng[-1].recognized_number - slope_ng * numbers_ng[-1].create_at/1000
|
||||||
|
|
||||||
|
@ -78,6 +80,7 @@ def main():
|
||||||
# func = lambda x: x < intercept_x
|
# func = lambda x: x < intercept_x
|
||||||
# locs = np.append(locs[func(locs)][:-1], [intercept_x])
|
# locs = np.append(locs[func(locs)][:-1], [intercept_x])
|
||||||
labels = ["{:%Y-%m-%d}".format(datetime.fromtimestamp(x, timezone.utc)) for x in locs]
|
labels = ["{:%Y-%m-%d}".format(datetime.fromtimestamp(x, timezone.utc)) for x in locs]
|
||||||
|
labels[-2] = ""
|
||||||
plt.xticks(locs, labels)
|
plt.xticks(locs, labels)
|
||||||
|
|
||||||
plt.grid()
|
plt.grid()
|
||||||
|
|
Loading…
Reference in a new issue