fscarlier / xsequence

Package to manage particle accelerator sequences.
1 stars 2 forks source link

Saving .seq file #3

Open elafmusa opened 2 years ago

elafmusa commented 2 years ago

Hi everyone,

I'm working on converting a .mat file that was exported from pyat into a .sequence file using xsequence. For that I followed these steps:

import xsequence import at from xsequence.lattice import Lattice from xsequence.conversion_utils import conv_utils import xsequence.elements_dataclasses as xed

pyat_lattice = conv_utils.create_pyat_from_file('FCCee_z_512_nosol_10_BPMs_added_r.mat') lat = Lattice.from_pyat(pyat_lattice) madx_lat = lat.to_cpymad()

My question is how to save the madx_lat as a .sequence file properly ? I tried the following :

madx_lat.save('C:/Users/musa/Desktop/add_BPM_to_seq/madxlat.seq')

But the following error arises:

+=+=+= fatal: illegal keyword: c Traceback (most recent call last): File "", line 1, in File "C:\Users\musa\AppData\Local\Programs\Python\Python310\lib\site-packages\cpymad\madx.py", line 771, in call return self._madx.input(util.format_command(self, *args, **kwargs)) File "C:\Users\musa\AppData\Local\Programs\Python\Python310\lib\site-packages\cpymad\madx.py", line 280, in input raise RuntimeError("MAD-X has stopped working!") from None RuntimeError: MAD-X has stopped working!

Thank you in advance