Skip to content

Commit

Permalink
Merge pull request fbpic#667 from RemiLehe/fix_check_lasy
Browse files Browse the repository at this point in the history
Better check of the lasy version
  • Loading branch information
ax3l authored Dec 17, 2023
2 parents 7fa9514 + c75848f commit 3e9f181
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fbpic/lpa_utils/laser/laser_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,15 +906,16 @@ def __init__(self, filename, t_start=0.):

# Check lasy version
valid_version = False
if ('softwareVersion' in f.attrs):
if ('software' in f.attrs) and ('softwareVersion' in f.attrs):
software = f.attrs['software'].decode()
version_string = f.attrs['softwareVersion'].decode()
version_list = tuple(int(number) for number in version_string.split('.'))
if version_list >= (0,3,0):
if (software == "lasy") and (version_list >= (0,3,0)):
valid_version = True
if not valid_version:
raise RuntimeError(
"The `lasy` version that was used to create the file %s "
"is obsolete and not supported by FBPIC. Please upgrade your lasy "
"is obsolete and not supported by FBPIC.\nPlease upgrade your lasy "
"version to at least 0.3.0 (e.g. with `pip install --upgrade lasy`) "
"and re-create the file %s." %(filename, filename) )

Expand Down

0 comments on commit 3e9f181

Please sign in to comment.