Exemplo n.º 1
0
def test_i_section_path_length():
    T1 = SIMPLE_TREE
    T2 = NEURON_TREE

    nt.assert_equal([d for d in i_section_path_length(T1)],
                    [8.0, 8.0])

    nt.assert_equal([d for d in i_section_path_length(T1, use_start_point=True)],
                    [0.0, 0.0])

    nt.assert_equal([d for d in i_section_path_length(T2)], [5.0, 9.0, 9.0])

    nt.assert_equal([d for d in i_section_path_length(T2, use_start_point=True)],
                    [0.0, 5.0, 5.0])
Exemplo n.º 2
0
    def test_get_section_path_distances_endpoint(self):
        ref_sec_path_len_start = []
        for t in self.neuron.neurites:
            ref_sec_path_len_start.extend(
                ll for ll in i_section_path_length(t, use_start_point=True))

        ref_sec_path_len = []
        for t in self.neuron.neurites:
            ref_sec_path_len.extend(ll for ll in i_section_path_length(t))

        path_lengths = self.neuron.get_section_path_distances()
        nt.assert_true(ref_sec_path_len != ref_sec_path_len_start)
        nt.assert_equal(len(path_lengths), 84)
        nt.assert_true(np.all(path_lengths == ref_sec_path_len))
Exemplo n.º 3
0
    def test_get_section_path_distances_endpoint(self):
        ref_sec_path_len_start = []
        for t in self.neuron.neurites:
            ref_sec_path_len_start.extend(
                ll for ll in i_section_path_length(t, use_start_point=True))

        ref_sec_path_len = []
        for t in self.neuron.neurites:
            ref_sec_path_len.extend(ll for ll in i_section_path_length(t))

        path_lengths = self.neuron.get_section_path_distances()
        nt.assert_true(ref_sec_path_len != ref_sec_path_len_start)
        nt.assert_equal(len(path_lengths), 84)
        nt.assert_true(np.all(path_lengths == ref_sec_path_len))
Exemplo n.º 4
0
    def get_section_path_distances(self, use_start_point=False,
                                   neurite_type=TreeType.all):
        '''
        Get section path distances of all neurites of a given type
        The section path distance is measured to the neurite's root.

        Parameters:
            use_start_point: boolean\
            if true, use the section's first point,\
            otherwise use the end-point (default False)
            neurite_type: TreeType\
            Type of neurites to be considered (default all)

        Returns:
            Iterable containing the section path distances.
        '''
        return self.neurite_loop(lambda t: i_section_path_length(t, use_start_point),
                                 neurite_type=neurite_type)
Exemplo n.º 5
0
    def get_section_path_distances(self,
                                   use_start_point=False,
                                   neurite_type=TreeType.all):
        '''
        Get section path distances of all neurites of a given type
        The section path distance is measured to the neurite's root.

        Parameters:
            use_start_point: boolean\
            if true, use the section's first point,\
            otherwise use the end-point (default False)
            neurite_type: TreeType\
            Type of neurites to be considered (default all)

        Returns:
            Iterable containing the section path distances.
        '''
        return self.neurite_loop(
            lambda t: i_section_path_length(t, use_start_point),
            neurite_type=neurite_type)