Skip to content

Commit

Permalink
add index to segment (#102)
Browse files Browse the repository at this point in the history
* add index to segment

* add test for segment indexes
  • Loading branch information
tcapelle authored Feb 16, 2020
1 parent 422f883 commit 56eac34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pvfactors/geometry/pvrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def from_raw_inputs(cls, xy_center, width, rotation_vec, cut,
is_shaded)
# Create segment
segment = TsSegment(segment_coords, illum, shaded,
n_vector=n_vector)
n_vector=n_vector, index=i)
list_segments.append(segment)

return cls(list_segments, n_vector=n_vector)
Expand Down
5 changes: 5 additions & 0 deletions pvfactors/tests/test_geometry/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ def test_ts_pvrow():
cut, df_inputs.shaded_length_front,
df_inputs.shaded_length_back)


#check segment index
assert len(ts_pvrow.front.list_segments) == 3
assert [s.index for s in ts_pvrow.front.list_segments] == [0,1,2]

# Check timeseries length of front and back segments
for seg in ts_pvrow.front.list_segments:
np.testing.assert_allclose(width / cut['front'], seg.length)
Expand Down

0 comments on commit 56eac34

Please sign in to comment.