Skip to content

Commit

Permalink
fix empty sequence parameter init
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehenke committed Dec 2, 2024
1 parent 9a9b121 commit 2d0380d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/ptychodus/api/parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,13 @@ def setValueFromString(self, value: str) -> None:
tmp: list[float] = list()

for xstr in value.split(','):
try:
x = float(xstr)
except ValueError:
x = float('nan')
if xstr:
try:
x = float(xstr)
except ValueError:
x = float('nan')

tmp.append(x)
tmp.append(x)

self.setValue(tmp)

Expand Down Expand Up @@ -362,12 +363,13 @@ def setValueFromString(self, value: str) -> None:
tmp: list[complex] = list()

for xstr in value.split(','):
try:
x = complex(xstr)
except ValueError:
x = float('nan') * 1j
if xstr:
try:
x = complex(xstr)
except ValueError:
x = float('nan') * 1j

tmp.append(x)
tmp.append(x)

self.setValue(tmp)

Expand Down

0 comments on commit 2d0380d

Please sign in to comment.