Skip to content

Commit

Permalink
squashed
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudon committed Nov 22, 2024
1 parent de3f08f commit c14add4
Show file tree
Hide file tree
Showing 16 changed files with 805 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.8
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand Down
15 changes: 12 additions & 3 deletions region_grower/atlas_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This helper allows simple lookups without having to reason in term of [PH][1-6] and [PH]y.
"""

import operator
from pathlib import Path
from typing import List
Expand Down Expand Up @@ -31,16 +32,24 @@ def __init__(self, atlas: Atlas, region_structure_path: str):
if region_structure_path is not None and Path(region_structure_path).exists():
with open(region_structure_path, "r", encoding="utf-8") as region_file:
self.region_structure = yaml.safe_load(region_file)
self.region_structure_base_path = Path(region_structure_path).parent
else:
raise ValueError("Please provide an existing region_structure file.")
raise ValueError(f"region_structure file not found at {region_structure_path}.")

self.regions = list(self.region_structure.keys())
self.layers = {}
for region in self.regions:
self.layers[region] = self.region_structure[region]["layers"]
self.y = atlas.load_data("[PH]y")
try:
self.y = atlas.load_data("[PH]y")
except:
self.y = None

self.brain_regions = atlas.load_data("brain_regions")
self.orientations = atlas.load_data("orientation", cls=OrientationField)
try:
self.orientations = atlas.load_data("orientation", cls=OrientationField)
except:
self.orientations = None

def layer_thickness(self, layer: Union[int, str]) -> Atlas:
"""Returns an atlas of the layer thickness."""
Expand Down
12 changes: 12 additions & 0 deletions region_grower/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ def generate_distributions(
is_flag=True,
default=False,
)
@click.option(
"--resume",
help="Resume synthesis, do not synthesize if file exists (default: False)",
is_flag=True,
default=False,
)
@click.option(
"--max-drop-ratio",
help="Max drop ratio for any mtype (default: 0)",
Expand Down Expand Up @@ -284,6 +290,12 @@ def generate_distributions(
is_flag=True,
default=False,
)
@click.option(
"--synthesize-axons",
help="Display the versions of all the accessible modules in a logger entry",
is_flag=True,
default=False,
)
def synthesize_morphologies(**kwargs): # pylint: disable=too-many-arguments, too-many-locals
"""Synthesize morphologies."""
if mpi_enabled and kwargs.get("with_mpi", False): # pragma: no cover
Expand Down
Loading

0 comments on commit c14add4

Please sign in to comment.