Closed nawtrey closed 2 years ago
Merging #45 (7425fc6) into master (3511db2) will decrease coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #45 +/- ##
==========================================
- Coverage 99.86% 99.86% -0.01%
==========================================
Files 9 9
Lines 747 724 -23
==========================================
- Hits 746 723 -23
Misses 1 1
Impacted Files | Coverage Δ | |
---|---|---|
kda/plotting.py | 100.00% <100.00%> (ø) |
The code coverage has dropped as a result of the code simplification, which is expected (and acceptable). There is still only 1 uncovered line across the code base, which is good.
Upon merging a few issues will have to be opened to address some remaining changes:
draw_cycles(panel=True)
can likely be further simplified via _plot_panel()
draw_diagrams
and draw_cycles
are probably a bit misleading in the first place. Might be more appropriate to make a public function for plotting individual diagrams/cycles. Overall these changes substantially improve the readability of the code, reduce many instances of repeated code, and still maintain the functionality of the code. The test suite also gets a makeover that allows much better error detection.
I've given the code a good look again, and tried all of the various plotting combinations out. Everything looks good to me, and CI is green, so merging.
Description
Refactor of the primary functions in
plotting.py
.Details
Refactor
draw_diagrams
and move redundant code into new functionsCreate new function
_get_node_colors
for handling diagram and cycle plotting function node colorsChange all instances of save path logic to use
os.path.join
since this is much more stableChange all instances of save path such that input
label
parameter is effectively the filename forMove all instances of
plt.close()
such that the figures are only closed if the figure is savedReplace all instances of
plt.axis("off")
withax.set_axis_off()
so it is more explicitCreate new function
_plot_panel
for handling cases where multiple subfigures need to be plotted together and use it to simplifydraw_diagrams
Add
curved_arrows
parameter to plotting functions so the curved arrows can be switched on/off with easeChange scope of
flux_diagrams_4wl
to "function"Change default behavior of plotting functions
draw_diagrams()
anddraw_cycles()
to plot a panel and fix the corresponding test cases to maintain current code coverageAdd test
test_plot_panel
to cover automated position generation in_plot_panel()
Small formatting changes for
test_plotting.py
Remove unnecessary
plotting._contains_all_nodes()
Abstract repeated code from
_plot_panel()
anddraw_cycles()
into new functionplotting._get_panel_dimensions()
to handle panelrows
/cols
/excess_plots
acquisitionAutomate node list acquisition in
_plot_single_diagram()
Add
node_colors
parameter to_plot_single_diagram()
and automateSet default of
rows
andcols
parameters toNone
in_plot_panel()
Add parameters
rows
,cols
, andcurved_arrows
todraw_cycles()
Refactor
draw_cycles()
to remove as much redundant code as possible. There is still more simplification available, but baby steps..Addresses some of the tasks in #34
Fixes #38