def test05_plot(self): path = site.getsitepackages()[0] + '/SPHARM/tests/' fn = path + 'data/synthetic_cell.txt' surf = Surface(filename=fn) with warnings.catch_warnings(): warnings.simplefilter("ignore") mesh = surf.plot_points() os.makedirs('data/test_data') mesh.save('data/test_data/points_3D.png', size=(200, 200)) surf.centrate() surf.to_spherical() surf.Rgrid = surf.interpolate(grid_size=100) with warnings.catch_warnings(): warnings.simplefilter("ignore") mesh = surf.plot_surface(points=False) mesh.save('data/test_data/surface_3D.png', size=(200, 200)) with warnings.catch_warnings(): warnings.simplefilter("ignore") mesh = surf.plot_surface(points=True) mesh.save('data/test_data/surface_with_points_3D.png', size=(200, 200)) self.assertEqual(os.path.exists('data/test_data/surface_3D.png'), True) self.assertEqual(os.path.exists('data/test_data/points_3D.png'), True) self.assertEqual( os.path.exists('data/test_data/surface_with_points_3D.png'), True) shutil.rmtree('data/test_data/')
path += '/' path += 'output/' track_stat = pd.DataFrame() summary_stat = pd.DataFrame() groups = os.listdir(path + 'surfaces/') for gr in groups: print(gr) files = os.listdir(path + 'surfaces/' + gr + '/') for fn in files: stat = pd.read_csv(path + 'surfaces/' + gr + '/' + fn, sep='\t', index_col=0) t1 = stat['Time'].unique()[0] stat = stat[stat['Time'] == t1] print(fn, len(stat)) surface = Surface(data=stat) mesh = surface.plot_points(scale_factor=0.2) filelib.make_folders([os.path.dirname(path + 'surface_plots/' + gr + '_' + fn[:-4])]) mesh.save(path + 'surface_plots/' + gr + '_' + fn[:-4] + '_init.png', size=(100, 100)) mlab.clf() surface.centrate() surface.to_spherical() surface.compute_spharm(grid_size=120, normalize=True) mesh = surface.plot_surface(points=False) filelib.make_folders([os.path.dirname(path + 'surface_plots/' + gr + '_' + fn[:-4])]) mesh.save(path + 'surface_plots/' + gr + '_' + fn[:-4] + '_grid.png', size=(100, 100)) mlab.clf() surface.inverse_spharm(lmax=10) mesh = surface.plot_surface(points=False) filelib.make_folders([os.path.dirname(path + 'surface_plots/' + gr + '_' + fn[:-4])])