Skip to content

Commit

Permalink
Updated test_SlopeSolver to use Surface2D classes
Browse files Browse the repository at this point in the history
  • Loading branch information
braden6521 committed Mar 19, 2024
1 parent d7bfe1d commit 41d3da2
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions opencsp/common/lib/deflectometry/test/test_SlopeSolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from opencsp.app.sofast.lib.MeasurementSofastFringe import MeasurementSofastFringe as Measurement
from opencsp.app.sofast.lib.SpatialOrientation import SpatialOrientation
from opencsp.common.lib.deflectometry.SlopeSolver import SlopeSolver
from opencsp.common.lib.deflectometry.Surface2DParabolic import Surface2DParabolic
from opencsp.common.lib.geometry.Uxyz import Uxyz
from opencsp.common.lib.geometry.Vxyz import Vxyz
from opencsp.common.lib.opencsp_path.opencsp_root_path import opencsp_code_dir
Expand Down Expand Up @@ -52,19 +53,11 @@ def setUpClass(cls):
ori.orient_optic_cam(r_cam_optic, v_cam_optic_cam)

# Perform calculations
if data['surface_type'] == 'parabolic':
surface_data = dict(
surface_type=data['surface_type'],
initial_focal_lengths_xy=data['initial_focal_lengths_xy'],
robust_least_squares=bool(data['robust_least_squares']),
downsample=data['downsample'],
)
elif data['surface_type'] == 'plano':
surface_data = dict(
surface_type=data['surface_type'],
robust_least_squares=bool(data['robust_least_squares']),
downsample=data['downsample'],
)
surface = Surface2DParabolic(
initial_focal_lengths_xy=data['initial_focal_lengths_xy'],
robust_least_squares=bool(data['robust_least_squares']),
downsample=data['downsample'],
)
kwargs = {
'v_optic_cam_optic': ori.v_optic_cam_optic,
'u_active_pixel_pointing_optic': Uxyz(data['u_pixel_pointing_facet']),
Expand All @@ -73,7 +66,7 @@ def setUpClass(cls):
'v_optic_screen_optic': ori.v_optic_screen_optic,
'v_align_point_optic': measurement.measure_point,
'dist_optic_screen': measurement.optic_screen_dist,
'surface_data': surface_data,
'surface': surface,
}

# Solve slopes
Expand Down Expand Up @@ -115,3 +108,7 @@ def test_slopes(self):
np.testing.assert_allclose(
data['slopes_facet_xy'], self.data_slope.slopes_facet_xy, atol=1e-8, rtol=0
)


if __name__ == '__main__':
unittest.main()

0 comments on commit 41d3da2

Please sign in to comment.