atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

Fix the creation of .mat files #627

Closed lfarv closed 1 year ago

lfarv commented 1 year ago

This fixes a bug reported by @oscarxblanco here.

The following sequence:

  1. Saving a .mat file in PyAT
  2. reading the file in Matlab
  3. saving as a .m file in Matlab
  4. Reading the ,m fill-in python

throws an Exception when reading sextuples.

Explanation: The attribute H (sextuple strength) exists as a property in python, but does not exist in Matlab. It is not present in .mat files created in Matlab, but does exist in .mat files created in python. When reading such a file in Matlab, the sextupoles get an unexpected H attribute, which has no detrimental effect, However when saving in a .m file, H is printed as a "exotic" attribute, which is wrongly interpreted.

In this PR, H does not appear in .mat files created in python.