We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, Thomas
How to calculate TWISS for a ring. My code can't work as follows. The plain Madx file COD_HIMM.txt can work very well under Madx program.
from cpymad.madx import Madx madx = Madx(command_log="HIMM_log.madx") print(madx.version) madx.command.call(file="COD_HIMM.txt") #calculate TWISS twiss0 = madx.twiss(sequence='COD_HIMM.txt')
error occured:
twiss0 = madx.twiss(sequence='COD_HIMM.txt') Traceback (most recent call last): File "<ipython-input-89-95502ed45d2c>", line 1, in <module> twiss0 = madx.twiss(sequence='COD_HIMM.txt') File "D:\Program Files\lib\site-packages\cpymad\madx.py", line 407, in twiss return self.get_table('twiss', columns) File "D:\Program Files\lib\site-packages\cpymad\madx.py", line 560, in get_table proxy = TableProxy(table, self._libmadx) File "D:\Program Files\lib\site-packages\cpymad\madx.py", line 870, in __init__ raise ValueError("Invalid table: {!r}".format(name)) ValueError: Invalid table: 'twiss'
COD_HIMM.txt
TITLE "HITFiL Project" OPTION, INFO, -ECHO, WARN; !ASSIGN, PRINT="HITFiL-cod-print" //ASSIGN, ECHO="HITFiL-cod-echo" //ASSIGN, INFO="HITFiL-cod-info" BEAM, PARTICLE=carbon, CHARGE=6, energy=0.007; !---------constant definition----------- mk1=1.5; !-----Defining elements---- !----------drift------------------------------ D11:drift,l=1.75; D12:drift,l=0.40; D13:drift,l=0.30; D14:drift,l=0.05; D15:drift,l=0.13; D16:drift,l=0.15; D17:drift,l=1.70; D18:drift,l=0.53; D19:drift,l=0.25; D21:drift,l=1.75; D22:drift,l=0.40; D23:drift,l=0.30; D24:drift,l=0.05; D25:drift,l=0.43; D26:drift,l=2.00; D27:drift,l=0.15; D28:drift,l=0.35; D29:drift,l=0.35; D31:drift,l=1.02; D32:drift,l=0.63; D33:drift,l=0.40; D34:drift,l=0.30; D35:drift,l=0.05; D36:drift,l=0.13; D37:drift,l=0.15; D38:drift,l=2.00; D39:drift,l=0.45; D3a:drift,l=0.33; D41:drift,l=0.81; D42:drift,l=0.44; D43:drift,l=0.15; D44:drift,l=0.40; D45:drift,l=0.30; D46:drift,l=0.05; D47:drift,l=0.43; D48:drift,l=2.00; D49:drift,l=0.35; D4a:drift,l=0.13; !---------marker----- m1:marker; m2:marker; !--------------constant difinition of dipoles------------------ N=8; !bero=6.342738; !Bm=1.58568; ro=4.0; !bero/Bm leng=ro*(twopi/N); Rr=0.07;! Reference radius of field measurement (Half good-field width) a1=0.0;!4.5e-4 a2=0.0;! a3=0.0;! !---------definition of dipole without multipole----------- RB: SBEND, L=leng,ANGLE=TWOPI/N,K1=a1*(1/ro)*(1/Rr),HGAP=0.037,FINT=0.55,FINTX=0.55,E1=PI/8,E2=PI/8; !--------dipole error-------------------------------------- B11:RB; B12:RB; B21:RB; B22:RB; B31:RB; B32:RB; B41:RB; B42:RB; KB11: HKICKER; KB12: HKICKER; KB21: HKICKER; KB22: HKICKER; KB31: HKICKER; KB32: HKICKER; KB41: HKICKER; KB42: HKICKER; HB11: LINE=(B11,KB11); HB12: LINE=(B12,KB12); HB21: LINE=(B21,KB21); HB22: LINE=(B22,KB22); HB31: LINE=(B31,KB31); HB32: LINE=(B32,KB32); HB41: LINE=(B41,KB41); HB42: LINE=(B42,KB42); !--------------quadrupole without multipole------------------ QF: QUADRUPOLE, L=0.2, K1=0.799839688766; QD: QUADRUPOLE, L=0.2, K1=-1.00783349327; QFF: QUADRUPOLE, L=0.35, K1=1.038161630875; FQ: QUADRUPOLE, L=0.15,K1=0.00; !-------------quadrupole error--------------------- Q11:QF; Q12:QD; Q13:QFF; Q21:QF; Q22:QD; Q23:QFF; Q31:QF; Q32:QD; Q33:QFF; Q41:QF; Q42:QD; Q43:QFF; FQ11: FQ; FQ41: FQ; !---------chromaticity sextupole-------------------- SEXTCH: sextupole,l=0.15, k2=0.0; SEXTCV: sextupole,l=0.15, k2=0.0; SH11: SEXTCH; SH31: SEXTCH; SV21: SEXTCV; SV41: SEXTCV; !-------------resonance sextupole-------------------- SEXTR: sextupole,l=0.15, k2=0.0; SR11: SEXTR; SR21: SEXTR; SR31: SEXTR; SR41: SEXTR; !-------------CORRECTORS------------------------- CY: VKICKER, L=0.1; CY11:CY; CY21:CY; CY22:CY; CY31:CY; CY32:CY; CY33:CY; CY41:CY; CY42:CY; !--------------MONITOR--------------------- PKUP: MONITOR, L=0.25; BPM11: PKUP; BPM12: PKUP; BPM21: PKUP; BPM31: PKUP; BPM32: PKUP; BPM41: PKUP; BPM42: PKUP; PU11: LINE=(BPM11); PU12: LINE=(BPM12); PU21: LINE=(BPM21); PU31: LINE=(BPM31); PU32: LINE=(BPM32); PU41: LINE=(BPM41); PU42: LINE=(BPM42); !--------ring definition------------------------- CELL1:Line=(D11,Q11,D12,HB11,D13,PU11,D14,CY11,D15,& SR11,D16,Q12,D16,FQ11,D17,SH11,D16,Q13,& D12,HB12,D19,PU12,D18); CELL2:Line=(D21,Q21,D22,HB21,D23,PU21,D24,CY21,D25,& Q22,D26,SR21,D27,Q23,D22,HB22,D28,SV21,& D25,CY22); CELL3:Line=(D31,CY31,D32,Q31,D33,HB31,D34,PU31,D35,CY32,& D36,SR31,D37,Q32,D38,SH31,D37,Q33,D33,& HB32,D39,CY33,D3a,PU32); CELL4:Line=(D41,PU41,D42,CY41,D43,Q41,D44,HB41,D45,& PU42,D46,CY42,D47,Q42,D48,SR41,D43,Q43,& D44,HB42,D49,SV41,D43,FQ41,D4a); HIMM: Line=(CELL1,-CELL2,CELL3,-CELL4); USE, sequence=HIMM;
The text was updated successfully, but these errors were encountered:
twiss0 = madx.twiss(sequence='COD_HIMM.txt')
Like MAD-X, cpymad requires a sequence name (not file name) to pass to TWISS
Sorry, something went wrong.
No branches or pull requests
Hi, Thomas
How to calculate TWISS for a ring. My code can't work as follows. The plain Madx file COD_HIMM.txt can work very well under Madx program.
error occured:
COD_HIMM.txt
The text was updated successfully, but these errors were encountered: