예제 #1
0
    def test_get_segment_lengths(self):
        _equal(_nrt.segment_lengths(self.sec_nrn.neurites[0]),
               get('segment_lengths', self.ref_nrn.neurites[0]))

        _equal(_nrt.segment_lengths(self.sec_nrn), get('segment_lengths', self.ref_nrn))
        for t in NeuriteType:
            _equal(_nrt.segment_lengths(self.sec_nrn, neurite_type=t),
                   get('segment_lengths', self.ref_nrn, neurite_type=t))
예제 #2
0
    def test_get_n_sections(self):
        nt.assert_equal(_nrt.n_sections(self.sec_nrn.neurites[0]),
                        get('number_of_sections', self.ref_nrn.neurites[0])[0])

        nt.assert_equal(_nrt.n_sections(self.sec_nrn), get('number_of_sections', self.ref_nrn)[0])
        for t in NeuriteType:
            nt.assert_equal(_nrt.n_sections(self.sec_nrn, neurite_type=t),
                            get('number_of_sections', self.ref_nrn, neurite_type=t)[0])
    def test_get_segment_midpoint(self):

        for ntyp in nm.NEURITE_TYPES:
            pts = fst.get('segment_midpoints', self.fst_pop, neurite_type=ntyp)
            ref_xyz = (get('segment_x_coordinates', self.ref_pop, neurite_type=ntyp),
                       get('segment_y_coordinates', self.ref_pop, neurite_type=ntyp),
                       get('segment_z_coordinates', self.ref_pop, neurite_type=ntyp))

            for i in xrange(3):
                _equal(pts[:, i], ref_xyz[i])
예제 #4
0
    def test_get_section_radial_distances(self):
        _close(_nrt.section_radial_distances(self.sec_nrn.neurites[0]),
               get('section_radial_distances', self.ref_nrn.neurites[0]))

        _close(_nrt.section_radial_distances(self.sec_nrn),
               get('section_radial_distances', self.ref_nrn))

        for t in NeuriteType:
            _close(_nrt.section_radial_distances(self.sec_nrn, neurite_type=t),
                   get('section_radial_distances', self.ref_nrn, neurite_type=t))
예제 #5
0
    def test_get_n_sections_per_neurite(self):
        _equal(_nrt.n_sections_per_neurite(self.sec_nrn.neurites[0]),
               get('number_of_sections_per_neurite', self.ref_nrn.neurites[0]))

        _equal(_nrt.n_sections_per_neurite(self.sec_nrn),
               get('number_of_sections_per_neurite', self.ref_nrn))

        for t in NeuriteType:
            _equal(_nrt.n_sections_per_neurite(self.sec_nrn, neurite_type=t),
                   get('number_of_sections_per_neurite', self.ref_nrn, neurite_type=t))
예제 #6
0
    def test_get_section_path_distances(self):
        _close(_nrt.section_path_lengths(self.sec_nrn.neurites[0]),
               get('section_path_distances', self.ref_nrn.neurites[0]))

        _close(_nrt.section_path_lengths(self.sec_nrn), get('section_path_distances', self.ref_nrn))
        for t in NeuriteType:
            _close(_nrt.section_path_lengths(self.sec_nrn, neurite_type=t),
                   get('section_path_distances', self.ref_nrn, neurite_type=t))

        pl = [_sec.section_path_length(s) for s in i_chain2(self.sec_nrn_trees)]
        _close(pl, get('section_path_distances', self.ref_nrn))
예제 #7
0
    def test_get_remote_bifurcation_angles(self):
        _close(_nrt.remote_bifurcation_angles(self.sec_nrn.neurites[0]),
               get('remote_bifurcation_angles', self.ref_nrn.neurites[0]))

        _close(_nrt.remote_bifurcation_angles(self.sec_nrn),
               get('remote_bifurcation_angles', self.ref_nrn))

        for t in NeuriteType:
            _close(_nrt.remote_bifurcation_angles(self.sec_nrn, neurite_type=t),
                   get('remote_bifurcation_angles', self.ref_nrn, neurite_type=t))

        ba = [_bf.remote_bifurcation_angle(b)
              for b in i_chain2(self.sec_nrn_trees, iterator_type=Tree.ibifurcation_point)]

        _close(ba, get('remote_bifurcation_angles', self.ref_nrn))
    def _check_neurite_feature(self, ftr, debug=False, rtol=1e-05, atol=1e-08):
        self._check_neuron_feature(ftr, debug, rtol, atol)

        for t in NeuriteType:
            _close(fst.get(ftr, self.fst_pop, neurite_type=t),
                   get(ftr, self.ref_pop, neurite_type=t), debug, rtol, atol)
 def _check_neuron_feature(self, ftr, debug=False, rtol=1e-05, atol=1e-08):
     _close(fst.get(ftr, self.fst_pop), get(ftr, self.ref_pop),
            debug, rtol, atol)
예제 #10
0
 def test_get_trunk_section_lengths(self):
     _equal(_nrn.trunk_section_lengths(self.sec_nrn), get('trunk_section_lengths', self.ref_nrn))
     for t in NeuriteType:
         _equal(_nrn.trunk_section_lengths(self.sec_nrn, neurite_type=t),
                get('trunk_section_lengths', self.ref_nrn, neurite_type=t))
예제 #11
0
 def test_get_trunk_origin_radii(self):
     _equal(fst._nrn.trunk_origin_radii(self.sec_nrn), get('trunk_origin_radii', self.ref_nrn))
     for t in NeuriteType:
         _equal(_nrn.trunk_origin_radii(self.sec_nrn, neurite_type=t),
                get('trunk_origin_radii', self.ref_nrn, neurite_type=t))
예제 #12
0
 def test_get_soma_surface_area(self):
     nt.assert_equal(fst._nrn.soma_surface_area(self.sec_nrn), get('soma_surface_areas', self.ref_nrn)[0])
예제 #13
0
 def test_get_soma_radius(self):
     nt.assert_equal(self.sec_nrn.soma.radius, get('soma_radii', self.ref_nrn)[0])
예제 #14
0
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

'''Compatibility between NL and H5 files'''
import numpy as np
from neurom.point_neurite.io.utils import load_neuron
from neurom.point_neurite.features import get
from neurom import log  # pylint: disable=unused-import


nrn_h5 = load_neuron('test_data/h5/v1/bio_neuron-001.h5')
nrn_asc = load_neuron('test_data/neurolucida/bio_neuron-001.asc')

print 'h5 number of sections: %s' % get('number_of_sections', nrn_h5)[0]
print 'nl number of sections: %s\n' % get('number_of_sections', nrn_asc)[0]
print 'h5 number of segments: %s' % get('number_of_segments', nrn_h5)[0]
print 'nl number of segments: %s\n' % get('number_of_segments', nrn_asc)[0]
print 'h5 total neurite surface area: %s' % np.sum(get('section_areas', nrn_h5))
print 'nl total neurite surface area: %s\n' % np.sum(get('section_areas', nrn_asc))
print 'h5 total neurite volume: %s' % np.sum(get('section_volumes', nrn_h5))
print 'nl total neurite volume: %s\n' % np.sum(get('section_volumes', nrn_asc))
print 'h5 total neurite length: %s' % np.sum(get('section_lengths', nrn_h5))
print 'nl total neurite length: %s\n' % np.sum(get('section_lengths', nrn_asc))