Skip to content

Commit ac9970b

Browse files
committed
fix: Setting visualization doping limits to 0 when an empty list is provided
1 parent 9aae765 commit ac9970b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tidy3d/components/scene.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,8 +1979,8 @@ def perturbed_mediums_copy(
19791979
def doping_bounds(self):
19801980
"""Get the maximum and minimum of the doping"""
19811981

1982-
acceptors_lims = [1e50, -1e50]
1983-
donors_lims = [1e50, -1e50]
1982+
acceptors_lims = [np.inf, -np.inf]
1983+
donors_lims = [np.inf, -np.inf]
19841984

19851985
for struct in self.all_structures:
19861986
if isinstance(struct.medium.charge, SemiconductorMedium):
@@ -2020,6 +2020,15 @@ def doping_bounds(self):
20202020
limits[0] = min_value
20212021
if max_value > limits[1]:
20222022
limits[1] = max_value
2023+
# make sure we have recorded some values. Otherwise, set to 0
2024+
if np.isinf(acceptors_lims[0]):
2025+
acceptors_lims[0] = 0
2026+
if np.isinf(acceptors_lims[1]):
2027+
acceptors_lims[1] = 0
2028+
if np.isinf(donors_lims[0]):
2029+
donors_lims[0] = 0
2030+
if np.isinf(donors_lims[1]):
2031+
donors_lims[1] = 0
20232032
return acceptors_lims, donors_lims
20242033

20252034
def doping_absolute_minimum(self):

0 commit comments

Comments
 (0)