def test_read(): try: fd, temp_file = tempfile.mkstemp('test_neurolucida') os.close(fd) with open(temp_file, 'w') as fd: fd.write(MORPH_ASC) rdw = nasc.read(temp_file) raw_data = rdw.data_block eq_(raw_data.shape, (19, 7)) ok_(np.allclose(raw_data[:, COLS.ID], np.arange(0, 19))) # correct ID # 3 is ID of end of the soma, 2 sections attach to this ok_(np.count_nonzero(raw_data[:, COLS.P] == 3), 2) finally: os.remove(temp_file)
def read_neurolucida(filename): '''Lazy loading of Neurolucida ASCII reader''' from neurom.io import neurolucida return neurolucida.read(filename, data_wrapper=DataWrapper)