Skip to content

Commit

Permalink
Fix load mat (#791)
Browse files Browse the repository at this point in the history
* fix bug in load_mat

* fix license
  • Loading branch information
lfarv committed Jun 25, 2024
1 parent b310cc4 commit cb61c7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions pyat/at/load/matfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@
"Particle": "particle",
"cell_harmnumber": "cell_harmnumber", # necessary: property
"beam_current": "beam_current", # necessary: property
"PassMethod": None,
"PassMethod": None, # Useless Matlab attributes
"Length": None,
"cavpts": None,
"Mat_File": None, # These are erroneous attributes saved in
"Mat_Key": None, # RingParam by old versions
"Beam_Current": None,
"Nbunch": None,
}
_p2m = dict((v, k) for k, v in _m2p.items() if v is not None)
# Attribute to drop when writing a file
Expand Down Expand Up @@ -504,6 +508,10 @@ def _mat_key(ring):
return mat_key


def _ignore(ring, value):
pass


register_format(
".mat",
load_mat,
Expand All @@ -518,5 +526,5 @@ def _mat_key(ring):
descr="Matlab text m-file. See :py:func:`.load_m`.",
)

Lattice.mat_file = property(_mat_file, None, None)
Lattice.mat_key = property(_mat_key, None, None)
Lattice.mat_file = property(_mat_file, _ignore, None)
Lattice.mat_key = property(_mat_key, _ignore, None)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: The Unlicense (Unlicense)",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
Expand Down

0 comments on commit cb61c7a

Please sign in to comment.