This notebook was created by Svitozar Serkez. Source and license info is on GitHub. August 2016.
This example will cover the following topics:
NB... there is software like xgenesis ....
1) also pyton-based (same language) 2) already included in OCELOT
why write again?
In [1]:
# the output of plotting commands is displayed inline within frontends,
# directly below the code cell that produced it
%matplotlib inline
from __future__ import print_function
# this python library provides generic shallow (copy) and deep copy (deepcopy) operations
from copy import deepcopy
# import from Ocelot graphical modules
import sys, os
from ocelot import *
from ocelot.utils.xfel_utils import *
from ocelot.gui.accelerator import *
from ocelot.gui.genesis_plot import *
#from ocelot.optics.elements import Filter_freq
import numpy as np
from copy import copy
#import matplotlib.pyplot as plt
# load beam distribution
In [2]:
proj_dir = 'materials/invtap_tdp'
out_file = proj_dir + '/run_0' + '/run.0.s1.gout'
In [3]:
out = readGenesisOutput(out_file)
In [4]:
gen_outplot_e(out)
plt.show()
In [5]:
gen_outplot_ph(out)
plt.show()
In [6]:
gen_outplot_z(out,z=inf)
plt.show()
In [7]:
dfl=readRadiationFile(out_file+'.dfl', out.ncar)
In [8]:
gen_outplot_dfl(dfl, out)
plt.show()
In [9]:
gen_outplot_dfl(dfl, out, freq_domain=True,far_field=True)
plt.show()
In [4]:
dpa=read_particle_file(out_file+'.dpa',out('nbins'),out('npart'))
dist=dpa2dist(out,dpa)
In [5]:
plot_dist(dist, showfig=True)
In [4]:
# this function plots the averaged properties of FEL radiation
gen_stat_plot(proj_dir,run_inp=[],stage_inp=[1],param_inp=[],s_param_inp=['p_int'],z_param_inp=['p_int','spec'],dfl_param_inp=[],s_inp=['max'],z_inp=['end'], savefig=0, saveval=0, showfig=1)
Out[4]:
In [13]:
gen_corr_plot(proj_dir,run_inp=[],p1=('rad_t_size_weighted',1,inf,'max'),p2=('p_int',4,inf,'max'),saveval=1, showfig=True)
Out[13]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
a=('ad',2,'ersre',5)
str(a)
In [ ]:
b='_'.join(('1',2,'3'))
In [ ]:
for i in a: i=str(i)
In [1]:
aa={}
In [2]:
aa['r']='gg'
In [3]:
aa
Out[3]:
In [ ]:
In [11]:
dir(out)
Out[11]:
In [ ]:
In [ ]: