lmalina / pySC

Python version of Simulated Commissioning toolkit for synchrotrons (https://github.com/ThorstenHellert/SC).
https://lmalina.github.io/pySC/
7 stars 4 forks source link

Read .mat files with an SC structure #11

Open oscarxblanco opened 1 year ago

oscarxblanco commented 1 year ago

Dear all,

is there a way to read an SC structure from a .mat file saved in matlab ? For the moment I have managed to load the lattice with the following code :

import scipy
import at
SCmat = scipy.io.loadmat('SC.mat');
scipy.io.savemat('ringfromSC.mat', {'RING': SCmat['SC']['RING'][0,0]})
ring = at.load_mat('ringfromSC.mat', mat_key='RING', keep_all=True)

Is there any other option ?

lmalina commented 1 year ago

Dear Oscar,

This has not been investigated (yet). The SC-structure equivalent can be created in pySC, but bear in mind that not all correction algorithms are working yet. To load the SC-modified lattice only, your code looks already quite straightforward.