Skip to content

Commit

Permalink
Fix tests (#94)
Browse files Browse the repository at this point in the history
* add back in scikit-optimize

* pin shapely version
  • Loading branch information
dguittet committed Feb 7, 2023
1 parent 34708e2 commit c4e2a55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions hybrid/layout/flicker_mismatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ def _setup_string_points(self,
"""
if isinstance(array_points, Point):
array_points = (array_points,)
else:
array_points = array_points.geoms
n_rows_modules = len(array_points)

if FlickerMismatch.periodic:
Expand All @@ -281,12 +283,12 @@ def _setup_string_points(self,
string_points = []
for i in range(n_strings):
start = i * self.modules_per_string
end = min(len(array_points), (i + 1) * self.modules_per_string)
end = min(n_rows_modules, (i + 1) * self.modules_per_string)
pts = [array_points[j] for j in range(start, end)]
string_points.append(pts)

if FlickerMismatch.periodic:
assert (len(array_points) == sum([len(i) for i in string_points]))
assert (n_rows_modules == sum([len(i) for i in string_points]))

# for the last string, continue across the top of the center grid to the bottom of the next
i = 0
Expand Down Expand Up @@ -334,6 +336,8 @@ def _calculate_shading(weight: float,
if intersecting_points:
if isinstance(intersecting_points, Point):
intersecting_points = (intersecting_points, )
else:
intersecting_points = intersecting_points.geoms
# break up into separate instructions for minor speed up by vectorization
xs = np.array([pt.x for pt in intersecting_points])
ys = np.array([pt.y for pt in intersecting_points])
Expand Down Expand Up @@ -417,6 +421,8 @@ def _calculate_power_loss(poa: float,
continue
elif isinstance(shaded_module_points, Point):
shaded_module_points = (shaded_module_points, )
else:
shaded_module_points = shaded_module_points.geoms

shaded_poa_suns = poa_suns * 0.1
shaded_indices = []
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ python-rapidjson
pytz
requests
scikit-learn
scikit-optimize
scipy
shapely>=1.8.5
shapely>=1.8.5,<2.0.0
setuptools
timezonefinder
urllib3

0 comments on commit c4e2a55

Please sign in to comment.