Skip to content

Commit

Permalink
support for configurable coordinates namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
iraikov committed Aug 21, 2024
1 parent 461e088 commit 3187c76
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/miv_simulator/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def __init__(
spike_input_path: None = None,
spike_input_namespace: None = None,
spike_input_attr: None = None,
coordinates_namespace: str = "Coordinates",
cleanup: bool = True,
cache_queries: bool = False,
profile_memory: bool = False,
Expand Down Expand Up @@ -288,6 +289,7 @@ def __init__(
if "Origin" in self.geometry["Parametric Surface"]:
self.parse_origin_coords()

self.coordinates_ns = coordinates_namespace
self.celltypes = self.model_config["Cell Types"]
self.cell_attribute_info = {}
self.phenotype_dict = {}
Expand Down
12 changes: 6 additions & 6 deletions src/miv_simulator/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def make_cells(env: Env) -> None:
del trees

elif (pop_name in env.cell_attribute_info) and (
"Coordinates" in env.cell_attribute_info[pop_name]
env.coordinates_ns in env.cell_attribute_info[pop_name]
):
if rank == 0:
logger.info(
Expand All @@ -1033,7 +1033,7 @@ def make_cells(env: Env) -> None:
cell_attr_dict = scatter_read_cell_attributes(
data_file_path,
pop_name,
namespaces=["Coordinates"],
namespaces=[env.coordinates_ns],
comm=env.comm,
io_size=env.io_size,
return_type="tuple",
Expand All @@ -1042,7 +1042,7 @@ def make_cells(env: Env) -> None:
cell_attr_dict = scatter_read_cell_attributes(
data_file_path,
pop_name,
namespaces=["Coordinates"],
namespaces=[env.coordinates_ns],
node_allocation=env.node_allocation,
comm=env.comm,
io_size=env.io_size,
Expand All @@ -1053,7 +1053,7 @@ def make_cells(env: Env) -> None:
f"*** Done reading coordinates for population {pop_name}"
)

coords_iter, coords_attr_info = cell_attr_dict["Coordinates"]
coords_iter, coords_attr_info = cell_attr_dict[env.coordinates_ns]

x_index = coords_attr_info.get("X Coordinate", None)
y_index = coords_attr_info.get("Y Coordinate", None)
Expand Down Expand Up @@ -1221,7 +1221,7 @@ def make_cell_selection(env):
num_cells += 1

elif (pop_name in env.cell_attribute_info) and (
"Coordinates" in env.cell_attribute_info[pop_name]
env.coordinates_ns in env.cell_attribute_info[pop_name]
):
if rank == 0:
logger.info(
Expand All @@ -1232,7 +1232,7 @@ def make_cell_selection(env):
data_file_path,
pop_name,
selection=gid_range,
namespace="Coordinates",
namespace=env.coordinates_ns,
comm=env.comm,
return_type="tuple",
)
Expand Down
7 changes: 7 additions & 0 deletions src/scripts/run_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ def mpi_excepthook(type, value, traceback):
type=str,
help="attribute name for input spikes when cell selection is specified",
)
@click.option(
"--coordinates-namespace",
required=False,
type=str,
help="namespace for coordinates when cells without morphologies are instantiated",
)
@click.option("--dt", type=float, default=0.025, help="")
@click.option(
"--ldbal",
Expand Down Expand Up @@ -268,6 +274,7 @@ def main(
spike_input_path,
spike_input_namespace,
spike_input_attr,
coordinates_namespace,
dt,
ldbal,
lptbal,
Expand Down

0 comments on commit 3187c76

Please sign in to comment.