Here's a comparison of /ot/ and /mai/'s activity over the years using two long-standing threads in each。Side note, the process of posting this took waaaaaay too much effort.
import matplotlib。pyplot as plt
import numpy as np
from datetime import timedelta
from time_extract import get_timestamps
def plot_data(filename, color, marker):
plt。grid(True)
plt。yscale('symlog')
plt。xlabel('Time')
plt。ylabel('Time Δ(days)')
data = get_timestamps(filename)
delta = np。diff(data) / timedelta(days=1)
plt。scatter(data[1:], delta, alpha=0。1, c=color, marker=marker)
for i, time_stamp in enumerate(data[1:]):
if delta[i] > 200:
plt。annotate(time_stamp。date(), (data[i+1],delta[i]),fontsize=8)
plt。subplot(2, 1, 1)
plt。title('/ot/')
#Ponderings general
plot_data('ot_16448。txt', 'steelblue', 'o')
#Dream thread
plot_data('ot_521。txt', 'cadetblue', 'D')
plt。subplot(2, 1, 2)
plt。title('/mai/')
#Who your waifu is
plot_data('mai_5。txt', 'orchid', 'o')
#Share your daily waifu experience
plot_data('mai_8705。txt', 'palevioletred', 'D')
plt。gcf()。set_size_inches(15, 14)
plt。savefig('scatter', dpi=500)
time_extract
import re
import numpy as np
from datetime import datetime
ts_reg = r'<span class="postername"。*<\/span>\s*(。*)'
dt_string = '%m/%d/%y(%a)%H:%M'
def get_timestamps(filename):
with open(filename, 'r', encoding='utf-8') as file:
txt = file。read()
matches = re。findall(ts_reg, txt)
data = []
for match in matches:
dp = datetime。strptime(match, dt_string)
data。append(dp)
return np。array(data)