Skip to content

Commit 69313cc

Browse files
committed
Adjust making cell to account for single cell debug networks
1 parent edfd2ef commit 69313cc

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

src/miv_simulator/network.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -851,11 +851,22 @@ def make_cells(env: Env) -> None:
851851
for pop_name in pop_names:
852852
env.pc.barrier()
853853

854+
pop_attr_info = env.cell_attribute_info.get(pop_name, {})
855+
has_trees = "Trees" in pop_attr_info
856+
has_coords = env.coordinates_ns in pop_attr_info
857+
858+
if not has_trees and not has_coords:
859+
if rank == 0:
860+
logger.warning(
861+
f"make_cells: no cell attribute data for population {pop_name}; skipping"
862+
)
863+
continue
864+
854865
if rank == 0:
855866
logger.info(f"*** Creating population {pop_name}")
856867
logger.info(
857868
f"Coordinates namespace is {env.coordinates_ns}\n"
858-
f"population attributes are {env.cell_attribute_info[pop_name]}"
869+
f"population attributes are {pop_attr_info}"
859870
)
860871

861872
## Determine template name for this cell type
@@ -876,9 +887,7 @@ def make_cells(env: Env) -> None:
876887
reduced_cons = cells.get_reduced_cell_constructor(template_name)
877888

878889
num_cells = 0
879-
if (pop_name in env.cell_attribute_info) and (
880-
"Trees" in env.cell_attribute_info[pop_name]
881-
):
890+
if has_trees:
882891
if rank == 0:
883892
logger.info(f"*** Reading trees for population {pop_name}")
884893

@@ -932,9 +941,7 @@ def make_cells(env: Env) -> None:
932941
num_cells += 1
933942
del trees
934943

935-
elif (pop_name in env.cell_attribute_info) and (
936-
env.coordinates_ns in env.cell_attribute_info[pop_name]
937-
):
944+
elif has_coords:
938945
if rank == 0:
939946
logger.info(f"*** Reading coordinates for population {pop_name}")
940947

@@ -983,10 +990,6 @@ def make_cells(env: Env) -> None:
983990
cell.position(cell_x, cell_y, cell_z)
984991
cells.register_cell(env, pop_name, gid, cell)
985992
num_cells += 1
986-
else:
987-
raise RuntimeError(
988-
f"make_cells: unknown cell configuration type for cell type {pop_name}"
989-
)
990993

991994
h.define_shape()
992995

0 commit comments

Comments
 (0)