-
Notifications
You must be signed in to change notification settings - Fork 39
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
Improve performance of create_all_cell_csv #220
Conversation
Hey @stegiopast thanks for this. Just FYI I added your changes (from the zip file) to this branch. This looks to speed up this step in cellfinder by about 2x. This also may address #356 |
Codecov ReportBase: 19.04% // Head: 18.92% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master brainglobe/cellfinder#220 +/- ##
==========================================
- Coverage 19.04% 18.92% -0.12%
==========================================
Files 25 25
Lines 1486 1495 +9
==========================================
Hits 283 283
- Misses 1203 1212 +9
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Before submitting a pull request (PR), please read the contributing guide.
Description
What is this PR
Why is this PR needed?
In the function create_all_cell_csv() of cellfinder/analyse/analyse.py a df.append() call is used in a for loop, which slows down the runtime of the program to a significant extend.
(from hours to seconds)
What does this PR do?
Within the for loop over the points list a temporary matrix is constructed line by line by appending the following values separately (raw_coordinate[0],raw_coordinate[1],raw_coordinate[2],atlas_coordinate[0],atlas_coordinate[1],atlas_coordinate[2],structure,hemisphere). After the loop termination a dataframe is constructed via pd.DataFrame(temp_matrix, columns = list_of_colnames, index = None).
References
Please reference any existing issues/PRs that relate to this PR.
How has this PR been tested?
The code has been tested manually and during several cell detection runs.
So far i did not actively assure that any information is missing. I would be happy if you could assure that.
Is this a breaking change?
Strong improvement in run time
Does this PR require an update to the documentation?
No additional change in the handling of the tool.
Checklist:
analyse.py.zip