Skip to content

Commit

Permalink
Extend parse_xyz to handle config lists
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeyers314 committed May 16, 2024
1 parent 7feb3ff commit 56fb6ac
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions imsim/telescope_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@


def parse_xyz(xyz, base):
# If xyz is a dict, see if we can parse it into a list first
safe = True
if isinstance(xyz, dict):
xyz, safe1 = ParseValue({"xyz":xyz}, 'xyz', base, list)
safe &= safe1
if not isinstance(xyz, list) or len(xyz) != 3:
raise ValueError("Expecting a list of 3 elements")
parsed_xyz, safe = zip(*[ParseValue(xyz, i, base, float) for i in range(3)])
return parsed_xyz, all(safe)
parsed_xyz, safe1 = zip(*[ParseValue(xyz, i, base, float) for i in range(3)])
safe &= all(safe1)
return parsed_xyz, safe


def apply_fea(
Expand Down

0 comments on commit 56fb6ac

Please sign in to comment.