-
Notifications
You must be signed in to change notification settings - Fork 32
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
Remove Pyplot and refactor plotting to object-oriented plotting #187
Conversation
==================================================================== In `compute_morphometrics.py`: The `display_axon_diameter` function is now renamed to `draw_axon_diameter` to improve meaning. Add function `save_map_of_axon_diameters` to save the map to a certain folder. Then modified all necessary files to be compatible with the updates.
…axondeepseg into maf88/170-move-to-OO-plotting
def test_score_analysis_runs_successfully_with_visualization_on(self): | ||
|
||
tmp_folder = "/tmp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this folder might not work in Windows. Better off creating a temp directory relative to your current directory (e.g. "__tmp_segmentation_scoring__/" for it to be specific to this function), then deleting that entire directory at the end. At least then, if it doesn't get cleaned up, we'll know about it (instead of being dumped in a folder that's not version controlled). That's how I've been managing it anyways (I've had an issue where Windows would not let me delete files that I had explicitly created as "temp" files, using the tempfile module. If you feel strongly about using the tmp/
folder, I could re-install a Windows virtual machine on my laptop and test it on there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. We should definitely use the tempfile module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we can give it a go again, I'll just have to re-explore some workarounds for Windows, because some of its functionality was making tests failing on that OS back when I was first testing it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's do something simple because I'm going to refactor score_analysis
so the metrics evaluation is separated from the visualization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about not deleting temp file if permissions don’t allow? They will eventually be deleted by the OS at some point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I need to update the wiki to clarify how we should implement plotting functionalities. |
…axondeepseg into maf88/167-move-to-OO-plotting
Will resolve #167. (link to old PR: #177 closed because of erroneous branch name)
This issue remove
matplotlib.pyplot
from the source code and make plotting object-oriented (OO).Now drawing, displaying, or plotting functions return a matplotlib.figure.Figure and that's up to the caller to decide whether to save or display the figure.
In addition, the main three notebooks: notebooks/guide_dataset_building.ipynb, notebooks/training_guideline.ipynb, notebooks/performance_metrics.ipynb were updated to improve OO functionalities.
Files that were updated:
AxonDeepSeg/morphometrics/compute_morphometrics.py : remove pyplot and updtate to OO
AxonDeepSeg/morphometrics/launch_morphometrics_computation.py: remove unused matplotlib imports
AxonDeepSeg/testing/segmentation_scoring.py: remove pyplot and update to OO
AxonDeepSeg/visualization/visualize.py: remove pyplot and update to OO
test/morphometrics/test_compute_morphometrics.py: update to handle new functions signature
notebooks/guide_dataset_building.ipynb: update to OO
notebooks/training_guideline.ipynb: update to OO
notebooks/performance_metrics.ipynb: update to OO