From a23eaa2af4b6615542e9e001db35b4c92cef50fa Mon Sep 17 00:00:00 2001 From: Claudio Scafuri <claudio.scafuri@elettra.eu> Date: Wed, 12 Apr 2023 09:13:47 +0200 Subject: [PATCH] more and more --- boosterubung.py | 4 ++- compare.py | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ elettratest.py | 17 ++++++------ esrftest.py | 60 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 145 insertions(+), 9 deletions(-) create mode 100755 compare.py create mode 100755 esrftest.py diff --git a/boosterubung.py b/boosterubung.py index 720fe81..6ba15e7 100755 --- a/boosterubung.py +++ b/boosterubung.py @@ -12,6 +12,8 @@ refpts = range(len(ring) + 1) #--- lionop needs radiation off ring.radiation_off() elemdata0, tune, chrom, elemdata=at.linopt(ring,0.0001,list(refpts)) +tuneH=tune[0] +tuneV=tune[1] s_pos = elemdata['s_pos'] beta_x =elemdata['beta'][:,0] @@ -52,5 +54,5 @@ mp.xlabel('s [m]') mp.ylabel('m') mp.title('orb_x' ) mp.show() -print('tune H:',tuneH,'tune V:',tuneV,'tune L:',tuneL) +print('tune H:',tuneH,'tune V:',tuneV) print('E:', e_eV/1e9,' GeV') diff --git a/compare.py b/compare.py new file mode 100755 index 0000000..744da7b --- /dev/null +++ b/compare.py @@ -0,0 +1,73 @@ +#!/usr/bin/python3 + +import at +#import matplotlib.pylab as mp + +ring1=at.load_lattice("../../machine/lattice/elettra/elettra.m",energy=2.0e9) +ring2=at.load_lattice("../../machine/lattice/elettra/elettra_strS.m",energy=2.0e9) + + +len1 = ring1.circumference +len2 = ring2.circumference + +print('circonf. ring S.K.:', len1) +print('circonf. ring hls :', len2) +#print(len1,len2," delta: ", len2-len1, "relative delta:" , (len2-len1)/len2) + +[chromH1,chromV1,chromL1]=ring1.get_chrom() +[tuneH1,tuneV1,tuneL1] = ring1.get_tune() + +chromH2,chromV2,chromL2=ring2.get_chrom() +tuneH2,tuneV2,tuneL2 = ring2.get_tune() + +print ('tune H ring S.K:',tuneH1,'tune V ring S.K.:',tuneV1) +print ('tune H ring hls:',tuneH2,'tune V ring hls.:',tuneV2) + +print ('eta H ring S.K:',chromH1,' eta V ring S.K.:',chromV1) +print ('eta H ring hls:',chromH2,'eta V ring hls :',chromV2) +#--- lionop needs radiation off +#--- lionop needs radiation off + +#quad1refpts = ring1.get_refpts(at.Quadrupole) +#quad2refpts = ring2.get_refpts(at.Quadrupole) + +#for ref1 in quad1refpts: + #print(ring1[ref1].FamName,ring1.get_s_pos(ref1)[0]) + +#print('--------------------------') +#for ref2 in quad2refpts: + #print(ring2[ref2].FamName,ring2.get_s_pos(ref2)[0]) +#print('--------------------------') + + +#corr1refpts = ring1.get_refpts(at.Corrector) +#corr2refpts = ring2.get_refpts(at.Corrector) + +#for ref1 in corr1refpts: + #print(ring1[ref1].FamName,ring1.get_s_pos(ref1)[0]) + +#print('--------------------------') +#for ref2 in corr2refpts: + #print(ring2[ref2].FamName,ring2.get_s_pos(ref2)[0]) +#print('--------------------------') + + + + +#if len(quad1refpts) != len(quad1refpts): + #print('lattice desc. differ in number of quadrupoles') + +#spos1=ring1.get_s_pos(quad1refpts) +#spos2=ring2.get_s_pos(quad2refpts) + +#for index in range(len(quad1refpts)): + #s1=spos1[index] + #s2=spos2[index] + #ref1=quad1refpts[index] + #ref2=quad2refpts[index] + #print(s1,s2,s1-s2,ring1[ref1].FamName,ring2[ref2].FamName) + + + + + diff --git a/elettratest.py b/elettratest.py index 3a23f63..ee026ae 100755 --- a/elettratest.py +++ b/elettratest.py @@ -3,15 +3,16 @@ import at import matplotlib.pylab as mp -ring=at.load_lattice("../../machine/lattice/elettra/elettra.m",energy=2.0e9) +ring=at.load_lattice("../../machine/lattice/elettra/elettra_strS.m",energy=2.0e9) refpts = range(len(ring) + 1) - -elemdata0, ringdata,elemdata=at.linopt6(ring,refpts) - +ring.radiation_off() +elemdata0, ringdata,elemdata=at.linopt6(ring,refpts,0.001) +[chromH,chromV]=ring.get_chrom() +[tuneH,tuneV] = ring.get_tune() #--- lionop needs radiation off #ring.radiation_off() -#elemdata0, tune, chrom, elemdata=at.linopt(ring,0.0001,list(refpts)) +#elemdata0, tune, chrom, elemdata=at.linopt(ring,refpts) s_pos = elemdata['s_pos'] beta_x =elemdata['beta'][:,0] @@ -31,8 +32,7 @@ closed_orbit_xp=elemdata['closed_orbit'][:,1] closed_orbit_y=elemdata['closed_orbit'][:,2] closed_orbit_yp=elemdata['closed_orbit'][:,3] -#[tuneH,tuneV,tuneL]=ring.get_tune() -#[chromH,chromV,chromL]=ring.get_chrom() + e_eV=ring.energy @@ -52,5 +52,6 @@ mp.xlabel('s [m]') mp.ylabel('m') mp.title('orb_x' ) mp.show() -print('tune H:',tuneH,'tune V:',tuneV,'tune L:',tuneL) +print('tune H:',tuneH,'tune V:',tuneV) +print('chrom H:',chromH,' chromV:', chromV) print('E:', e_eV/1e9,' GeV') diff --git a/esrftest.py b/esrftest.py new file mode 100755 index 0000000..a4d4868 --- /dev/null +++ b/esrftest.py @@ -0,0 +1,60 @@ +#!/usr/bin/python3 + +import at +import matplotlib.pylab as mp + +ring=at.load_lattice("../../machine/lattice/other/esrf.m",energy=6.0e9) + +refpts = range(len(ring) + 1) + +elemdata0, ringdata,elemdata=at.linopt6(ring,refpts) + +#--- lionop needs radiation off +#ring.radiation_off() +#elemdata0, tune, chrom, elemdata=at.linopt(ring,0.0001,list(refpts)) +ring.radiation_off() +[chromH,chromV]=ring.get_chrom() +[tuneH,tuneV] = ring.get_tune() + +s_pos = elemdata['s_pos'] +beta_x =elemdata['beta'][:,0] +beta_y =elemdata['beta'][:,1] + +alpha_x = elemdata['alpha'][:,0] +alpha_y = elemdata['alpha'][:,1] + +dispersion_x=elemdata['dispersion'][:,0] +dispersion_xp=elemdata['dispersion'][:,1] +dispersion_y=elemdata['dispersion'][:,2] +dispersion_yp=elemdata['dispersion'][:,3] + + +closed_orbit_x=elemdata['closed_orbit'][:,0] +closed_orbit_xp=elemdata['closed_orbit'][:,1] +closed_orbit_y=elemdata['closed_orbit'][:,2] +closed_orbit_yp=elemdata['closed_orbit'][:,3] + +#[tuneH,tuneV,tuneL]=ring.get_tune() +#[chromH,chromV,chromL]=ring.get_chrom() +e_eV=ring.energy + + +mp.figure() +mp.subplot(211) +mp.plot(s_pos,beta_x) +mp.plot(s_pos,beta_y) +mp.plot(s_pos,dispersion_x) +mp.xlabel('s [m]') +mp.ylabel('m') +mp.title('beta_x beta_y disp_x' ) + + +mp.subplot(212) +mp.plot(s_pos,closed_orbit_x) +mp.xlabel('s [m]') +mp.ylabel('m') +mp.title('orb_x' ) +mp.show() +print('tune H:',tuneH,'tune V:',tuneV) +print('chrom H:',chromH,' chromV:', chromV) +print('E:', e_eV/1e9,' GeV') -- GitLab