Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
e10harvey committed Jan 7, 2025
1 parent ed9a797 commit a3d6891
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 85 deletions.
16 changes: 0 additions & 16 deletions opencsp/common/lib/csp/LightPathEnsemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,3 @@ def concatenate(self: 'LightPathEnsemble', lpe1: 'LightPathEnsemble'):
new_lpe.points_lists = self.points_lists + (lpe1.points_lists)
new_lpe.colors = self.colors + (lpe1.colors)
return new_lpe

def asLightPathList(self) -> list[LightPath]:
"""
Converts the ensemble into a list of LightPath objects.
Returns
-------
list[LightPath]
A list of LightPath objects constructed from the ensemble's data.
"""
# "ChatGPT 4o-mini" assisted with generating this docstring.
lps: list[LightPath] = []
for cd, id, pl in zip(self.current_directions, self.init_directions, self.points_lists):
lp = LightPath(pl, id, cd)
lps.append(lp)
return lps
68 changes: 0 additions & 68 deletions opencsp/common/lib/csp/RayTrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,74 +788,6 @@ def trace_scene_parallel(
return ray_trace


def plane_intersect_OLD(
ray_trace: RayTrace, v_plane_center: Vxyz, u_plane_norm: Uxyz, epsilon: float = 1e-6, verbose=False
) -> Vxy:
"""
Calculates the intersection points of light paths with a specified plane.
This method is deprecated and may be removed in future versions.
Parameters
----------
ray_trace : RayTrace
The RayTrace object containing the light paths.
v_plane_center : Vxyz
The center point of the plane.
u_plane_norm : Uxyz
The normal vector of the plane.
epsilon : float, optional
The threshold for determining if a ray is parallel to the plane (default is 1e-6).
verbose : bool, optional
If True, prints execution status (default is False).
Returns
-------
Vxy
The intersection points in the local plane XY reference frame.
Notes
-----
This method is deprecated. Use the `plane_intersect` function instead.
"""
# "ChatGPT 4o-mini" assisted with generating this docstring.
if verbose:
tot = len(ray_trace.light_paths)
ten_percent = np.ceil(tot / 10)
checkpoints = [n * ten_percent for n in range(10)]

points_list = []

for idx, lp in enumerate(ray_trace.light_paths):
# Intersect if not parallel or hitting from behind
u = lp.current_direction
d = Vxyz.dot(u, u_plane_norm)
if np.abs(d) > epsilon:
p0 = lp.points_list[-1]
w = p0 - v_plane_center
fac = -Vxyz.dot(u_plane_norm, w) / d
v = u * fac
points_list.append(p0 + v)
# Print output
if verbose and idx in checkpoints:
print(f"{idx / tot:.2%} through finding intersections")

# Merge into one Vxyz object
if verbose:
print("Merging vectors.")
intersection_points = Vxyz.merge(points_list)

# Make relative to plane center
if verbose:
print("Rotating.")
intersection_points -= v_plane_center
intersection_points.rotate_in_place(u_plane_norm.align_to(Vxyz((0, 0, 1))))

if verbose:
print("Plane intersections caluculated.")
return intersection_points.projXY()


def plane_intersect(
ray_trace: RayTrace,
v_plane_center: Vxyz,
Expand Down
2 changes: 1 addition & 1 deletion opencsp/common/lib/csp/StandardPlotOutput.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Class used to display/save the suite of standard output plots after measuring a COutSP Mirror/FacetEnsemble.
"""Class used to display/save the suite of standard output plots after measuring a CSP Mirror/FacetEnsemble.
"""

from dataclasses import dataclass, field
Expand Down

0 comments on commit a3d6891

Please sign in to comment.