diff --git a/.ci/test_circuit1k_s2s_nodesets.sh b/.ci/test_circuit1k_s2s_nodesets.sh index 5d76913..4fd4fc1 100644 --- a/.ci/test_circuit1k_s2s_nodesets.sh +++ b/.ci/test_circuit1k_s2s_nodesets.sh @@ -18,4 +18,4 @@ parquet-compare-ns \ ${CIRCUIT%circuit_config.json}nodes.h5 \ $BASE/touches/structural/circuit.parquet \ circuit.parquet \ - 4 + 0 diff --git a/.ci/test_circuit1k_spines.sh b/.ci/test_circuit1k_spines.sh new file mode 100644 index 0000000..2d437bf --- /dev/null +++ b/.ci/test_circuit1k_spines.sh @@ -0,0 +1,22 @@ +export BASE=$DATADIR/cellular/circuit-1k/ +export CIRCUIT=$BASE/circuit_config.json +export RECIPE=$BASE/bioname/recipe.json +export TOUCHES=$BASE/touches/parquet/*.parquet + +srun dplace functionalizer \ + -H \ + --filters SynapseProperties,SpineMorphologies \ + --output-dir="$PWD" \ + --checkpoint-dir="$PWD" \ + --circuit-config=$CIRCUIT \ + --recipe=$RECIPE \ + -- $TOUCHES + +python << EOF +import numpy as np +import pandas as pd +df = pd.read_parquet("circuit.parquet") +assert len(df["spine_morphology"].unique()) > 1 +assert set(df["spine_psd_id"].unique()) == set([-1, 0, 1]) +assert np.all(df["spine_sharing_id"] == -1) # currently not yet implemented +EOF diff --git a/src/functionalizer/filters/implementations/spine_morphologies.py b/src/functionalizer/filters/implementations/spine_morphologies.py index 9101759..1b1852e 100644 --- a/src/functionalizer/filters/implementations/spine_morphologies.py +++ b/src/functionalizer/filters/implementations/spine_morphologies.py @@ -54,7 +54,7 @@ def __init__(self, recipe, source, target): """Initializes the filter using the morphology database.""" super().__init__(recipe, source, target) self._morphologies, self._filter = _create_spine_morphology_udf( - recipe.spine_morphologies.path + target.spine_morphology_path ) def apply(self, circuit): diff --git a/src/functionalizer/io/circuit.py b/src/functionalizer/io/circuit.py index 71019fb..7e972f0 100644 --- a/src/functionalizer/io/circuit.py +++ b/src/functionalizer/io/circuit.py @@ -293,6 +293,10 @@ def __init__(self, circuit_config: str, population: str, nodeset: str, cache: st self.morphologies = MorphologyDB( pop_prop.alternate_morphology_formats.get("h5v1", pop_prop.morphologies_dir) ) + if pop_prop.spine_morphologies_dir: + self.spine_morphology_path = Path(pop_prop.spine_morphologies_dir) + else: + self.spine_morphology_path = None if not os.path.isdir(self._cache): os.makedirs(self._cache)