Skip to content

Commit e8e5e9b

Browse files
committed
Use better logic for len(workers)
1 parent 0613e3a commit e8e5e9b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

simpeg_drivers/driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def split_list(self, tiles: list[np.ndarray]) -> list[list[np.ndarray]]:
286286
"""
287287
Number of splits for the data misfit to be distributed evenly among workers.
288288
"""
289-
if len(self.workers) == 0:
289+
if not self.workers:
290290
return [[tile] for tile in tiles]
291291

292292
n_tiles = len(tiles)
@@ -815,7 +815,7 @@ def get_tiles(self) -> dict[str, list[np.ndarray]]:
815815
# Heuristic to avoid too many chunks
816816
n_chunks = n_data // self.params.compute.max_chunk_size
817817

818-
if len(self.workers) > 0:
818+
if self.workers:
819819
n_chunks /= len(self.workers)
820820
n_chunks = int(n_chunks) * len(self.workers)
821821

0 commit comments

Comments
 (0)