MCPcopy Create free account
hub / github.com/WizardOfMenlo/stir / plot_per_rate

Function plot_per_rate

graph_script.py:96–144  ·  view source on GitHub ↗
(rate)

Source from the content-addressed store, hash-verified

94fri_color = 'tab:red'
95
96def plot_per_rate(rate):
97 fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=set_size())
98 #fig, [ax1, ax2, ax3, ax4] = plt.subplots(1, 4, figsize=set_size())
99
100
101 pdata = prover_data[prover_data['starting_rate'] == rate]
102 vdata = verifier_data[verifier_data['starting_rate'] == rate]
103
104 # Proving time picture
105 ax1.set_title('Prover time')
106 ax1.plot('starting_degree', 'stir_prover_time', data=pdata, linestyle=linestyle, marker=stir_marker, color=stir_color)
107 ax1.plot('starting_degree', 'fri_prover_time', data=pdata, linestyle=linestyle, marker=fri_marker, color=fri_color)
108 ax1.grid()
109 ax1.set_xscale('log', base=2)
110 ax1.set_yscale('log', base=2)
111 ax1.set_ylabel('Time (s)')
112 ax1.set_xticks(ticks=pdata['starting_degree'], labels=["$2^{{{}}}$".format(str(int(log2(x)))) for x in pdata['starting_degree']])
113
114 # Verifying time picture
115 ax2.set_title('Verifier time')
116 ax2.plot('starting_degree', 'stir_verifier_time', data=vdata, linestyle=linestyle, marker=stir_marker, color=stir_color)
117 ax2.plot('starting_degree', 'fri_verifier_time', data=vdata, linestyle=linestyle, marker=fri_marker, color=fri_color)
118 ax2.grid()
119 ax2.set_xscale('log', base=2)
120 ax2.set_ylabel('Time (ms)')
121 ax2.set_xticks(ticks=pdata['starting_degree'], labels=["$2^{{{}}}$".format(str(int(log2(x)))) for x in pdata['starting_degree']])
122
123 # Argument size
124 ax3.set_title('Argument size')
125 ax3.plot('starting_degree', 'stir_argument_size', data=pdata, linestyle=linestyle, marker=stir_marker, color=stir_color)
126 ax3.plot('starting_degree', 'fri_argument_size', data=pdata, linestyle=linestyle, marker=fri_marker, color=fri_color)
127 ax3.grid()
128 ax3.set_xscale('log', base=2)
129 ax3.set_ylabel('Size (KiB)')
130 ax3.set_xticks(ticks=pdata['starting_degree'], labels=["$2^{{{}}}$".format(str(int(log2(x)))) for x in pdata['starting_degree']])
131
132 # Verifier hashes
133 ax4.set_title('Verifier hashes')
134 ax4.plot('starting_degree', 'stir_verifier_hashes', data=vdata, linestyle=linestyle, marker=stir_marker, color=stir_color)
135 ax4.plot('starting_degree', 'fri_verifier_hashes', data=vdata, linestyle=linestyle, marker=fri_marker, color=fri_color)
136 ax4.grid()
137 ax4.set_xscale('log', base=2)
138 ax4.set_ylabel('Hashes')
139 ax4.set_xticks(ticks=pdata['starting_degree'], labels=["$2^{{{}}}$".format(str(int(log2(x)))) for x in pdata['starting_degree']])
140
141 plt.tight_layout()
142
143 # Save and remove excess whitespace
144 fig.savefig(str(rate) + '_graph.pdf', format='pdf', bbox_inches='tight')
145
146def plot_all(rates):
147 rate_colors = {1: 'tab:blue', 2: 'tab:green', 3: 'tab:orange', 4: 'tab:red'}

Callers 1

graph_script.pyFile · 0.85

Calls 1

set_sizeFunction · 0.85

Tested by

no test coverage detected