def test_apical_point_smoothed(): p1 = analysis.load_file(neuron_ph_1_file) p2 = analysis.load_file(neuron_ph_2_file) ap1 = analysis.find_apical_point_distance_smoothed(p1, threshold=0.1) ap2 = analysis.find_apical_point_distance_smoothed(p2, threshold=0.1) assert_almost_equal(ap1, 355.1980697442, decimal=5) assert_almost_equal(ap2, 199.5273018308, decimal=5)
def test_apical_point(): p1 = analysis.load_file(neuron_ph_1_file) p2 = analysis.load_file(neuron_ph_2_file) ap1 = analysis.find_apical_point_distance(p1) ap2 = analysis.find_apical_point_distance(p2) assert_almost_equal(ap1, 413.2151457659, decimal=5) assert_almost_equal(ap2, 335.8844214625, decimal=5)
def test_load_file(): f0 = analysis.load_file(sample_ph_0_file) f1 = analysis.load_file(sample_ph_1_file) nt.ok_( np.allclose( f0, np.array([[12.24744871, 11.18033989], [11.18033989, 10.], [12.24744871, 0.]]))) nt.ok_(np.allclose(f1, np.array([[11.18033989, 10.], [11.18033989, 0.]])))
def test_extract_persistence_diagram(): import filecmp if os.path.isfile('test_ph.txt'): os.remove('test_ph.txt') methods.extract_ph(tree0, output_file='./test_ph.txt') ph_file = analysis.load_file('./test_ph.txt') ph_0 = analysis.load_file(sample_ph_0) nt.ok_(np.allclose(ph_file, ph_0)) os.remove('test_ph.txt')
def test_distance_stepped(): f0 = analysis.load_file(sample_ph_0_file) f1 = analysis.load_file(sample_ph_1_file) nt.ok_(analysis.distance_stepped(f0, f0) == 0.0) nt.ok_(analysis.distance_stepped(f0, f0, order=1) == 0.0) nt.ok_(analysis.distance_stepped(f0, f0, order=2) == 0.0) nt.ok_(np.allclose(analysis.distance_stepped(f0, f1), 34.01795854515)) nt.ok_( np.allclose(analysis.distance_stepped(f0, f1, order=1), 34.01795854515)) nt.ok_( np.allclose(analysis.distance_stepped(f0, f1, order=2), 25.71017265966))