diff --git a/opencsp/app/sofast/test/test_spatial_processing.py b/opencsp/app/sofast/test/test_spatial_processing.py index 7143b1a7b..87798f048 100644 --- a/opencsp/app/sofast/test/test_spatial_processing.py +++ b/opencsp/app/sofast/test/test_spatial_processing.py @@ -7,11 +7,9 @@ import numpy as np from scipy.spatial.transform import Rotation -from opencsp.app.sofast.lib.DisplayShape import DisplayShape as Display -from opencsp.app.sofast.lib.MeasurementSofastFringe import ( - MeasurementSofastFringe as Measurement, -) +from opencsp.app.sofast.lib.MeasurementSofastFringe import MeasurementSofastFringe import opencsp.app.sofast.lib.spatial_processing as sp +from opencsp.app.sofast.lib.SpatialOrientation import SpatialOrientation from opencsp.common.lib.camera.Camera import Camera from opencsp.common.lib.geometry.Vxy import Vxy from opencsp.common.lib.geometry.Vxyz import Vxyz @@ -31,7 +29,7 @@ def setUpClass(cls): cls.data_file_facet = os.path.join(base_dir, 'calculations_facet/data.h5') cls.data_file_measurement = os.path.join(base_dir, 'measurement_facet.h5') - cls.display = Display.load_from_hdf(cls.data_file_facet) + cls.orientation = SpatialOrientation.load_from_hdf(cls.data_file_facet) cls.camera = Camera.load_from_hdf(cls.data_file_facet) def test_t_from_distance(self): @@ -42,14 +40,14 @@ def test_t_from_distance(self): # Load test data data = load_hdf5_datasets(datasets, self.data_file_facet) - measurement = Measurement.load_from_hdf(self.data_file_measurement) + measurement = MeasurementSofastFringe.load_from_hdf(self.data_file_measurement) # Perform calculation v_cam_optic_cam_exp = sp.t_from_distance( Vxy(data['v_mask_centroid_image']), measurement.optic_screen_dist, self.camera, - self.display.v_cam_screen_cam, + self.orientation.v_cam_screen_cam, ).data.squeeze() # Test @@ -67,7 +65,7 @@ def test_r_from_position(self): # Perform calculation r_optic_cam_exp = ( sp.r_from_position( - Vxyz(data['v_cam_optic_cam_exp']), self.display.v_cam_screen_cam + Vxyz(data['v_cam_optic_cam_exp']), self.orientation.v_cam_screen_cam ) .inv() .as_rotvec() @@ -115,11 +113,11 @@ def test_distance_error(self): # Load test data data = load_hdf5_datasets(datasets, self.data_file_facet) - measurement = Measurement.load_from_hdf(self.data_file_measurement) + measurement = MeasurementSofastFringe.load_from_hdf(self.data_file_measurement) # Perform calculation error_optic_screen_dist_2 = sp.distance_error( - self.display.v_cam_screen_cam, + self.orientation.v_cam_screen_cam, Vxyz(data['v_cam_optic_cam_refine_2']), measurement.optic_screen_dist, ) @@ -162,7 +160,7 @@ def test_refine_v_distance(self): # Load test data data = load_hdf5_datasets(datasets, self.data_file_facet) - measurement = Measurement.load_from_hdf(self.data_file_measurement) + measurement = MeasurementSofastFringe.load_from_hdf(self.data_file_measurement) # Perform calculation r_cam_optic = Rotation.from_rotvec(data['r_optic_cam_refine_1']) @@ -170,7 +168,7 @@ def test_refine_v_distance(self): v_cam_optic_cam_refine_2 = sp.refine_v_distance( Vxyz(data['v_cam_optic_cam_refine_1']), measurement.optic_screen_dist, - self.display.v_cam_screen_cam, + self.orientation.v_cam_screen_cam, v_meas_pt_optic_cam, ).data.squeeze() diff --git a/opencsp/common/lib/deflectometry/test/test_SlopeSolver.py b/opencsp/common/lib/deflectometry/test/test_SlopeSolver.py index beb5e0ddb..7d6b422fd 100644 --- a/opencsp/common/lib/deflectometry/test/test_SlopeSolver.py +++ b/opencsp/common/lib/deflectometry/test/test_SlopeSolver.py @@ -7,10 +7,7 @@ import numpy as np from scipy.spatial.transform import Rotation -from opencsp.app.sofast.lib.DisplayShape import DisplayShape as Display -from opencsp.app.sofast.lib.MeasurementSofastFringe import ( - MeasurementSofastFringe as Measurement, -) +from opencsp.app.sofast.lib.MeasurementSofastFringe import MeasurementSofastFringe from opencsp.app.sofast.lib.SpatialOrientation import SpatialOrientation from opencsp.common.lib.deflectometry.SlopeSolver import SlopeSolver from opencsp.common.lib.deflectometry.Surface2DParabolic import Surface2DParabolic @@ -46,13 +43,12 @@ def setUpClass(cls): ] # Load data data = load_hdf5_datasets(datasets, cls.data_file_facet) - display = Display.load_from_hdf(cls.data_file_facet) - measurement = Measurement.load_from_hdf(data_file_measurement) + measurement = MeasurementSofastFringe.load_from_hdf(data_file_measurement) + ori = SpatialOrientation.load_from_hdf(cls.data_file_facet) # Create spatial orientation object r_cam_optic = Rotation.from_rotvec(data['r_optic_cam_refine_1']).inv() v_cam_optic_cam = Vxyz(data['v_cam_optic_cam_refine_2']) - ori = SpatialOrientation(display.r_cam_screen, display.v_cam_screen_cam) ori.orient_optic_cam(r_cam_optic, v_cam_optic_cam) # Perform calculations