Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/remove cipher from report class #191

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed cipher from report class creator
  • Loading branch information
MFormenti committed Mar 12, 2024
commit fcfbdff3d441fe24cc9f3b5fbefc771ea304be0f
2 changes: 1 addition & 1 deletion claasp/cipher_modules/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def convert_solver_solution_to_dictionary(cipher, model_type, solver_name, solve
'total_weight': 0}
"""
return {
'cipher_id': cipher,
'cipher': cipher,
'model_type': model_type,
'solver_name': solver_name,
'solving_time_seconds': solve_time,
Expand Down
8 changes: 6 additions & 2 deletions claasp/cipher_modules/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ def __init__(self, test_report):

"""

self.cipher = test_report['input_parameters']['cipher']
try:
self.cipher = test_report['input_parameters']['cipher']
except KeyError:
self.cipher = test_report['cipher']
self.test_report = test_report

if 'test_name' in test_report.keys():
Expand Down Expand Up @@ -636,6 +639,7 @@ def _produce_graph(self, output_directory=os.getcwd(), show_graph=False, fixed_i
z_text.append([str(x) for x in self.test_report['test_results'][test]])
fig = px.imshow(z, x=x, y=y, color_continuous_scale='Viridis', aspect="auto")
fig.update_traces(text=z_text, texttemplate="%{text}")
fig.update(layout_coloraxis_showscale=False)
fig.update_xaxes(side="top")
if show_graph==False:
fig.write_image(output_directory + '/test_results.png')
Expand Down Expand Up @@ -736,7 +740,7 @@ def _produce_graph(self, output_directory=os.getcwd(), show_graph=False, fixed_i
else:

fig = px.line(df, range_x=[1, self.cipher.number_of_rounds],
range_y=[min(df[0]) - 1, max(df[0]) + 1])
range_y=[0, 1])
fig.update_layout(xaxis_title="round", yaxis_title=res_key,
showlegend=False)

Expand Down
Loading