Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.voxel_array = VoxelConnectivityArray(weights, nodes)
# Get target and source masks
self.source_mask = self.cache.get_source_mask()
self.target_mask = self.cache.get_target_mask()
else:
print("Loading voxel data, might take a few minutes.")
# load from standard cache
(
self.voxel_array,
self.source_mask,
self.target_mask,
) = self.cache.get_voxel_connectivity_array()
# save to npy
save_npy_to_gz(
weights_file + ".npy.gz", self.voxel_array.weights
)
save_npy_to_gz(nodes_file + ".npy.gz", self.voxel_array.nodes)
def save_to_cache(self, tgt, what, obj):
""" Saves data to cache to avoid loading thema again in the future"""
name, cache_path, _ = self._get_cache_filename(tgt, what)
save_npy_to_gz(cache_path, obj)
self.source_mask = self.cache.get_source_mask()
self.target_mask = self.cache.get_target_mask()
else:
print("Loading voxel data, might take a few minutes.")
# load from standard cache
(
self.voxel_array,
self.source_mask,
self.target_mask,
) = self.cache.get_voxel_connectivity_array()
# save to npy
save_npy_to_gz(
weights_file + ".npy.gz", self.voxel_array.weights
)
save_npy_to_gz(nodes_file + ".npy.gz", self.voxel_array.nodes)