From 5141f93cb5e6d40c76982fa4bf60167a0731039b Mon Sep 17 00:00:00 2001 From: Adrien Berchet Date: Thu, 16 Feb 2023 10:41:33 +0100 Subject: [PATCH] Chore: Apply Copier template (#57) --- .copier-answers.yml | 2 +- .flake8 | 6 ++++-- .pre-commit-config.yaml | 16 ++++++++-------- neurots/astrocyte/context.py | 1 - neurots/astrocyte/grower.py | 9 ++------- neurots/astrocyte/section.py | 1 - neurots/astrocyte/space_colonization.py | 6 ------ neurots/extract_input/from_neurom.py | 2 +- neurots/extract_input/input_distributions.py | 1 - neurots/generate/diametrizer.py | 6 +++--- neurots/generate/grower.py | 15 +++++++-------- neurots/generate/orientations.py | 1 - neurots/generate/soma.py | 1 - neurots/morphmath/point_array.py | 1 - neurots/utils.py | 1 - tests/astrocyte/test_context.py | 2 -- tests/astrocyte/test_grower.py | 2 -- tests/astrocyte/test_point_cloud.py | 5 ----- tests/astrocyte/test_section.py | 6 ------ tests/astrocyte/test_space_colonization.py | 13 ------------- tests/astrocyte/test_tmd_utils.py | 2 -- tests/astrocyte/test_tree.py | 1 - tests/test_generate_tree.py | 3 --- tests/test_morphmath_point_array.py | 1 - tests/test_morphmath_utils.py | 4 ---- tests/test_orientations.py | 8 -------- tests/test_soma_grower.py | 15 --------------- tox.ini | 2 -- validation/boxplot_comparison.py | 2 -- validation/violin_comparison.py | 1 - 30 files changed, 26 insertions(+), 110 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 80166fa6..7a869408 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,6 +1,6 @@ # Changes here will be overwritten by Copier -_commit: 0.1.33 +_commit: 0.1.36 _src_path: git@bbpgitlab.epfl.ch:neuromath/python-template.git author_email: '' author_name: Blue Brain Project, EPFL diff --git a/.flake8 b/.flake8 index be1feb3b..8285bd2d 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,7 @@ [flake8] ignore = - E203, # E203: whitespace before ':' - W503 # W503: line break before binary operator + # E203: whitespace before ':' + E203, + # W503: line break before binary operator + W503 max-line-length = 100 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 957134eb..59c0ef63 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3.8 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -13,31 +13,31 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook - rev: v9.0.0 + rev: v9.4.0 hooks: - id: commitlint stages: - commit-msg additional_dependencies: ['conventional-changelog-conventionalcommits'] - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort - repo: https://github.com/psf/black - rev: 22.6.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/codespell-project/codespell - rev: v2.2.1 + rev: v2.2.2 hooks: - id: codespell args: ["-x", ".codespellignorelines"] - repo: https://github.com/PyCQA/pydocstyle - rev: 6.1.1 + rev: 6.3.0 hooks: - id: pydocstyle - additional_dependencies: ["toml"] + additional_dependencies: ["tomli"] - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 diff --git a/neurots/astrocyte/context.py b/neurots/astrocyte/context.py index 2eee4858..d2f534f4 100644 --- a/neurots/astrocyte/context.py +++ b/neurots/astrocyte/context.py @@ -92,7 +92,6 @@ class SpaceColonizationContext: """ def __init__(self, params): - self.morphology_points = DynamicPointArray() if "endfeet_targets" in params: diff --git a/neurots/astrocyte/grower.py b/neurots/astrocyte/grower.py index 1b04e584..9a840b83 100644 --- a/neurots/astrocyte/grower.py +++ b/neurots/astrocyte/grower.py @@ -29,6 +29,7 @@ from neurots.morphmath import sample from neurots.morphmath.utils import norm as vectorial_norm from neurots.morphmath.utils import normalize_vectors +from neurots.utils import NeuroTSError L = logging.getLogger(__name__) @@ -41,7 +42,7 @@ def _number_of_trees(tree_type, oris, distributions, random_generator=np.random) n_trees = len(oris) if tree_type == "basal" and n_trees < 2: - raise Exception(f"There should be at least 2 basal dendrites (got {n_trees})") + raise NeuroTSError(f"There should be at least 2 basal dendrites (got {n_trees})") return n_trees @@ -63,9 +64,7 @@ def _ensure_endfeet_are_reached(cell, targets): distances, section_indices = KDTree(termination_points, copy_data=False).query(target_points) for distance, section_index, target_point in zip(distances, section_indices, target_points): - if not np.isclose(distance, 0.0): - L.warning( "Target %s was not reached. Extending closest section to reach it.", target_point, @@ -175,7 +174,6 @@ def _create_process_trunks(self, tree_type, parameters, distributions): tree_type = "perivascular" if tree_type == "axon" else "perisynaptic" if tree_type == "perivascular": - target_ids = np.array(parameters["target_ids"], dtype=np.int32) target_points = self.context.endfeet_targets.points[target_ids] @@ -193,7 +191,6 @@ def _create_process_trunks(self, tree_type, parameters, distributions): ), "Number of targets is not equal to number of orientations" for target_id, trunk_point in zip(target_ids, trunk_points): - neurite_params = deepcopy(parameters) neurite_params["target_id"] = target_id neurite_params["distance_soma_target"] = vectorial_norm( @@ -201,7 +198,6 @@ def _create_process_trunks(self, tree_type, parameters, distributions): ) self._add_active_neurite(trunk_point, neurite_params, distributions) else: - oris = parameters["orientation"] if oris is not None: @@ -214,7 +210,6 @@ def _create_process_trunks(self, tree_type, parameters, distributions): ) for i, trunk_point in enumerate(trunk_points): - neurite_params = deepcopy(parameters) if "domain_distances" in neurite_params: neurite_params["distance_to_domain"] = parameters["domain_distances"][i] diff --git a/neurots/astrocyte/section.py b/neurots/astrocyte/section.py index 0715986d..2480ae70 100644 --- a/neurots/astrocyte/section.py +++ b/neurots/astrocyte/section.py @@ -55,7 +55,6 @@ def grow_to_target(start_point, start_direction, target_point, segment_length, p points = [] while not in_squared_proximity(point, target_point, target_proximity): - target_direction = from_to_direction(point, target_point) direction = (1.0 - p) * direction + p * target_direction diff --git a/neurots/astrocyte/space_colonization.py b/neurots/astrocyte/space_colonization.py index e0a4bb02..cd475683 100644 --- a/neurots/astrocyte/space_colonization.py +++ b/neurots/astrocyte/space_colonization.py @@ -237,7 +237,6 @@ def _colonization_split(section, angles, parameters, context): repulsion = _repulsion(morphology_points[ids], current_point, kill_distance) if section.process == "major": - seed_ids = point_cloud.partial_ball_query( current_point, influence_distance, @@ -254,7 +253,6 @@ def _colonization_split(section, angles, parameters, context): section_direction, vectors_to_seeds, repulsion ) else: - seed_ids = point_cloud.upper_half_ball_query( current_point, influence_distance, section_direction ) @@ -266,7 +264,6 @@ def _colonization_split(section, angles, parameters, context): dir1, dir2 = _colonization_strategy_secondary(vectors_to_seeds, repulsion) if np.allclose(dir1, dir2): - L.warning( "Splitting directions are identical. Use of fallback strategy to recalculate them." ) @@ -348,7 +345,6 @@ def _colonization_split_with_target_influence(section, angles, parameters, conte target_point = context.endfeet_targets.points[target_id] if in_squared_proximity(current_point, target_point, ENDFOOT_SQUARED_DISTANCE): - # this section will become the endfoot section that will connect to the target process2 = "endfoot" @@ -356,7 +352,6 @@ def _colonization_split_with_target_influence(section, angles, parameters, conte context.endfeet_targets.active[target_id] = False dir2 = from_to_direction(current_point, target_point) else: - max_target_distance = parameters["distance_soma_target"] if process1 == "major": dir1 = _add_attraction_bias( @@ -367,7 +362,6 @@ def _colonization_split_with_target_influence(section, angles, parameters, conte section.context.field, ) else: - process1 = _majorize_process( process1, section.stop_criteria["TMD"], diff --git a/neurots/extract_input/from_neurom.py b/neurots/extract_input/from_neurom.py index d3aee21a..b36ba53d 100644 --- a/neurots/extract_input/from_neurom.py +++ b/neurots/extract_input/from_neurom.py @@ -105,7 +105,7 @@ def trunk_neurite(pop, neurite_type=nm.BASAL_DENDRITE, bins=30): Args: pop (neurom.core.population.Population): The given population. neurite_type (neurom.core.types.NeuriteType): Consider only the neurites of this type. - bins (int or list[int] or str, optional): The bins to use (this pararmeter is passed to + bins (int or list[int] or str, optional): The bins to use (this parameter is passed to :func:`numpy.histogram`). Returns: diff --git a/neurots/extract_input/input_distributions.py b/neurots/extract_input/input_distributions.py index 47c95fd8..b35ca854 100644 --- a/neurots/extract_input/input_distributions.py +++ b/neurots/extract_input/input_distributions.py @@ -97,7 +97,6 @@ def distributions( elif ( isinstance(diameter_model, str) and diameter_model == "default" ) or diameter_model is None: - input_distributions["diameter"] = {} input_distributions["diameter"]["method"] = "default" input_distributions["diameter"]["diameter"] = build_diameter_models( diff --git a/neurots/generate/diametrizer.py b/neurots/generate/diametrizer.py index 3eaabdf0..bdc63853 100644 --- a/neurots/generate/diametrizer.py +++ b/neurots/generate/diametrizer.py @@ -20,6 +20,8 @@ import numpy as np from morphio import SectionType +from neurots.utils import NeuroTSError + def section_filter(neuron, tree_type=None): """Filter all sections according to type.""" @@ -71,7 +73,7 @@ def redefine_diameter_section(section, diam_ind, diam_new): + section.diameters.tolist()[(diam_ind + 1) :] ) if len(section.points) != len(section.diameters): - raise Exception("Mismatch in dimensions of diameters.") + raise NeuroTSError("Mismatch in dimensions of diameters.") def bifurcator(initial_diam, num_children, rall_ratio, siblings_ratio): @@ -223,7 +225,6 @@ def diametrize_from_root( random_generator (numpy.random.Generator): The random number generator to use. """ for r in root_section_filter(neuron, tree_type=neurite_type): - model = model_params[r.type.name] # Selected by the root type. trunk_diam = sample(model["trunk"], random_generator) min_diam = np.min(model["term"]) @@ -233,7 +234,6 @@ def diametrize_from_root( while active: for section in list(active): - if section.is_root: taper = sample(model["trunk_taper"], random_generator) init_diam = trunk_diam diff --git a/neurots/generate/grower.py b/neurots/generate/grower.py index 8ad4c259..e578c6e6 100644 --- a/neurots/generate/grower.py +++ b/neurots/generate/grower.py @@ -35,6 +35,7 @@ from neurots.generate.tree import TreeGrower from neurots.morphmath import sample from neurots.morphmath.utils import normalize_vectors +from neurots.utils import NeuroTSError from neurots.utils import convert_from_legacy_neurite_type from neurots.validator import validate_neuron_distribs from neurots.validator import validate_neuron_params @@ -253,7 +254,6 @@ def _convert_orientation2points(self, orientation, n_trees, distr, params): ), "Orientations should have non-zero lengths" if params.get("trunk_absolute_orientation", False): if len(orientation) == 1: - orientation = np.asarray(orientation[0], dtype=np.float64) orientation /= np.linalg.norm(orientation) @@ -271,7 +271,6 @@ def _convert_orientation2points(self, orientation, n_trees, distr, params): raise ValueError("The orientation should contain exactly one point!") else: if len(orientation) >= n_trees: - # TODO: pick orientations randomly? orientations = normalize_vectors(np.asarray(orientation, dtype=np.float64))[ :n_trees @@ -319,7 +318,6 @@ def _grow_trunks(self): legacy_mode = not isinstance(self.input_parameters[tree_types[0]]["orientation"], dict) if not legacy_mode: - trunk_orientations_manager = self._trunk_orientations_class( soma=self.soma_grower.soma, parameters=self.input_parameters, @@ -329,29 +327,30 @@ def _grow_trunks(self): ) for type_of_tree in tree_types: - params = self.input_parameters[type_of_tree] distr = self.input_distributions[type_of_tree] if legacy_mode: - n_trees = sample.n_neurites(distr["num_trees"], random_generator=self._rng) if type_of_tree == "basal_dendrite" and n_trees < 2: - raise Exception(f"There should be at least 2 basal dendrites (got {n_trees})") + raise NeuroTSError( + f"There should be at least 2 basal dendrites (got {n_trees})" + ) orientation = params["orientation"] points = self._convert_orientation2points(orientation, n_trees, distr, params) else: - orientations = trunk_orientations_manager.compute_tree_type_orientations( type_of_tree ) n_trees = len(orientations) if type_of_tree == "basal_dendrite" and n_trees < 2: - raise Exception(f"There should be at least 2 basal dendrites (got {n_trees})") + raise NeuroTSError( + f"There should be at least 2 basal dendrites (got {n_trees})" + ) points = self.soma_grower.add_points_from_orientations(orientations) diff --git a/neurots/generate/orientations.py b/neurots/generate/orientations.py index caffe3dc..f946ab39 100644 --- a/neurots/generate/orientations.py +++ b/neurots/generate/orientations.py @@ -47,7 +47,6 @@ def _mode_{name}(self, values_dict, tree_type) """ def __init__(self, soma, parameters, distributions, context, rng): - self._soma = soma self._parameters = parameters self._distributions = distributions diff --git a/neurots/generate/soma.py b/neurots/generate/soma.py index cf25ad2c..767f795a 100644 --- a/neurots/generate/soma.py +++ b/neurots/generate/soma.py @@ -163,7 +163,6 @@ def add_points_from_orientations(self, vectors): new_points = [] for vect in vectors: - phi, theta = rotation.spherical_from_vector(vect) point = self.soma.point_from_trunk_direction(phi, theta) new_points.append(point) diff --git a/neurots/morphmath/point_array.py b/neurots/morphmath/point_array.py index eaa0a4a4..4e9fdcfe 100644 --- a/neurots/morphmath/point_array.py +++ b/neurots/morphmath/point_array.py @@ -30,7 +30,6 @@ class DynamicPointArray: """ def __init__(self, initial_capacity=100000, resize_factor=2.0): - self._size = 0 self._capacity = initial_capacity self._resize_factor = resize_factor diff --git a/neurots/utils.py b/neurots/utils.py index 40ba3092..40abc4c7 100644 --- a/neurots/utils.py +++ b/neurots/utils.py @@ -56,7 +56,6 @@ def convert_from_legacy_neurite_type(data): """Convert legacy neurite type names, basal -> basal_dendrite and apical -> apical_dendrite.""" old_data = deepcopy(data) for key, _data in old_data.items(): - if key == "apical": neurite_type_warning(key) data["apical_dendrite"] = data.pop("apical") diff --git a/tests/astrocyte/test_context.py b/tests/astrocyte/test_context.py index 112929e2..7c3d3a04 100644 --- a/tests/astrocyte/test_context.py +++ b/tests/astrocyte/test_context.py @@ -37,7 +37,6 @@ def _input_params(): def test_constructor(): - c = tested.SpaceColonizationContext(_input_params()) npt.assert_equal(len(c.endfeet_targets.points), 2) @@ -52,7 +51,6 @@ def test_constructor(): def test_methods(): - c = tested.SpaceColonizationContext(_input_params()) npt.assert_allclose(c.kill_distance(0.1), 15.0 * 0.1) diff --git a/tests/astrocyte/test_grower.py b/tests/astrocyte/test_grower.py index 357da0f4..409cef69 100644 --- a/tests/astrocyte/test_grower.py +++ b/tests/astrocyte/test_grower.py @@ -80,7 +80,6 @@ def _parameters(): def _distributions(): - path = _path / "bio_path_distribution.json" with open(path, "r", encoding="utf-8") as f: distributions = json.load(f) @@ -216,7 +215,6 @@ def _legacy_rng(): def _check_neurots_soma(soma): - expected_points = np.array( [ [-5.760930017396721, 14.022942101967232, -1.909993715025774], diff --git a/tests/astrocyte/test_point_cloud.py b/tests/astrocyte/test_point_cloud.py index 3aeaf3cd..ef29de3c 100644 --- a/tests/astrocyte/test_point_cloud.py +++ b/tests/astrocyte/test_point_cloud.py @@ -60,7 +60,6 @@ def _assert_unordered_equal(arr1, arr2): def test_ball_query(): - point_cloud = create_point_cloud() ids = point_cloud.ball_query(np.array([1.0, 1.0, 1.0]), 0.001) @@ -72,7 +71,6 @@ def test_ball_query(): def test_upper_half_ball_query(): - point_cloud = create_point_cloud() ref_point = np.array([0.2, 0.2, 0.2]) @@ -86,7 +84,6 @@ def test_upper_half_ball_query(): def test_partial_ball_query(): - point_cloud = create_point_cloud() ref_point = -np.ones(3) @@ -110,7 +107,6 @@ def test_partial_ball_query(): def test_remove_ids(): - to_remove = np.array([4, 3, 9, 1]) point_cloud = create_point_cloud() @@ -120,7 +116,6 @@ def test_remove_ids(): def test_nearest_neighbor_direction(): - point_cloud = create_point_cloud() point = np.ones(3) + 0.2 diff --git a/tests/astrocyte/test_section.py b/tests/astrocyte/test_section.py index 4fc715bd..7bf88741 100644 --- a/tests/astrocyte/test_section.py +++ b/tests/astrocyte/test_section.py @@ -42,7 +42,6 @@ def _point_cloud(): - point_cloud = Mock(points=POINT_CLOUD_POINTS, remove_hemisphere=Mock()) values = [ @@ -77,7 +76,6 @@ def _spatial_context(): def _create_section_spatial_grower(process_type): - start_point = np.array([0.0, 1.0, 2.0]) direction = np.array([0.0, 1.0, 0.0]) @@ -103,7 +101,6 @@ def _create_section_spatial_grower(process_type): def test_section_spatial_grower__construction(): - grower = _create_section_spatial_grower("major") assert grower.process == "major" @@ -119,7 +116,6 @@ def test_section_spatial_grower__construction(): def test_section_spatial_grower__first_point(): - grower = _create_section_spatial_grower("major") grower.first_point() @@ -136,7 +132,6 @@ def test_section_spatial_grower__first_point(): def test_section_spatial_grower__next_direction(): - grower = _create_section_spatial_grower("major") grower.first_point() @@ -150,7 +145,6 @@ def test_section_spatial_grower__next_direction(): def test_section_spatial_grower__next_point(): - grower = _create_section_spatial_grower("major") grower.first_point() grower.next() diff --git a/tests/astrocyte/test_space_colonization.py b/tests/astrocyte/test_space_colonization.py index be9b3eab..73a39ccd 100644 --- a/tests/astrocyte/test_space_colonization.py +++ b/tests/astrocyte/test_space_colonization.py @@ -39,7 +39,6 @@ def _point_cloud(): - point_cloud = Mock(points=PCLOUD_POINTS, remove_hemisphere=Mock()) values = [ @@ -58,7 +57,6 @@ def _point_cloud(): def test_majorize(): - process = "secondary" stop = Mock() @@ -81,7 +79,6 @@ def test_majorize(): def test_repulsion(): - point = np.zeros(3) points = np.array([[0.0, 0.0, 1.0], [0.0, 0.0, 2.0], [0.0, 0.0, 3.0]]) @@ -114,7 +111,6 @@ def test_repulsion(): def test_fallback_strategy(): - repulsion = np.array([0.0, 1.0, 2.0]) mock_dir1 = np.array([1.0, 0.0, 0.0]) @@ -124,7 +120,6 @@ def test_fallback_strategy(): "neurots.astrocyte.space_colonization.directional", return_value=(mock_dir1.copy(), mock_dir2.copy()), ): - section_direction = np.array([0.0, 0.0, 1.0]) dir1, dir2 = tested._fallback_strategy(section_direction, None, repulsion) @@ -140,7 +135,6 @@ def test_fallback_strategy(): def test_colonization_strategy_secondary(): - vectors = np.array( [ [0.14525965, 0.18989378, 0.73957937], @@ -169,7 +163,6 @@ def test_colonization_strategy_secondary(): def test_colonization_strategy_primary(): - vectors = np.array( [ [0.14525965, 0.18989378, 0.73957937], @@ -200,7 +193,6 @@ def test_colonization_strategy_primary(): def _section(process_type): - mock = Mock() mock.direction = np.array([1.0, 0.0, 0.0]) mock.last_point = np.array([0.5, 0.5, 0.5]) @@ -217,7 +209,6 @@ def _section(process_type): def test_colonization_split(): - section = _section("major") parameters = {"step_size": {"norm": {"mean": 1.0}}} @@ -236,7 +227,6 @@ def test_colonization_split(): ) as primary_strategy, patch( module + "_colonization_strategy_secondary" ) as secondary_strategy: - repulsion.return_value = np.array([3.0, 2.0, 1.0]) half_ball_query.return_value = [] @@ -320,7 +310,6 @@ def test_colonization_split(): def test_add_attraction_bias(): - target_point = np.array([0.0, 0.0, 100.0]) current_point = np.array([0.0, 0.0, 0.0]) @@ -348,7 +337,6 @@ def attraction_function(x): def test_colonization_split_with_target_influence(): - parameters = { "bias": 1.0, "distance_soma_target": 1.0, @@ -374,7 +362,6 @@ def test_colonization_split_with_target_influence(): ) as mock_add_attraction_bias, patch( module + "_majorize_process" ) as mock_majorize_process: - mock_colonization_split.return_value = ( np.array([0.0, 0.0, 1.0]), None, diff --git a/tests/astrocyte/test_tmd_utils.py b/tests/astrocyte/test_tmd_utils.py index 4c8b16a5..b88ea177 100644 --- a/tests/astrocyte/test_tmd_utils.py +++ b/tests/astrocyte/test_tmd_utils.py @@ -37,7 +37,6 @@ def _barcode_list(): def test_scale_barcode(): - barcode = _barcode() target_distance = 2.0 * 1072.5500821184357 @@ -54,7 +53,6 @@ def test_scale_barcode(): def test_barcodes_greater_than_distance(): - barcode_list = _barcode_list() result = _tu.barcodes_greater_than_distance(barcode_list, 3000.0) diff --git a/tests/astrocyte/test_tree.py b/tests/astrocyte/test_tree.py index dcc23579..e4decfb6 100644 --- a/tests/astrocyte/test_tree.py +++ b/tests/astrocyte/test_tree.py @@ -29,7 +29,6 @@ def test_tree_grower_space_colonization_constructor(): - neuron = Mock() initial_direction = np.array([0.12427115, 0.93206836, 0.3403017]) initial_point = np.array([1.5411615, 0.29389329, 0.15904417]) diff --git a/tests/test_generate_tree.py b/tests/test_generate_tree.py index dde94394..ae5af672 100644 --- a/tests/test_generate_tree.py +++ b/tests/test_generate_tree.py @@ -33,7 +33,6 @@ def test_create_section_parameters__normal_input(): - input_dict = {"randomness": 0.3, "targeting": 0.6} parameters = _create_section_parameters(input_dict) @@ -44,7 +43,6 @@ def test_create_section_parameters__normal_input(): def test_create_section_parameters__exceed_bounds(): - input_dict = {"randomness": 1.1, "targeting": -0.1} parameters = _create_section_parameters(input_dict) @@ -61,7 +59,6 @@ def test_create_section_parameters__exceed_bounds(): def test_create_section_parameters__sum_to_one_error(): - input_dict = {"randomness": 2.0, "targeting": 2.0} with pytest.raises(NeuroTSError): diff --git a/tests/test_morphmath_point_array.py b/tests/test_morphmath_point_array.py index b3c2af39..e4e6b129 100644 --- a/tests/test_morphmath_point_array.py +++ b/tests/test_morphmath_point_array.py @@ -27,7 +27,6 @@ @pytest.fixture def dynamic_array(): - initial_capacity = 3 resize_factor = 2 diff --git a/tests/test_morphmath_utils.py b/tests/test_morphmath_utils.py index 2558084d..c618e224 100644 --- a/tests/test_morphmath_utils.py +++ b/tests/test_morphmath_utils.py @@ -31,7 +31,6 @@ def test_norm(): def test_from_to_direction(): - point = np.array([0.51374375, 0.39753749, 0.27568173]) target = np.array([0.5932438, 0.96379423, 0.49277981]) @@ -47,7 +46,6 @@ def test_from_to_direction(): def test_in_same_halfspace(): - points = np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0], [2.0, 2.0, 2.0]]) ref_point = np.array([0.5, 0.5, 0.5]) @@ -76,7 +74,6 @@ def test_in_squared_proximity(): def test_ball_query(): - points = np.array( [ [0.0, 0.0, -2.0], @@ -92,7 +89,6 @@ def test_ball_query(): def test_upper_half_ball_query(): - points = np.array([[10.0, 10.0, 10.0], [11.0, 11.0, 11.0]]) ids = tested.upper_half_ball_query(points, np.zeros(3), 0.1, np.array([1.0, 0.0, 0.0])) assert ids.size == 0 diff --git a/tests/test_orientations.py b/tests/test_orientations.py index 38b275a8..838a597b 100644 --- a/tests/test_orientations.py +++ b/tests/test_orientations.py @@ -29,7 +29,6 @@ def test_orientation_manager__constructor(): - soma = "soma" parameters = "parameters" distributions = "distributions" @@ -77,7 +76,6 @@ def test_orientation_manager__constructor(): def test_orientation_manager__mode_use_predefined(): - parameters = { "grow_types": ["john"], "john": { @@ -114,7 +112,6 @@ def test_orientation_manager__mode_use_predefined(): def test_orientation_manager__tree_type_method_values(): - parameters = { "grow_types": ["john"], "john": { @@ -156,7 +153,6 @@ def test_orientation_manager__tree_type_method_values(): def test_orientation_manager__mode_sample_around_primary_orientation(): - parameters = { "grow_types": ["john"], "john": { @@ -197,7 +193,6 @@ def test_orientation_manager__mode_sample_around_primary_orientation(): def test_orientation_manager__mode_sample_pairwise_angles(): - parameters = { "grow_types": ["john"], "john": {"orientation": {"mode": "sample_pairwise_angles", "values": {}}}, @@ -267,7 +262,6 @@ def test_orientation_manager__mode_sample_pairwise_angles(): def test_spherical_angles_to_orientations(): - phis = [0.5 * np.pi, np.pi, np.pi] thetas = [0.5 * np.pi, np.pi, 0.5 * np.pi] @@ -282,7 +276,6 @@ def test_spherical_angles_to_orientations(): def test_points_to_orientations(): - origin = np.array([0.0, 0.0, 0.0]) points = np.array([[2.0, 0.0, 0.0], [0.0, 0.0, 3.0]]) @@ -291,7 +284,6 @@ def test_points_to_orientations(): def test_orientations_to_sphere_points(): - sphere_center = np.array([0.0, 0.0, 1.0]) sphere_radius = 0.2 diff --git a/tests/test_soma_grower.py b/tests/test_soma_grower.py index 3dc1c412..63afc8d0 100644 --- a/tests/test_soma_grower.py +++ b/tests/test_soma_grower.py @@ -38,7 +38,6 @@ def test_constructors(): - inputs = [ [np.array([1.0, 2.0, 3.0]), 2.0], [np.array([1, 2, 3]), 2], @@ -49,7 +48,6 @@ def test_constructors(): ] for center, radius in inputs: - soma = tested.Soma(center, radius) assert_equal(len(soma.points), 0) @@ -77,7 +75,6 @@ def test_constructors(): def test_soma_point_from_trunk_direction(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) phi = 4.5 @@ -91,7 +88,6 @@ def test_soma_point_from_trunk_direction(): def test_soma_orientation_from_point(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) point = np.array([0.32764176, 0.53033757, 0.74690682]) @@ -105,7 +101,6 @@ def test_soma_orientation_from_point(): def test_soma_orientation_from_point_exception(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) point = np.array([1.0, 2.0, 3.0]) @@ -115,7 +110,6 @@ def test_soma_orientation_from_point_exception(): def test_soma_contour_point(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) point = [4.0, 5.0, 6.0] @@ -128,7 +122,6 @@ def test_soma_contour_point(): def test_soma_grower_one_point_soma(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) soma_grower = tested.SomaGrower(soma) @@ -139,7 +132,6 @@ def test_soma_grower_one_point_soma(): def test_soma_grower_contour_soma(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) soma_grower = tested.SomaGrower(soma) @@ -161,7 +153,6 @@ def bypassing_interpolate(points, interpolation=10): def test_soma_grower_original_soma(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) soma_grower = tested.SomaGrower(soma) @@ -172,7 +163,6 @@ def test_soma_grower_original_soma(): def test_soma_grower_interpolate(): - soma = tested.Soma((0.0, 0.0, 0.0), 6.0) soma_grower = tested.SomaGrower(soma) @@ -270,7 +260,6 @@ def test_soma_interpolate_from_neuron_2(): def test_soma_interpolate_exception(): - soma = tested.Soma((0.0, 0.0, 0.0), 6.0) soma_grower = tested.SomaGrower(soma) @@ -283,7 +272,6 @@ def test_soma_interpolate_exception(): def test_add_points_from_trunk_angles(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) soma_grower = tested.SomaGrower(soma) @@ -318,7 +306,6 @@ def test_add_points_from_trunk_angles(): def test_add_points_from_trunk_absolute_orientation(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) # Test with trivial orientation @@ -370,7 +357,6 @@ def test_add_points_from_trunk_absolute_orientation(): def test_add_points_from_orientations(): - soma = tested.Soma((1.0, 2.0, 3.0), 2.0) soma_grower = tested.SomaGrower(soma) @@ -394,7 +380,6 @@ def test_add_points_from_orientations(): def test_build(): - soma_grower = tested.SomaGrower(tested.Soma((1.0, 2.0, 3.0), 2.0)) soma_grower._contour_soma = lambda: "contour_function" diff --git a/tox.ini b/tox.ini index b1eb04e8..bc45bb0b 100644 --- a/tox.ini +++ b/tox.ini @@ -18,8 +18,6 @@ extras = test setenv = COVERAGE_FILE = {env:COVERAGE_FILE:.coverage-{envname}} -passenv = - PIP_EXTRA_INDEX_URL deps = min_versions: Requirements-Builder commands = diff --git a/validation/boxplot_comparison.py b/validation/boxplot_comparison.py index d1ffb3ea..4f58ae82 100644 --- a/validation/boxplot_comparison.py +++ b/validation/boxplot_comparison.py @@ -38,7 +38,6 @@ def get_features(object1, object2, flist=feat_list, neurite_type=nm.BASAL_DENDRI collect_all = [] for feat in flist: - feature_pop = nm.get(feat, object1, neurite_type=neurite_type) feature_neu = nm.get(feat, object2, neurite_type=neurite_type) @@ -52,7 +51,6 @@ def get_features_median(object1, object2, flist=feat_list, neurite_type=nm.BASAL collect_all = [] for feat in flist: - feature_pop = [np.median(nm.get(feat, obj, neurite_type=neurite_type)) for obj in object1] feature_neu = nm.get(feat, object2, neurite_type=neurite_type) diff --git a/validation/violin_comparison.py b/validation/violin_comparison.py index 6d0af43a..c0cbf988 100644 --- a/validation/violin_comparison.py +++ b/validation/violin_comparison.py @@ -39,7 +39,6 @@ def get_features_medians(object1, object2, flist=feat_list, neurite_type=nm.BASA collect_all = [] for feat in flist: - feature_pop = [np.median(nm.get(feat, obj, neurite_type=neurite_type)) for obj in object1] feature_neu = [np.median(nm.get(feat, obj, neurite_type=neurite_type)) for obj in object2]