Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def extra_quantities(self):
"""Make extra quantities available."""
if self._extra_quantities:
logger.info('Extra quantities already available')
logger.debug(f'Loading extra quantities: {self.file_path.name}')
extra_quantities(snap=self)
self._extra_quantities = True
return self
else:
n_chunks = 1
array_chunks = [type_indices]
if verbose and n_chunks > 1:
logger.info(f'Number of chunks: {n_chunks}', flush=True)
logger.info(f'Chunk size: {chunk_size}', flush=True)
for idx, indices in enumerate(array_chunks):
if verbose:
if n_chunks > 1:
logger.info(
f'Finding neighbours for chunk: {idx}...', flush=True
)
else:
logger.info(f'Finding neighbours...', flush=True)
_neighbours = snap.get_many_neighbours(indices)
neighbours = List()
for neigh in _neighbours:
neighbours.append(np.array(neigh))
if verbose:
if n_chunks > 1:
logger.info(
f'Summing over neighbours for chunk: {idx}...', flush=True
)
else:
logger.info(f'Summing over neighbours...', flush=True)
result[indices] = compute_function(
indices=indices,
neighbours=neighbours,