Skip to content
New issue

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

Save and load lattices in JSON format #766

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Save and load lattices in JSON format #766

wants to merge 16 commits into from

Conversation

lfarv
Copy link
Contributor

@lfarv lfarv commented May 10, 2024

With this PR, AT can save and load lattices in JSON format. JSON is a text-based format with the following properties:

  • JSON is a widely used format for storing structured data (ex.: Jupyter .ipynb files),
  • JSON is natively supported by both Matlab and python,
  • JSON files can be manipulated by external editors and viewers,
  • AT files in JSON format can be used for exchanging lattices between Matlab and python, as an alternative to the proprietary .mat format.

In addition, a few modifications have been made to the global load/save package to prepare future formats:

  • for file formats possibly containing several lattices (.mat, Elegant files), a specific keyword allows to select the desired lattice. A unique keyword use=lattice_name is now used for all formats, while the specific keywords (matkey=, lattice_key= etc.) are still understood for compatibility,
  • similarly, in the lattice attributes, the specific attribute mat_file, elegant_file... which records the input file name is replaced by a single one: in_file. This avoids the accumulation of different attributes, with the consequence that the last loaded file could not be identified. The file name extension is enough to know which kind of file was loaded.

Finally, the file loading structure is improved to allow an easier addition of new formats.

@lfarv lfarv added enhancement Matlab For Matlab/Octave AT code Python For python AT code labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Matlab For Matlab/Octave AT code Python For python AT code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant