From ebc89db8da3863c57fc799ab567420d2d4fcdeb4 Mon Sep 17 00:00:00 2001 From: anilbey Date: Tue, 29 Aug 2023 12:12:14 +0200 Subject: [PATCH] rename feature names with ambiguity (#98) * rename feature names with ambiguity * update feature names in sscx tests * add build.os to readthedocs yml --- .readthedocs.yml | 5 + .../factsheets/morphology_features.py | 28 +++--- tests/sscx_tests/test_factsheets_output.py | 40 ++++---- .../data/hippocampus_morphometrics.json | 96 +++++++++---------- tests/unit_tests/data/sscx_morphometrics.json | 24 ++--- .../data/thalamus_morphometrics.json | 18 ++-- tests/unit_tests/test_morphology_features.py | 22 ++--- 7 files changed, 119 insertions(+), 114 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index b48a7a7..627cebc 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -5,6 +5,11 @@ # Required version: 2 +build: + os: ubuntu-22.04 + tools: + python: "3.11" + sphinx: configuration: doc/source/conf.py fail_on_warning: true diff --git a/emodelrunner/factsheets/morphology_features.py b/emodelrunner/factsheets/morphology_features.py index a9500c4..8d374b5 100644 --- a/emodelrunner/factsheets/morphology_features.py +++ b/emodelrunner/factsheets/morphology_features.py @@ -83,7 +83,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"average diameter of {neurite_name}" + self.name = f"average diameter, {neurite_name}" self.unit = "\u00b5m" neurites = list(iter_neurites(morphology, filt=is_type(neurite_type))) @@ -117,7 +117,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"total {neurite_name} length" + self.name = f"total length, {neurite_name}" self.unit = "\u00b5m" feature_value = nm.get("total_length", morphology, neurite_type=neurite_type) self.value = self.replace_empty_value(feature_value) @@ -141,7 +141,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"total {neurite_name} height" + self.name = f"total height, {neurite_name}" self.unit = "\u00b5m" feature_value = nm.get("total_height", morphology, neurite_type=neurite_type) self.value = self.replace_empty_value(feature_value) @@ -165,7 +165,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"total {neurite_name} width" + self.name = f"total width, {neurite_name}" self.unit = "\u00b5m" feature_value = nm.get("total_width", morphology, neurite_type=neurite_type) self.value = self.replace_empty_value(feature_value) @@ -189,7 +189,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"total {neurite_name} depth" + self.name = f"total depth, {neurite_name}" self.unit = "\u00b5m" feature_value = nm.get("total_depth", morphology, neurite_type=neurite_type) self.value = self.replace_empty_value(feature_value) @@ -213,7 +213,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"total {neurite_name} area" + self.name = f"total area, {neurite_name}" self.unit = "\u00b5m\u00b2" feature_value = nm.get("total_area", morphology, neurite_type=neurite_type) self.value = self.replace_empty_value(feature_value) @@ -237,7 +237,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"total {neurite_name} volume" + self.name = f"total volume, {neurite_name}" self.unit = "\u00b5m\u00b3" feature_value = nm.get("total_volume", morphology, neurite_type=neurite_type) self.value = self.replace_empty_value(feature_value) @@ -261,7 +261,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"number of {neurite_name} sections" + self.name = f"number of sections, {neurite_name}" self.unit = "" feature_value = nm.get( "number_of_sections", morphology, neurite_type=neurite_type @@ -287,7 +287,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"number of {neurite_name} segments" + self.name = f"number of segments, {neurite_name}" self.unit = "" feature_values = nm.get( "number_of_segments", morphology, neurite_type=neurite_type @@ -313,7 +313,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"mean {neurite_name} volume" + self.name = f"mean volume, {neurite_name}" self.unit = "\u00b5m\u00b3" feature_values = nm.get( "total_volume_per_neurite", morphology, neurite_type=neurite_type @@ -340,7 +340,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"average {neurite_name} section length" + self.name = f"average section length, {neurite_name}" self.unit = "\u00b5m" feature_values = nm.get( "section_lengths", morphology, neurite_type=neurite_type @@ -367,7 +367,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"average {neurite_name} segment length" + self.name = f"average segment length, {neurite_name}" self.unit = "\u00b5m" feature_values = nm.get( "segment_lengths", morphology, neurite_type=neurite_type @@ -394,7 +394,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"{neurite_name} maximum branch order" + self.name = f"maximum branch order, {neurite_name}" self.unit = "" feature_values = nm.get( "section_branch_orders", morphology, neurite_type=neurite_type @@ -421,7 +421,7 @@ def __init__(self, morphology, neurite_name, neurite_type): neurite_type (NeuriteType): enum for neurite type encoding """ super().__init__() - self.name = f"{neurite_name} maximum section length" + self.name = f"maximum section length, {neurite_name}" self.unit = "\u00b5m" feature_values = nm.get( "section_lengths", morphology, neurite_type=neurite_type diff --git a/tests/sscx_tests/test_factsheets_output.py b/tests/sscx_tests/test_factsheets_output.py index e8527c6..5d41651 100644 --- a/tests/sscx_tests/test_factsheets_output.py +++ b/tests/sscx_tests/test_factsheets_output.py @@ -182,29 +182,29 @@ def test_anatomy_features(): ana_dict = morph_factsheet_builder.get_feature_values() ana_dict = {"values": ana_dict, "name": "Anatomy"} left_to_check_1 = [ - "total axon length", - "mean axon volume", - "axon maximum branch order", - "axon maximum section length", - "total apical length", - "mean apical volume", - "apical maximum branch order", - "apical maximum section length", - "total basal length", - "mean basal volume", - "basal maximum branch order", - "basal maximum section length", + "total length, axon", + "mean volume, axon", + "maximum branch order, axon", + "maximum section length, axon", + "total length, apical", + "mean volume, apical", + "maximum branch order, apical", + "maximum section length, apical", + "total length, basal", + "mean volume, basal", + "maximum branch order, basal", + "maximum section length, basal", "soma diameter", ] left_to_check_2 = [ - "total axon length", - "mean axon volume", - "axon maximum branch order", - "axon maximum section length", - "total dendrite length", - "mean dendrite volume", - "dendrite maximum branch order", - "dendrite maximum section length", + "total length, axon", + "mean volume, axon", + "maximum branch order, axon", + "maximum section length, axon", + "total length, dendrite", + "mean volume, dendrite", + "maximum branch order, dendrite", + "maximum section length, dendrite", "soma diameter", ] lists_to_check = [left_to_check_1, left_to_check_2] diff --git a/tests/unit_tests/data/hippocampus_morphometrics.json b/tests/unit_tests/data/hippocampus_morphometrics.json index 7409171..e696d57 100644 --- a/tests/unit_tests/data/hippocampus_morphometrics.json +++ b/tests/unit_tests/data/hippocampus_morphometrics.json @@ -2,242 +2,242 @@ "name": "Anatomy", "values": [ { - "name": "total all width", + "name": "total width, all", "value": 1861.780517578125, "unit": "\u00b5m" }, { - "name": "total all height", + "name": "total height, all", "value": 1895.6500244140625, "unit": "\u00b5m" }, { - "name": "total all depth", + "name": "total depth, all", "value": 482.4429931640625, "unit": "\u00b5m" }, { - "name": "total all length", + "name": "total length, all", "value": 9755.86140525341, "unit": "\u00b5m" }, { - "name": "total all area", + "name": "total area, all", "value": 16566.01207915532, "unit": "\u00b5m\u00b2" }, { - "name": "total all volume", + "name": "total volume, all", "value": 3161.0971896139317, "unit": "\u00b5m\u00b3" }, { - "name": "average diameter of all", + "name": "average diameter, all", "value": 0.539696595209174, "unit": "\u00b5m" }, { - "name": "number of all sections", + "name": "number of sections, all", "value": 109, "unit": "" }, { - "name": "number of all segments", + "name": "number of segments, all", "value": 1861, "unit": "" }, { - "name": "average all section length", + "name": "average section length, all", "value": 89.5033156445267, "unit": "\u00b5m" }, { - "name": "average all segment length", + "name": "average segment length, all", "value": 5.242268301254316, "unit": "\u00b5m" }, { - "name": "all maximum branch order", + "name": "maximum branch order, all", "value": 11, "unit": "" }, { - "name": "total axon width", + "name": "total width, axon", "value": 1840.931640625, "unit": "\u00b5m" }, { - "name": "total axon height", + "name": "total height, axon", "value": 1469.079345703125, "unit": "\u00b5m" }, { - "name": "total axon depth", + "name": "total depth, axon", "value": 482.4429931640625, "unit": "\u00b5m" }, { - "name": "total axon length", + "name": "total length, axon", "value": 6365.762633562088, "unit": "\u00b5m" }, { - "name": "total axon area", + "name": "total area, axon", "value": 7975.952834655143, "unit": "\u00b5m\u00b2" }, { - "name": "total axon volume", + "name": "total volume, axon", "value": 900.0448369230417, "unit": "\u00b5m\u00b3" }, { - "name": "average diameter of axon", + "name": "average diameter, axon", "value": 0.39878087863997674, "unit": "\u00b5m" }, { - "name": "number of axon sections", + "name": "number of sections, axon", "value": 47, "unit": "" }, { - "name": "number of axon segments", + "name": "number of segments, axon", "value": 1160, "unit": "" }, { - "name": "average axon section length", + "name": "average section length, axon", "value": 135.4417581608955, "unit": "\u00b5m" }, { - "name": "average axon segment length", + "name": "average segment length, axon", "value": 5.4877262925536465, "unit": "\u00b5m" }, { - "name": "axon maximum branch order", + "name": "maximum branch order, axon", "value": 11, "unit": "" }, { - "name": "total apical width", + "name": "total width, apical", "value": 265.4986877441406, "unit": "\u00b5m" }, { - "name": "total apical height", + "name": "total height, apical", "value": 656.1939086914062, "unit": "\u00b5m" }, { - "name": "total apical depth", + "name": "total depth, apical", "value": 138.55718994140625, "unit": "\u00b5m" }, { - "name": "total apical length", + "name": "total length, apical", "value": 1745.9480376243591, "unit": "\u00b5m" }, { - "name": "total apical area", + "name": "total area, apical", "value": 5072.048782169545, "unit": "\u00b5m\u00b2" }, { - "name": "total apical volume", + "name": "total volume, apical", "value": 1471.0559661664934, "unit": "\u00b5m\u00b3" }, { - "name": "average diameter of apical", + "name": "average diameter, apical", "value": 0.922797184065503, "unit": "\u00b5m" }, { - "name": "number of apical sections", + "name": "number of sections, apical", "value": 29, "unit": "" }, { - "name": "number of apical segments", + "name": "number of segments, apical", "value": 400, "unit": "" }, { - "name": "average apical section length", + "name": "average section length, apical", "value": 60.205104745667555, "unit": "\u00b5m" }, { - "name": "average apical segment length", + "name": "average segment length, apical", "value": 4.364870185703039, "unit": "\u00b5m" }, { - "name": "apical maximum branch order", + "name": "maximum branch order, apical", "value": 7, "unit": "" }, { - "name": "total basal width", + "name": "total width, basal", "value": 269.4166259765625, "unit": "\u00b5m" }, { - "name": "total basal height", + "name": "total height, basal", "value": 213.6024169921875, "unit": "\u00b5m" }, { - "name": "total basal depth", + "name": "total depth, basal", "value": 169.44400024414062, "unit": "\u00b5m" }, { - "name": "total basal length", + "name": "total length, basal", "value": 1644.1507340669632, "unit": "\u00b5m" }, { - "name": "total basal area", + "name": "total area, basal", "value": 3518.0104623306333, "unit": "\u00b5m\u00b2" }, { - "name": "total basal volume", + "name": "total volume, basal", "value": 789.9963865243965, "unit": "\u00b5m\u00b3" }, { - "name": "average diameter of basal", + "name": "average diameter, basal", "value": 0.678468805386857, "unit": "\u00b5m" }, { - "name": "number of basal sections", + "name": "number of sections, basal", "value": 33, "unit": "" }, { - "name": "number of basal segments", + "name": "number of segments, basal", "value": 301, "unit": "" }, { - "name": "average basal section length", + "name": "average section length, basal", "value": 49.8227495171807, "unit": "\u00b5m" }, { - "name": "average basal segment length", + "name": "average segment length, basal", "value": 5.4622948006340035, "unit": "\u00b5m" }, { - "name": "basal maximum branch order", + "name": "maximum branch order, basal", "value": 3, "unit": "" }, diff --git a/tests/unit_tests/data/sscx_morphometrics.json b/tests/unit_tests/data/sscx_morphometrics.json index 4069435..49e0bd7 100644 --- a/tests/unit_tests/data/sscx_morphometrics.json +++ b/tests/unit_tests/data/sscx_morphometrics.json @@ -2,62 +2,62 @@ "name": "Anatomy", "values": [ { - "name": "total axon length", + "name": "total length, axon", "value": 6365.762633562088, "unit": "\u00b5m" }, { - "name": "mean axon volume", + "name": "mean volume, axon", "value": 900.0448369230417, "unit": "\u00b5m\u00b3" }, { - "name": "axon maximum branch order", + "name": "maximum branch order, axon", "value": 11, "unit": "" }, { - "name": "axon maximum section length", + "name": "maximum section length, axon", "value": 1622.298583984375, "unit": "\u00b5m" }, { - "name": "total apical length", + "name": "total length, apical", "value": 1745.9480376243591, "unit": "\u00b5m" }, { - "name": "mean apical volume", + "name": "mean volume, apical", "value": 1471.0559661664934, "unit": "\u00b5m\u00b3" }, { - "name": "apical maximum branch order", + "name": "maximum branch order, apical", "value": 7, "unit": "" }, { - "name": "apical maximum section length", + "name": "maximum section length, apical", "value": 386.35589599609375, "unit": "\u00b5m" }, { - "name": "total basal length", + "name": "total length, basal", "value": 1644.1507340669632, "unit": "\u00b5m" }, { - "name": "mean basal volume", + "name": "mean volume, basal", "value": 157.99927730487929, "unit": "\u00b5m\u00b3" }, { - "name": "basal maximum branch order", + "name": "maximum branch order, basal", "value": 3, "unit": "" }, { - "name": "basal maximum section length", + "name": "maximum section length, basal", "value": 130.0713348388672, "unit": "\u00b5m" }, diff --git a/tests/unit_tests/data/thalamus_morphometrics.json b/tests/unit_tests/data/thalamus_morphometrics.json index a103216..8b39bab 100644 --- a/tests/unit_tests/data/thalamus_morphometrics.json +++ b/tests/unit_tests/data/thalamus_morphometrics.json @@ -2,47 +2,47 @@ "name": "Anatomy", "values": [ { - "name": "total axon length", + "name": "total length, axon", "value": 6365.762633562088, "unit": "\u00b5m" }, { - "name": "total axon volume", + "name": "total volume, axon", "value": 900.0448369230417, "unit": "\u00b5m\u00b3" }, { - "name": "axon maximum branch order", + "name": "maximum branch order, axon", "value": 11, "unit": "" }, { - "name": "total apical length", + "name": "total length, apical", "value": 1745.9480376243591, "unit": "\u00b5m" }, { - "name": "total apical volume", + "name": "total volume, apical", "value": 1471.0559661664934, "unit": "\u00b5m\u00b3" }, { - "name": "apical maximum branch order", + "name": "maximum branch order, apical", "value": 7, "unit": "" }, { - "name": "total basal length", + "name": "total length, basal", "value": 1644.1507340669632, "unit": "\u00b5m" }, { - "name": "total basal volume", + "name": "total volume, basal", "value": 789.9963865243965, "unit": "\u00b5m\u00b3" }, { - "name": "basal maximum branch order", + "name": "maximum branch order, basal", "value": 3, "unit": "" }, diff --git a/tests/unit_tests/test_morphology_features.py b/tests/unit_tests/test_morphology_features.py index 9707b6e..18ed8e1 100644 --- a/tests/unit_tests/test_morphology_features.py +++ b/tests/unit_tests/test_morphology_features.py @@ -83,7 +83,7 @@ def test_average_diameter(): morphology, "basal_dendrite", NeuriteType.basal_dendrite ) feature_dict = feature.to_dict() - assert feature_dict["name"] == "average diameter of basal_dendrite" + assert feature_dict["name"] == "average diameter, basal_dendrite" assert abs(feature_dict["value"] - 0.6784688234329224) <= 1e-4 assert feature_dict["unit"] == "\u00b5m" @@ -93,7 +93,7 @@ def test_total_length(): morphology = nm.load_neuron(test_morph) feature = morphology_features.TotalLength(morphology, "axon", NeuriteType.axon) feature_dict = feature.to_dict() - assert feature_dict["name"] == "total axon length" + assert feature_dict["name"] == "total length, axon" assert abs(feature_dict["value"] - 6365.762633562088) <= 1e-3 assert feature_dict["unit"] == "\u00b5m" @@ -103,7 +103,7 @@ def test_total_height(): morphology = nm.load_neuron(test_morph) feature = morphology_features.TotalHeight(morphology, "axon", NeuriteType.axon) feature_dict = feature.to_dict() - assert feature_dict["name"] == "total axon height" + assert feature_dict["name"] == "total height, axon" assert abs(feature_dict["value"] - 1469.0793) <= 1e-4 assert feature_dict["unit"] == "\u00b5m" @@ -113,7 +113,7 @@ def test_total_width(): morphology = nm.load_neuron(test_morph) feature = morphology_features.TotalWidth(morphology, "axon", NeuriteType.axon) feature_dict = feature.to_dict() - assert feature_dict["name"] == "total axon width" + assert feature_dict["name"] == "total width, axon" assert abs(feature_dict["value"] - 1840.9316) <= 1e-4 assert feature_dict["unit"] == "\u00b5m" @@ -123,7 +123,7 @@ def test_total_depth(): morphology = nm.load_neuron(test_morph) feature = morphology_features.TotalDepth(morphology, "axon", NeuriteType.axon) feature_dict = feature.to_dict() - assert feature_dict["name"] == "total axon depth" + assert feature_dict["name"] == "total depth, axon" assert abs(feature_dict["value"] - 482.443) <= 1e-4 assert feature_dict["unit"] == "\u00b5m" @@ -133,7 +133,7 @@ def test_total_area(): morphology = nm.load_neuron(test_morph) feature = morphology_features.TotalArea(morphology, "axon", NeuriteType.axon) feature_dict = feature.to_dict() - assert feature_dict["name"] == "total axon area" + assert feature_dict["name"] == "total area, axon" assert abs(feature_dict["value"] - 7975.952834655143) <= 1e-4 assert feature_dict["unit"] == "\u00b5m\u00b2" @@ -143,7 +143,7 @@ def test_total_volume(): morphology = nm.load_neuron(test_morph) feature = morphology_features.TotalVolume(morphology, "axon", NeuriteType.axon) feature_dict = feature.to_dict() - assert feature_dict["name"] == "total axon volume" + assert feature_dict["name"] == "total volume, axon" assert abs(feature_dict["value"] - 900.0448369230417) <= 1e-4 assert feature_dict["unit"] == "\u00b5m\u00b3" @@ -155,7 +155,7 @@ def test_number_of_sections(): morphology, "basal_dendrite", NeuriteType.basal_dendrite ) feature_dict = feature.to_dict() - assert feature_dict["name"] == "number of basal_dendrite sections" + assert feature_dict["name"] == "number of sections, basal_dendrite" assert feature_dict["value"] == 33 assert feature_dict["unit"] == "" @@ -167,7 +167,7 @@ def test_mean_neurite_volumes(): morphology, "axon", NeuriteType.axon ) feature_dict = feature.to_dict() - assert feature_dict["name"] == "mean axon volume" + assert feature_dict["name"] == "mean volume, axon" assert abs(feature_dict["value"] - 900.0448369230417) <= 1e-3 assert feature_dict["unit"] == "\u00b5m\u00b3" @@ -179,7 +179,7 @@ def test_max_branch_order(): morphology, "apical_dendrite", NeuriteType.apical_dendrite ) feature_dict = feature.to_dict() - assert feature_dict["name"] == "apical_dendrite maximum branch order" + assert feature_dict["name"] == "maximum branch order, apical_dendrite" assert feature_dict["value"] == 7 assert feature_dict["unit"] == "" @@ -191,7 +191,7 @@ def test_max_section_length(): morphology, "basal_dendrite", NeuriteType.basal_dendrite ) feature_dict = feature.to_dict() - assert feature_dict["name"] == "basal_dendrite maximum section length" + assert feature_dict["name"] == "maximum section length, basal_dendrite" assert abs(feature_dict["value"] - 130.07133) <= 1e-5 assert feature_dict["unit"] == "\u00b5m"