# Validation & testing¶

## Comparison with L-Measure¶

Btmorph is compared to the “golden standard” L-Measure through the publicly available data at NeuroMorpo.org.

In most cases the results obtained with the btmorph library are similar; there are some slight differences that reflect slight implementation details and some measures are interpreted differently; implementation details of L-Measure can be found (here) and the meaning of the morphometrics displayed on NeuroMorpho.org are explained here.

We explain the similarities and differences by means of an exemplar analysis performed on one morphology: v_e_moto1 (from here).

Morphometric feature NeuroMorpho.org btmorph
Soma Surface 45216 μm2 45238 μm2 [1]
# Stems 10 10
# Bifurcations 122 122
# Branches 254 254 [2]
Overall Width 1804.67 μm 2588.0 μm [3]
Overall Height 2259.98 μm 2089.0 μm [3]
Overall Depth 1701.72 μm 2306.0 μm [3]
Average Diameter 2.2 μm 2.2 μm [4]
Total Length 78849.1 μm 78849.1 μm
Total Surface 512417 μm2 512417 μm2
Total Volume 390413 μm3 390412 μm3
Max Euclidean Distance 765.73 μm 1531 μm [5]
Max Path Distance 873.56 μm 1817 μm [6]
Max Branch Order 3.69 3.83 [7]
Average Contraction 0.94 0.9359 [8]
Total Fragmentation 559 599 [9]
Partition Asymmetry 0.43 0.43 [10]
Average Rall’s Ratio 1.25 1.25
Average Bifurcation Angle Local 46.83° 46.83°
Average Bifurcation Angle Remote 45.74° 45.7 °
 [1] In accordance with the three-point soma format, the somatic surface is computed as $$A = 4 \times \pi \times r^2$$.
 [2] Computed by stats.no_bifurcations() + stats.no_terminals()
 [3] (1, 2, 3) We compute the raw, untranslated extend in X,Y and Z dimension. This is different from aligning the axis with the first three principal components and including 95% of the data as is done in L-Measure and NeuroMorpho.org.
 [4] Computed by np.mean(stats.get_diameters())
 [5] (1, 2) Unclear how the NeuroMorpho.org value is generated. We compute the euclidean distance between each terminal point and the soma. A visual inspection shows that our value is correct.
 [6] See [5]
 [7] This is actually not the maximum as listed on the NeuroMorpho website but the average of either all points, or the bifurcation points.
 [8] Computed as follows:
eds = []
pls = []
for node in stats._end_points:
eds.append(stats.get_segment_Euclidean_length(node))
pls.append(stats.get_segment_pathlength(node))
mean(array(eds)/array(pls))

 [9] The fragmentation can be computed by len(stats._all_nodes)-3, where 3 is subtracted to discount the three soma points.
 [10] Computed as follows:
pas = []
for node in stats._bif_points:
pas.append(stats.partition_asymmetry(node))
mean(pas)


## Unit testing¶

Unit-testing refers to testing of elementary pieces of code in a computer program (Wikipedia). Testing is done using the Python testing framework, called nose tests. In these tests, we compare the outcome of our library to similar outcomes generated by L-Measure that are accessible through the NeuroMorpho.org website. Note that there are some differences in design and definition of the features as listed Comparison with L-Measure.

Unit-tests of this library are provided in the tests directory and can be run by

nosetests -v tests/stats_test.py
nosetests -v --nocapture tests/structs_test.py


Note

Run the unit-tests after change to the code to ensure a) backward compatibility and b) correctness of the results.