ocelot.gui.genesis_plot

user interface for viewing genesis simulation results

Module Contents

Classes

Display

Functions

plot_gen_out_all_paral(exp_dir, stage=1, savefig='png', debug=1)

plot_gen_out_all(handle=None, savefig='png', showfig=False, choice='all', vartype_dfl=complex128, debug=1, *args, **kwargs)

plots all possible output from the genesis output

plot_gen_out_z(g, z=np.inf, params=['rad_power+el_current', 'el_energy+el_espread+el_bunching', 'rad_spec'], figsize=3.5, x_units='um', y_units='ev', legend=False, fig_name=None, savefig=False, showfig=True, debug=1, *args, **kwargs)

radiation parameters at distance z

subfig_z_power_curr(ax_curr, g, zi=None, x_units='um', legend=False, *args, **kwargs)

subfig_z_energy_espread_bunching(ax_energy, g, zi=None, x_units='um', legend=False, *args, **kwargs)

subfig_z_energy_espread(ax_energy, g, zi=None, x_units='um', legend=False, *args, **kwargs)

subfig_z_phase(ax_phase, g, zi=None, x_units='um', legend=False, *args, **kwargs)

subfig_z_spec(ax_spectrum, g, zi=None, y_units='ev', estimate_ph_sp_dens=True, legend=False, *args, **kwargs)

plot_gen_out_z_old(g, figsize=(10, 14), x_units='um', y_units='ev', legend=True, fig_name=None, z=inf, savefig=False, showfig=1, debug=1, **kwargs)

plot_gen_out_e(g, legend=False, figsize=4, fig_name='Electrons', savefig=False, showfig=True, debug=1, *args, **kwargs)

plot_gen_out_ph(g, legend=False, figsize=4, fig_name='Radiation', savefig=False, showfig=True, debug=1, *args, **kwargs)

plot_gen_out_slip(g, legend=False, figsize=4, fig_name='Slippage', savefig=False, showfig=True, debug=1, *args, **kwargs)

plot_gen_out_evo(g, params=['und_quad', 'el_size', 'el_pos', 'el_energy', 'el_bunching', 'rad_pow_en_log', 'rad_pow_en_lin', 'rad_spec_log', 'rad_size', 'rad_spec_evo_n', 'rad_pow_evo_n'], figsize=4, legend=False, fig_name='', savefig=False, showfig=True, debug=1, *args, **kwargs)

plots evolution of given parameters from genesis output with undulator length

subfig_evo_und_quad(ax_und, g, legend, **kwargs)

subfig_evo_und(ax_und, g, legend, **kwargs)

subfig_evo_el_size(ax_size_tsize, g, legend, which='both', **kwargs)

subfig_evo_el_pos(ax_size_tpos, g, legend, which='both', **kwargs)

subfig_evo_el_energy(ax_energy, g, legend, **kwargs)

subfig_evo_el_bunching(ax_bunching, g, legend, harm=1, **kwargs)

subfig_evo_rad_pow_en(ax_rad_pow, g, legend, log=1, **kwargs)

subfig_evo_rad_pow(ax_rad_pow, g, legend, log=1, **kwargs)

subfig_evo_rad_spec(ax_spectrum, g, legend, log=1, **kwargs)

subfig_rad_size(ax_size_t, g, legend, **kwargs)

subfig_evo_rad_pow_sz(ax_power_evo, g, legend, norm=1, **kwargs)

subfig_evo_rad_spec_sz(ax_spectrum_evo, g, legend, norm=1, **kwargs)

plot_gen_out_scanned_z(g, figsize=(10, 14), legend=True, fig_name=None, z=inf, savefig=False)

plot_gen_stat(proj_dir, run_inp=[], stage_inp=[], param_inp=[], s_param_inp=['p_int', 'pulse_energy', 'r_size_weighted', 'spec', 'spec_phot_density', 'error'], z_param_inp=['p_int', 'phi_mid_disp', 'spec', 'spec_phot_density', 'bunching', 'wigner'], dfl_param_inp=['dfl_spec'], run_param_inp=['p_int', 'spec', 'spec_phot_density', 'pulse_energy'], s_inp=['max'], z_inp=[0, 'end'], run_s_inp=['max'], run_z_inp=['end'], spec_pad=1, savefig=1, saveval=1, showfig=0, debug=1)

The routine for plotting the statistical info of many GENESIS runs

plot_gen_corr(proj_dir, run_inp=[], p1=(), p2=(), savefig=False, showfig=True, saveval=False)

plot_dpa_bucket_out(out, dpa=None, slice_pos='max_I', repeat=1, GeV=1, figsize=4, cmap=def_cmap, scatter=True, energy_mean=None, legend=True, fig_name=None, savefig=False, showfig=True, bins=[50, 50], debug=1)

plot_dpa_bucket(dpa, slice_num=None, repeat=1, GeV=1, figsize=4, cmap=def_cmap, scatter=False, energy_mean=None, legend=True, fig_name=None, savefig=False, showfig=True, suffix='', bins=(50, 50), debug=1, return_mode_gamma=0)

plot_edist(edist, figsize=4, fig_name=None, savefig=False, showfig=True, scatter=False, plot_x_y=True, plot_xy_s=True, bins=(50, 50, 50, 50), flip_t=False, x_units='um', y_units='ev', cmin=0, y_offset=None, cmap=def_cmap, debug=1)

read_plot_dump_proj(exp_dir, stage, run_ids, plot_phase=1, showfig=True, savefig=0, debug=1)

show_output(g, show_field=False, show_slice=0)

show_plots(displays, fig)

putting arbitrarily many plots on single figure

ocelot.gui.genesis_plot._logger
ocelot.gui.genesis_plot.__author__ = Svitozar Serkez
ocelot.gui.genesis_plot.plot_gen_out_all_paral(exp_dir, stage=1, savefig='png', debug=1)
ocelot.gui.genesis_plot.plot_gen_out_all(handle=None, savefig='png', showfig=False, choice='all', vartype_dfl=complex128, debug=1, *args, **kwargs)

plots all possible output from the genesis output handle is either:

genesis output object path to genesis output file path to folders with genesis output files

choice=(1,1,1,1,6.05,1,0,0,0,0,0)

0 1 2 3 4 5 6 7 8 9 10

0 - electron evolution 1 - radiation evolution 2 - profile at z=0m 3 - profile at the end 4 - profile every m meters 5 - dfl at the end, space -time domain 6 - inv.space-time domain 7 - space -frequency domain 8 - inv.space-frequency domain 9 - dpa as edist at the end, smeared 10 - dpa as edist at the end, not smeared 11 - wigner distribution at end, 12 - ebeam bucket at max power

#picks as an input “GenesisOutput” object, file path of directory as strings. #plots e-beam evolution, radiation evolution, initial and final simulation window #If folder path is provided, all *.gout and *.out files are plotted

ocelot.gui.genesis_plot.plot_gen_out_z(g, z=np.inf, params=['rad_power+el_current', 'el_energy+el_espread+el_bunching', 'rad_spec'], figsize=3.5, x_units='um', y_units='ev', legend=False, fig_name=None, savefig=False, showfig=True, debug=1, *args, **kwargs)

radiation parameters at distance z g/out = GenesisOutput() object z distance along undulator [m] params = parameters of interest:

‘rad_power+el_current’ - radiation power and electron beam current ‘el_energy+el_espread+el_bunching’ - electron beam energy +/- spread and bunching ‘rad_phase’ - phase of radiation ‘rad_spec’ - on-axis spectrum

out_z_params overrides params figsize - np.size of figure (unit-less) x_units - units of time domain (‘um’ of ‘fs’) y_units - units of frequency domain (‘nm’ of ‘ev’) legend - plot legend - tbd fig_name - override figure name savefig - save figure showfig - show figure showtext - print text with additional info

ocelot.gui.genesis_plot.subfig_z_power_curr(ax_curr, g, zi=None, x_units='um', legend=False, *args, **kwargs)
ocelot.gui.genesis_plot.subfig_z_energy_espread_bunching(ax_energy, g, zi=None, x_units='um', legend=False, *args, **kwargs)
ocelot.gui.genesis_plot.subfig_z_energy_espread(ax_energy, g, zi=None, x_units='um', legend=False, *args, **kwargs)
ocelot.gui.genesis_plot.subfig_z_phase(ax_phase, g, zi=None, x_units='um', legend=False, *args, **kwargs)
ocelot.gui.genesis_plot.subfig_z_spec(ax_spectrum, g, zi=None, y_units='ev', estimate_ph_sp_dens=True, legend=False, *args, **kwargs)
ocelot.gui.genesis_plot.plot_gen_out_z_old(g, figsize=10, 14, x_units='um', y_units='ev', legend=True, fig_name=None, z=inf, savefig=False, showfig=1, debug=1, **kwargs)
ocelot.gui.genesis_plot.plot_gen_out_e(g, legend=False, figsize=4, fig_name='Electrons', savefig=False, showfig=True, debug=1, *args, **kwargs)
ocelot.gui.genesis_plot.plot_gen_out_ph(g, legend=False, figsize=4, fig_name='Radiation', savefig=False, showfig=True, debug=1, *args, **kwargs)
ocelot.gui.genesis_plot.plot_gen_out_slip(g, legend=False, figsize=4, fig_name='Slippage', savefig=False, showfig=True, debug=1, *args, **kwargs)
ocelot.gui.genesis_plot.plot_gen_out_evo(g, params=['und_quad', 'el_size', 'el_pos', 'el_energy', 'el_bunching', 'rad_pow_en_log', 'rad_pow_en_lin', 'rad_spec_log', 'rad_size', 'rad_spec_evo_n', 'rad_pow_evo_n'], figsize=4, legend=False, fig_name='', savefig=False, showfig=True, debug=1, *args, **kwargs)

plots evolution of given parameters from genesis output with undulator length

ocelot.gui.genesis_plot.subfig_evo_und_quad(ax_und, g, legend, **kwargs)
ocelot.gui.genesis_plot.subfig_evo_und(ax_und, g, legend, **kwargs)
ocelot.gui.genesis_plot.subfig_evo_el_size(ax_size_tsize, g, legend, which='both', **kwargs)
ocelot.gui.genesis_plot.subfig_evo_el_pos(ax_size_tpos, g, legend, which='both', **kwargs)
ocelot.gui.genesis_plot.subfig_evo_el_energy(ax_energy, g, legend, **kwargs)
ocelot.gui.genesis_plot.subfig_evo_el_bunching(ax_bunching, g, legend, harm=1, **kwargs)
ocelot.gui.genesis_plot.subfig_evo_rad_pow_en(ax_rad_pow, g, legend, log=1, **kwargs)
ocelot.gui.genesis_plot.subfig_evo_rad_pow(ax_rad_pow, g, legend, log=1, **kwargs)
ocelot.gui.genesis_plot.subfig_evo_rad_spec(ax_spectrum, g, legend, log=1, **kwargs)
ocelot.gui.genesis_plot.subfig_rad_size(ax_size_t, g, legend, **kwargs)
ocelot.gui.genesis_plot.subfig_evo_rad_pow_sz(ax_power_evo, g, legend, norm=1, **kwargs)
ocelot.gui.genesis_plot.subfig_evo_rad_spec_sz(ax_spectrum_evo, g, legend, norm=1, **kwargs)
ocelot.gui.genesis_plot.plot_gen_out_scanned_z(g, figsize=10, 14, legend=True, fig_name=None, z=inf, savefig=False)
ocelot.gui.genesis_plot.plot_gen_stat(proj_dir, run_inp=[], stage_inp=[], param_inp=[], s_param_inp=['p_int', 'pulse_energy', 'r_size_weighted', 'spec', 'spec_phot_density', 'error'], z_param_inp=['p_int', 'phi_mid_disp', 'spec', 'spec_phot_density', 'bunching', 'wigner'], dfl_param_inp=['dfl_spec'], run_param_inp=['p_int', 'spec', 'spec_phot_density', 'pulse_energy'], s_inp=['max'], z_inp=[0, 'end'], run_s_inp=['max'], run_z_inp=['end'], spec_pad=1, savefig=1, saveval=1, showfig=0, debug=1)
The routine for plotting the statistical info of many GENESIS runs

— Will be rewritten and split in several separate modules —

proj_dir is the directory path in which

un_xxx folders are located.

run_inp=[1,2,3] number of runs to be processed, default - all possible up to run 1000 stage_inp=[1,2,3] stages to be processed, default - all possible up to stage 15 s_param_inp=[‘p_int’,’energy’] parameters to be displayed at certain position along the beam as a function of undulator length z_param_inp=[‘p_int’,’phi_mid_disp’,’spec’,’bunching’] parameters to be displayed at certain position along the undulator length as a function of location along the beam. s_inp=[1e-6,’max’,’mean’] positions at s to be plotted as function of z, max value of s as a function of z, mean value of s as a function of z z_inp=[12,’end’] position of z at which radiation and spectrum parameters are plotted savefig=1 save figures to given file format into proj_dir/results folder. 1 corresponds to ‘png’. accepts other values, such as ‘eps’ saveval=1, saves values being plotted to text files with the same names as the figures. first column - argument value (s[um],z[m],or lamd[nm]), second column - averaged parameters over shots, rest columns - single shot values. showfig=1 envokes plt.show() to display figures interactively. May be time- and processor-consuming

dfl_power, dfl_spec, dfl_size, dfl_divergence

ocelot.gui.genesis_plot.plot_gen_corr(proj_dir, run_inp=[], p1=(), p2=(), savefig=False, showfig=True, saveval=False)
ocelot.gui.genesis_plot.plot_dpa_bucket_out(out, dpa=None, slice_pos='max_I', repeat=1, GeV=1, figsize=4, cmap=def_cmap, scatter=True, energy_mean=None, legend=True, fig_name=None, savefig=False, showfig=True, bins=[50, 50], debug=1)
ocelot.gui.genesis_plot.plot_dpa_bucket(dpa, slice_num=None, repeat=1, GeV=1, figsize=4, cmap=def_cmap, scatter=False, energy_mean=None, legend=True, fig_name=None, savefig=False, showfig=True, suffix='', bins=50, 50, debug=1, return_mode_gamma=0)
ocelot.gui.genesis_plot.plot_edist(edist, figsize=4, fig_name=None, savefig=False, showfig=True, scatter=False, plot_x_y=True, plot_xy_s=True, bins=50, 50, 50, 50, flip_t=False, x_units='um', y_units='ev', cmin=0, y_offset=None, cmap=def_cmap, debug=1)
ocelot.gui.genesis_plot.read_plot_dump_proj(exp_dir, stage, run_ids, plot_phase=1, showfig=True, savefig=0, debug=1)
ocelot.gui.genesis_plot.show_output(g, show_field=False, show_slice=0)
ocelot.gui.genesis_plot.show_plots(displays, fig)

putting arbitrarily many plots on single figure

class ocelot.gui.genesis_plot.Display(data=lambda x: ..., xlabel='', ylabel='')