Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-22 08:40:58

0001 from datetime import datetime, timedelta
0002 
0003 import numpy as np
0004 
0005 import matplotlib.dates as mdates
0006 import matplotlib.units as munits
0007 
0008 import matplotlib.pyplot as plt
0009 
0010 @np.vectorize
0011 def to_datetime(date):
0012     return datetime.strptime(date, '%b %d %Y %H:%M:%S') 
0013 
0014 with open("tags") as fp:
0015     tags = np.array([l.strip().replace("refs/tags/v", "").split("|") for l in fp.readlines()])
0016 tags_dates = to_datetime(tags[:,1])
0017 order = np.argsort(tags_dates)
0018 tags = tags[order][101:]
0019 tags_dates = tags_dates[order][101:]
0020 
0021 with open("eic_container_tags") as fp:
0022     eic_container_tags = np.array([l.strip().split("|") for l in fp.readlines()])
0023 eic_container_tags_dates = to_datetime(eic_container_tags[:,1])
0024 order = np.argsort(eic_container_tags_dates)
0025 eic_container_tags = eic_container_tags[order]
0026 eic_container_tags_dates = eic_container_tags_dates[order]
0027 
0028 with open("result") as fp:
0029     result = np.array([l.strip().split("|") for l in fp.readlines()])
0030 result_dates = to_datetime(result[:,1])
0031 order = np.argsort(result_dates)
0032 result = result[order]
0033 result_dates = result_dates[order]
0034 
0035 
0036 result_ixs, tags_ixs = np.nonzero(result[:,0][:,np.newaxis] == tags[:,0][np.newaxis,:])
0037 print(result_ixs)
0038 print(tags_ixs)
0039 
0040 def annotate(ax, label, x, y, xytext):
0041     ax.annotate(label, xy=(x,y),
0042                 xytext=xytext, textcoords='offset points',
0043                 fontsize=5,
0044                 arrowprops={'arrowstyle': '-|>', 'color': 'black', 'linewidth': 1.})
0045 
0046 #plt.xkcd()
0047 fig, ax = plt.subplots(figsize=(6.4, 3), layout='constrained')
0048 
0049 x = np.arange(len(tags))
0050 ax.plot(tags_dates, x, label="Acts releases")
0051 ax.plot(eic_container_tags_dates[result_ixs], tags_ixs, label="ePIC stack releases")
0052 
0053 ax.xaxis.set_major_locator(mdates.YearLocator())
0054 ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y'))
0055 container_bump_ix = np.nonzero(result[1:,0] != result[:-1,0])[0] + 1
0056 assert np.allclose(result_ixs, range(len(result_ixs)))
0057 for cix, ix in zip(container_bump_ix, tags_ixs[container_bump_ix]):
0058     annotate(plt.gca(), tags[ix,0], tags_dates[ix], ix, (-200 + ix, ix * 1.2 - 90))
0059     annotate(plt.gca(), eic_container_tags[cix,0], eic_container_tags_dates[cix], ix, (-100 + ix, -80 + ix * 0.5))
0060 plt.ylabel("Acts version index", loc="top")
0061 plt.legend()
0062 ax.spines[['right', 'top']].set_visible(False)
0063 plt.savefig("fig.png", dpi=300)
0064 plt.show()