Skip to content

Commit

Permalink
fix the +0 -0 absurdity and actually commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dowdlelt committed Nov 8, 2019
1 parent cab6fc0 commit c1f54bf
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tedana/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,38 @@ def write_kappa_scatter(comptable, out_dir):

plt.close()


def write_kappa_scree(comptable, out_dir):
"""
Creates a scree plot sorted by kappa, showing the values of the kappa and
rho metrics as wella s variance explained.
Parameters
----------
comptable : (C x X) :obj:`pandas.DataFrame`
Component metric table. One row for each component, with a column for
each metric. Requires at least four columns: "classification",
"kappa", "rho", and "variance explained".
out_dir : :obj:`str`
Figures folder within output directory
"""

fig, ax1 = plt.subplots(figsize=(10, 9))

ax1.plot(comp_table.component.to_numpy(), comp_table['variance explained'].to_numpy(), 'k-', alpha = 0.5, linewidth=2, label='Variance')
ax1.set_ylabel('Variance Explained', fontsize = 15)
ax2 = ax1.twinx()

ax2.plot(comp_table.component.to_numpy(), comp_table.kappa.to_numpy(), 'b-', linewidth=2, label='Kappa')
ax2.plot(comp_table.component.to_numpy(), comp_table.rho.to_numpy(), 'r-', linewidth=2, label='Rho')
ax2.set_title('Kappa/Rho Metrics', fontsize = 28)
ax1.set_xlabel('Component Number', fontsize = 15)
ax2.set_ylabel('Metric Value', fontsize = 15)
fig.legend(loc='upper right', bbox_to_anchor=(0.82, 0.78))
screefig_title = os.path.join(out_dir, 'Kappa_Rho_Scree_plot.png')
plt.savefig(screefig_title)


def write_summary_fig(comptable, out_dir):
"""
Expand Down
4 changes: 4 additions & 0 deletions tedana/workflows/tedana.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ def tedana_workflow(data, tes, mask=None, mixm=None, ctab=None, manacc=None,
viz.write_kappa_scatter(comptable=comptable,
out_dir=op.join(out_dir, 'figures'))

LGR.info('Making Kappa/Rho scree plot')
viz.write_kappa_scree(comptable=comptable,
out_dir=op.join(out_dir, 'figures'))

LGR.info('Making overall summary figure')
viz.write_summary_fig(comptable=comptable,
out_dir=op.join(out_dir, 'figures'))
Expand Down

0 comments on commit c1f54bf

Please sign in to comment.