Skip to content

Commit

Permalink
add ranking number and head for sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
BaohongGuo committed Oct 16, 2023
1 parent 5985e21 commit 09ef253
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/sensitivity_analyze_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,16 @@
effect_magnitudes[i] = derivs_meanabs.max()

print('\nReactions sorted by their overall importance:')
print(f'{"rank":<6} R{"#":<6} {"reaction_list":40} {"max(mustar)":15}')

# Load reaction names
base_name = logs[0].replace('_log.txt', '')
with open(base_name + '_reactions.txt', 'r') as f:
reactions_list = [x.strip() for x in f.readlines() if x.strip()]

j = 0
ix_sort = np.argsort(effect_magnitudes)[::-1]
for i in ix_sort:
ix = reaction_ix[i]
print(f'R{ix:<4} {reactions_list[ix-1]:40} {effect_magnitudes[i]:<15.8f}')
j += 1
print(f'{j:<6} R{ix:<6} {reactions_list[ix-1]:40} {effect_magnitudes[i]:<15.8f}')

0 comments on commit 09ef253

Please sign in to comment.