-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Faster compute average intensities (#73)
Most of the speed up comes from not having to repeatedly create masks: old: 1920s new: 10s, so about 190 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) ``` --------- Co-authored-by: Eleftherios Zisis <[email protected]>
- Loading branch information
1 parent
5b08942
commit fba1e3f
Showing
3 changed files
with
159 additions
and
60 deletions.
There are no files selected for viewing
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
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
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