Closed swhite2401 closed 2 weeks ago
Here is the code used to test it
import numpy
import at
path = '../lattice/'
filename = 'S28F.mat'
key = 'LOW_EMIT_RING_INJ'
latticef = path+filename
ring = at.load_lattice(latticef,key=key)
ring.radiation_off()
print(ring.get_tune(get_integer=True))
print(ring.get_chrom())
d0 = {}
for e in ring['QF1*']:
d0[e.FamName] = e.PolynomB[1]
for e in ring['QD2*']:
d0[e.FamName] = e.PolynomB[1]
for e in ring['S[FD]*']:
d0[e.FamName] = e.PolynomB[2]
at.fit_tune(ring, 'QF1*', 'QD2*', [76.18, 27.34])
at.fit_chrom(ring, 'SF*', 'SD*', [0.0, 0.0])
print(ring.get_tune(get_integer=True))
print(ring.get_chrom())
d = {}
for e in ring['QF1*']:
d[e.FamName] = e.PolynomB[1]
for e in ring['QD2*']:
d[e.FamName] = e.PolynomB[1]
for e in ring['S[FD]*']:
d[e.FamName] = e.PolynomB[2]
for k in d0.keys():
print(k, d0[k]/d[k])
ring = at.load_lattice(latticef,key=key)
ring.radiation_off()
d0 = {}
for e in ring['QF1*']:
d0[e.FamName] = e.PolynomB[1]
for e in ring['QD2*']:
d0[e.FamName] = e.PolynomB[1]
for e in ring['S[FD]*']:
d0[e.FamName] = e.PolynomB[2]
at.fit_tune(ring, 'QF1*', 'QD2*', [76.18, 27.34], scaling=True)
at.fit_chrom(ring, 'SF*', 'SD*', [0.0, 0.0], scaling=True)
print(ring.get_tune(get_integer=True))
print(ring.get_chrom())
d = {}
for e in ring['QF1*']:
d[e.FamName] = e.PolynomB[1]
for e in ring['QD2*']:
d[e.FamName] = e.PolynomB[1]
for e in ring['S[FD]*']:
d[e.FamName] = e.PolynomB[2]
for k in d0.keys():
print(k, d0[k]/d[k])
dear @swhite2401 this works perfectly for me!
The same applies for chromaticity?
Yes the same applies for chromaticity
Tested also for chromaticity, I approve!
This PR introduces the possibility to fit tunes and chromaticities by scaling the families instead of adding a delta. This is useful in case a family is defined with several magnet types in order to keep their ratio constant. The default behavior is unchanged