Skip to content

Commit cb61c7a

Browse files
authored
Fix load mat (#791)
* fix bug in load_mat * fix license
1 parent b310cc4 commit cb61c7a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pyat/at/load/matfile.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@
3333
"Particle": "particle",
3434
"cell_harmnumber": "cell_harmnumber", # necessary: property
3535
"beam_current": "beam_current", # necessary: property
36-
"PassMethod": None,
36+
"PassMethod": None, # Useless Matlab attributes
3737
"Length": None,
3838
"cavpts": None,
39+
"Mat_File": None, # These are erroneous attributes saved in
40+
"Mat_Key": None, # RingParam by old versions
41+
"Beam_Current": None,
42+
"Nbunch": None,
3943
}
4044
_p2m = dict((v, k) for k, v in _m2p.items() if v is not None)
4145
# Attribute to drop when writing a file
@@ -504,6 +508,10 @@ def _mat_key(ring):
504508
return mat_key
505509

506510

511+
def _ignore(ring, value):
512+
pass
513+
514+
507515
register_format(
508516
".mat",
509517
load_mat,
@@ -518,5 +526,5 @@ def _mat_key(ring):
518526
descr="Matlab text m-file. See :py:func:`.load_m`.",
519527
)
520528

521-
Lattice.mat_file = property(_mat_file, None, None)
522-
Lattice.mat_key = property(_mat_key, None, None)
529+
Lattice.mat_file = property(_mat_file, _ignore, None)
530+
Lattice.mat_key = property(_mat_key, _ignore, None)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ classifiers = [
2929
"Programming Language :: Python :: 3.11",
3030
"Programming Language :: Python :: 3.12",
3131
"Intended Audience :: Science/Research",
32-
"License :: OSI Approved :: The Unlicense (Unlicense)",
32+
"License :: OSI Approved :: Apache Software License",
3333
"Operating System :: MacOS",
3434
"Operating System :: Microsoft :: Windows",
3535
"Operating System :: POSIX",

0 commit comments

Comments
 (0)