Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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) ```
- Loading branch information