-
Notifications
You must be signed in to change notification settings - Fork 9
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
Faster compute average intensities #73
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mgeplf
force-pushed
the
faster-compute_average_intensities
branch
from
March 21, 2024 14:22
e0d38b3
to
24f1946
Compare
mgeplf
force-pushed
the
faster-compute_average_intensities
branch
4 times, most recently
from
March 22, 2024 13:08
54c348e
to
0b9adec
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #73 +/- ##
=======================================
Coverage ? 97.67%
=======================================
Files ? 22
Lines ? 1508
Branches ? 0
=======================================
Hits ? 1473
Misses ? 35
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
eleftherioszisis
previously approved these changes
Mar 26, 2024
mgeplf
force-pushed
the
faster-compute_average_intensities
branch
3 times, most recently
from
March 26, 2024 13:51
d33b2c1
to
4edbe62
Compare
Most of the speed up comes from being able to parallelize across cores: old: 1920s new: 2min 26s ± 199 ms so about 13 times faster Small change in computed densities: (Pdb++) np.abs(result.to_numpy() - old.to_numpy()).max() 9.518734625513225e-08 Test code: ``` from atlas_densities.densities import fitting from voxcell import VoxelData, RegionMap from atlas_densities.densities import utils annotation = VoxelData.load_nrrd('input-data/annotation_ccfv2_l23split_barrelsplit_validated.nrrd') gene_voxeldata = { 'gad67': VoxelData.load_nrrd('input-data/gene_gad67_correctednissl.nrrd'), 'pv': VoxelData.load_nrrd('input-data/gene_pv_correctednissl.nrrd'), 'sst': VoxelData.load_nrrd('input-data/gene_sst_correctednissl.nrrd'), 'vip': VoxelData.load_nrrd('input-data/gene_vip_correctednissl.nrrd'), } gids = { 'gad67': '479', 'pv': '868', 'sst': '1001', 'vip': '77371835', } slices = utils.load_json('input-data/realigned_slices.json') gene_marker_volumes = { gene: { "intensity": gene_data.raw, "slices": slices[gids[gene]], # list of integer slice indices } for (gene, gene_data) in gene_voxeldata.items() } region_map = RegionMap.load_json('input-data/hierarchy_ccfv2_l23split_barrelsplit.json') hierarchy_info = utils.get_hierarchy_info(region_map, root='root') res = fitting.compute_average_intensities(annotation.raw, gene_marker_volumes, hierarchy_info, region_map) ```
* Use voxel index to speed up the computation of densities * Revert format changes * Make lint happy
mgeplf
force-pushed
the
faster-compute_average_intensities
branch
from
March 26, 2024 14:00
4edbe62
to
0e5ed80
Compare
mgeplf
force-pushed
the
faster-compute_average_intensities
branch
from
March 26, 2024 14:03
0e5ed80
to
651062d
Compare
eleftherioszisis
approved these changes
Mar 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Most of the speed up comes from not having to repeatedly create masks:
old: 1920s
new:
2min 26sso about 13 times faster10s, so about 192 times faster
Small change in computed densities:
(Pdb++) np.abs(result.to_numpy() - old.to_numpy()).max()
9.518734625513225e-08
Test code: