import colorcet import matplotlib.animation as animation from collections import Counter import sys import tristan_tools.analysis as analysis import signal signal.signal(signal.SIGINT, signal.SIG_DFL) from mpl_toolkits.axes_grid1 import make_axes_locatable import gc analyzer = analysis.TristanDataAnalyzer(analyzer_path + 'output') os.makedirs(analyzer_path + 'plots/', exist_ok=1) def plot_gamma_spectra2(analyzer, axarr, timesteps): print(timesteps) max_gammas = np.zeros((2, len(timesteps))) mean_gammas = np.zeros((2, len(timesteps))) times = np.zeros(len(timesteps)) for j in range(len(timesteps)): timestep = timesteps[j] print(timestep)
import matplotlib.pyplot as plt import tristan_tools.analysis as analysis import os output_path_3d = '../test_data/user_beam_on_background_3d/output/' output_path = output_path_3d os.path.expanduser(output_path) analyzer = analysis.TristanDataAnalyzer(output_path) plot_time = 0 analyzer.load_indices(plot_time) analyzer.compute_indices(plot_time) analyzer.print_shapes(plot_time) plotter = analysis.TristanDataPlotter(analyzer, plot_type='hist1d', keys=['PP_e_spec']) print(plotter.plotter.data) ax = plt.axes() plotter.set_plotter_canvas(ax) plotter.plot_timestep(plot_time) plotter.timestep = plot_time + 1 plotter.plot_timestep(plot_time)
import tristan_tools.analysis as analysis import signal signal.signal(signal.SIGINT, signal.SIG_DFL) from mpl_toolkits.axes_grid1 import make_axes_locatable import gc os.makedirs( './plots/', exist_ok = 1 ) analyzer = analysis.TristanDataAnalyzer( './output' ) downsample = 1 if len( sys.argv ) > 1 : downsample = int( sys.argv[1] ) load = 1 if len( sys.argv ) > 2 : load = int( sys.argv[2] )
# check if there's a directory called 'output' in cwd else: tmp = os.path.join(cwd, 'output') if os.path.exists(tmp): data_path = tmp else: data_path = None if data_path: print('INFO: found data at path: %s' % data_path) else: print('ERROR: did not find tristan output data path') sys.exit(0) # set the type of analyzer to be used in the gui_config.py analyzer = analysis.TristanDataAnalyzer(data_path) timestep = 1 analyzer.load_indices([timestep], keys='dens') print([x for x in analyzer.data]) print(type(analyzer.data)) # source = mlab.pipeline.vector_field( * data ) print(analyzer.data.dens[timestep]) plot = mlab.pipeline.scalar_cut_plane(analyzer.data.dens[1], plane_orientation='z_axes')