Skip to content

Commit

Permalink
Formatted four files to be Black compliant.
Browse files Browse the repository at this point in the history
  • Loading branch information
braden6521 committed Mar 25, 2024
1 parent b27df4e commit 63775b8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def example_run_camera_position_calibration(save_dir: str):
"""Calibrates the relative position of the Sofast camera and display.
"""Calibrates the relative position of the Sofast camera and display.
Saves the rvec/tvec in a SpatialOrientation file at ./data/output/spatial_orientation.h5
"""
# Define directory where screen shape calibration data is saved
Expand Down
22 changes: 5 additions & 17 deletions opencsp/app/sofast/lib/DisplayShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,33 +177,24 @@ def load_from_hdf(cls, file: str, prefix: str = '') -> 'DisplayShape':
Prefix to append to folder path within HDF file (folders must be separated by "/")
"""
# Load grid data
datasets = [
prefix + 'DisplayShape/screen_model',
prefix + 'DisplayShape/name',
]
datasets = [prefix + 'DisplayShape/screen_model', prefix + 'DisplayShape/name']
data = ht.load_hdf5_datasets(datasets, file)

# Rectangular
if data['screen_model'] == 'rectangular2D':
datasets = ['DisplayShape/screen_x', 'DisplayShape/screen_y']
datasets = [prefix + 'DisplayShape/screen_x', prefix + 'DisplayShape/screen_y']
grid_data = ht.load_hdf5_datasets(datasets, file)

# Distorted 2D
elif data['screen_model'] == 'distorted2D':
datasets = [
'DisplayShape/xy_screen_fraction',
'DisplayShape/xy_screen_coords',
]
datasets = [prefix + 'DisplayShape/xy_screen_fraction', prefix + 'DisplayShape/xy_screen_coords']
grid_data = ht.load_hdf5_datasets(datasets, file)
grid_data['xy_screen_fraction'] = Vxy(grid_data['xy_screen_fraction'])
grid_data['xy_screen_coords'] = Vxy(grid_data['xy_screen_coords'])

# Distorted 3D
elif data['screen_model'] == 'distorted3D':
datasets = [
'DisplayShape/xy_screen_fraction',
'DisplayShape/xyz_screen_coords',
]
datasets = [prefix + 'DisplayShape/xy_screen_fraction', prefix + 'DisplayShape/xyz_screen_coords']
grid_data = ht.load_hdf5_datasets(datasets, file)
grid_data['xy_screen_fraction'] = Vxy(grid_data['xy_screen_fraction'])
grid_data['xyz_screen_coords'] = Vxyz(grid_data['xyz_screen_coords'])
Expand All @@ -213,10 +204,7 @@ def load_from_hdf(cls, file: str, prefix: str = '') -> 'DisplayShape':

grid_data.update({'screen_model': data['screen_model']})
# Return display object
kwargs = {
'name': data['name'],
'grid_data': grid_data,
}
kwargs = {'name': data['name'], 'grid_data': grid_data}
return cls(**kwargs)

def save_to_hdf(self, file: str, prefix: str = '') -> None:
Expand Down
8 changes: 3 additions & 5 deletions opencsp/app/sofast/lib/ProcessSofastFringe.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,9 @@ class ProcessSofastFringe(HDF5_SaveAbstract):
- v_mask_centroid_image
"""

def __init__(self,
measurement: MeasurementSofastFringe,
orientation: SpatialOrientation,
camera: Camera,
display: Display) -> 'ProcessSofastFringe':
def __init__(
self, measurement: MeasurementSofastFringe, orientation: SpatialOrientation, camera: Camera, display: Display
) -> 'ProcessSofastFringe':
"""
SOFAST processing class.
Expand Down
5 changes: 1 addition & 4 deletions opencsp/app/sofast/lib/SpatialOrientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ def load_from_hdf(cls, file: str, prefix: str = '') -> 'SpatialOrientation':

# If optic is oriented, load optic orientation information
if data['optic_oriented']:
datasets = [
prefix + 'SpatialOrientation/r_cam_optic',
prefix + 'SpatialOrientation/v_cam_optic_cam',
]
datasets = [prefix + 'SpatialOrientation/r_cam_optic', prefix + 'SpatialOrientation/v_cam_optic_cam']
data = ht.load_hdf5_datasets(datasets, file)
r_cam_optic = Rotation.from_rotvec(data['r_cam_optic'])
v_cam_optic_cam = Vxyz(data['v_cam_optic_cam'])
Expand Down

0 comments on commit 63775b8

Please sign in to comment.