Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes so PRs can pass required CI checks #46

Merged
merged 5 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 6 additions & 7 deletions .github/workflows/docs_check.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: github-DOCS

on:
push
#pull_request:
# paths-ignore:
# - '**/*.rst'
# - '**/*.md'
# - 'doc/**'
# types: [ opened, reopened, synchronize ]
pull_request:
paths-ignore:
- '**/*.rst'
- '**/*.md'
- 'doc/**'
types: [ opened, reopened, synchronize ]

permissions:
contents: none
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ jobs:
- name: Black formatting check
run: |
pip install black
black . -S -C --check --diff
cd OpenCSP
black . -S -C --check --diff --config ./pyproject.toml
21 changes: 5 additions & 16 deletions contrib/app/sofast/load_saved_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,20 @@ def load_ideal_facet_ensemble_from_hdf(file: str, focal_length: float) -> FacetE
file,
)
vs_facet_loc = Vxyz(data_ensemble['v_facet_locations'])
rs_facet_ensemble = [
Rotation.from_rotvec(v) for v in data_ensemble['r_facet_ensemble']
]
rs_facet_ensemble = [Rotation.from_rotvec(v) for v in data_ensemble['r_facet_ensemble']]

# Load ensemble definition data
num_facets = len(vs_facet_loc)
facets = []
for idx_facet in range(num_facets):
data = load_hdf5_datasets(
[f'DataSofastInput/optic_definition/facet_{idx_facet:03d}/v_facet_corners'],
file,
)
data = load_hdf5_datasets([f'DataSofastInput/optic_definition/facet_{idx_facet:03d}/v_facet_corners'], file)

# Create mirror region
v_facet_corners = Vxy(data['v_facet_corners'][:2])
region_facet = RegionXY.from_vertices(v_facet_corners)

# Create mirror
mirror = MirrorParametric.generate_symmetric_paraboloid(
focal_length, region_facet
)
mirror = MirrorParametric.generate_symmetric_paraboloid(focal_length, region_facet)

# Create facet
facet = Facet(mirror)
Expand Down Expand Up @@ -98,9 +91,7 @@ def load_facet_ensemble_from_hdf(file: str) -> FacetEnsemble:
"rotation_defined" Ensemble.
"""
# Get number of facets
data_ensemble = load_hdf5_datasets(
['DataSofastInput/optic_definition/ensemble/v_facet_locations'], file
)
data_ensemble = load_hdf5_datasets(['DataSofastInput/optic_definition/ensemble/v_facet_locations'], file)
num_facets = data_ensemble['v_facet_locations'].shape[1]

facets = []
Expand Down Expand Up @@ -160,9 +151,7 @@ def load_ideal_facet_from_hdf(file: str, focal_length: float) -> Facet:
Reference facet representation. Defined as "rotation_defined."
"""
# Load facet corners
data = load_hdf5_datasets(
['DataSofastInput/optic_definition/facet_000/v_facet_corners'], file
)
data = load_hdf5_datasets(['DataSofastInput/optic_definition/facet_000/v_facet_corners'], file)

# Create mirror
v_facet_corners = Vxy(data['v_facet_corners'][:2])
Expand Down
23 changes: 5 additions & 18 deletions contrib/app/sofast/run_and_characterize_sofast_1_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ def main():
# Define file locations
data_dir = '../../sofast_2_system_calibration_files/'

file_image_projection = os.path.join(
data_dir, 'Image_Projection_optics_lab_landscape_rectangular.h5'
)
file_image_projection = os.path.join(data_dir, 'Image_Projection_optics_lab_landscape_rectangular.h5')
file_display = os.path.join(data_dir, 'Display_optics_lab_landscape_distorted2D.h5')
file_camera = os.path.join(data_dir, 'Camera_optics_lab_landscape.h5')
file_facet = os.path.join(data_dir, 'Facet_NSTTF.json')
Expand All @@ -48,10 +46,7 @@ def main():

# Define surface fitting parameters
surface_data = dict(
surface_type='parabolic',
initial_focal_lengths_xy=(100.0, 100.0),
robust_least_squares=False,
downsample=10,
surface_type='parabolic', initial_focal_lengths_xy=(100.0, 100.0), robust_least_squares=False, downsample=10
)

# Create fringe object
Expand Down Expand Up @@ -83,19 +78,13 @@ def func_calibrate_exposure():
# Capture calibration data
def func_capture_calibration_frames():
print('Capturing display-camera response calibration data')
system.run_display_camera_response_calibration(
res=10, run_next=system.run_next_in_queue
)
system.run_display_camera_response_calibration(res=10, run_next=system.run_next_in_queue)

# Process calibration data
def func_process_calibration_data():
print('Processing calibration data')
calibration_images = system.get_calibration_images()
calibrations.append(
ImageCalibrationScaling.from_data(
calibration_images[0], system.calibration_display_values
)
)
calibrations.append(ImageCalibrationScaling.from_data(calibration_images[0], system.calibration_display_values))
system.run_next_in_queue()

# Load fringe object
Expand Down Expand Up @@ -137,9 +126,7 @@ def func_close_all():
print('Saving Data')

# Get Measurement object
measurement = system.get_measurements(
optic_measure_point, optic_screen_dist, optic_name
)[0]
measurement = system.get_measurements(optic_measure_point, optic_screen_dist, optic_name)[0]
calibration = calibrations[0]

# Process data
Expand Down
31 changes: 7 additions & 24 deletions contrib/app/sofast/run_and_characterize_sofast_2_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,12 @@ def main():
# Define file locations
data_dir = '../../sofast_2_system_calibration_files/'

file_image_projection = os.path.join(
data_dir, 'Image_Projection_optics_lab_landscape_rectangular.h5'
)
file_image_projection = os.path.join(data_dir, 'Image_Projection_optics_lab_landscape_rectangular.h5')

file_display_0 = os.path.join(
data_dir, 'Display_optics_lab_landscape_distorted2D.h5'
)
file_display_0 = os.path.join(data_dir, 'Display_optics_lab_landscape_distorted2D.h5')
file_camera_0 = os.path.join(data_dir, 'Camera_optics_lab_landscape.h5')

file_display_1 = os.path.join(
data_dir, 'Display_optics_lab_landscape_distorted2D.h5'
)
file_display_1 = os.path.join(data_dir, 'Display_optics_lab_landscape_distorted2D.h5')
file_camera_1 = os.path.join(data_dir, 'Camera_optics_lab_landscape.h5')

file_facet = os.path.join(data_dir, 'Facet_NSTTF.json')
Expand All @@ -66,10 +60,7 @@ def main():
# Define surface fitting parameters
surface_data = [
dict(
surface_type='parabolic',
initial_focal_lengths_xy=(100.0, 100.0),
robust_least_squares=False,
downsample=10,
surface_type='parabolic', initial_focal_lengths_xy=(100.0, 100.0), robust_least_squares=False, downsample=10
)
]

Expand Down Expand Up @@ -108,20 +99,14 @@ def func_calibrate_exposure():
# Capture calibration data
def func_capture_calibration_frames():
print('Capturing display-camera response calibration data')
system.run_display_camera_response_calibration(
res=10, run_next=system.run_next_in_queue
)
system.run_display_camera_response_calibration(res=10, run_next=system.run_next_in_queue)

# Process calibration data
def func_process_calibration_data():
print('Processing calibration data')
calibration_images = system.get_calibration_images()
for ims in calibration_images:
calibrations.append(
ImageCalibrationScaling.from_data(
ims, system.calibration_display_values
)
)
calibrations.append(ImageCalibrationScaling.from_data(ims, system.calibration_display_values))
system.run_next_in_queue()

# Load fringe object
Expand Down Expand Up @@ -167,9 +152,7 @@ def func_close_all():
print('Saving Data')

# Get Measurement object
measurements = system.get_measurements(
optic_measure_point, optic_screen_dist, optic_name
)
measurements = system.get_measurements(optic_measure_point, optic_screen_dist, optic_name)

# Process data
print('Processing data')
Expand Down
21 changes: 5 additions & 16 deletions contrib/app/ufacet-s/UfacetFlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,12 @@ class UfacetFlight:
]
_flights: dict[str, "UfacetFlight"] = {}

def __init__(
self, name: str, extracted_frames_name_format: str, extracted_frames_dir: str
):
def __init__(self, name: str, extracted_frames_name_format: str, extracted_frames_dir: str):
"""This class holds onto relevant information for a variety of UFACET flights."""
self._name = name

self._frames_name_format_extracted = extracted_frames_name_format
self._frames_dir_extracted = os.path.join(
orp.opencsp_scratch_dir("ufacetnio"), extracted_frames_dir
)
self._frames_dir_extracted = os.path.join(orp.opencsp_scratch_dir("ufacetnio"), extracted_frames_dir)
self._num_frames_extracted: int = None

self._frames_name_format_deduplicated = None
Expand Down Expand Up @@ -147,9 +143,7 @@ def video_dir_name_ext(self, allow_ppt_compressed_videos=False):
# check for a similar name
else:
exp = f"{video_dir}/{video_name}*{video_extension}"
lt.debug(
f"In UfacetFlight.video_dir_name_ext(): searching for videos matching the expression \"{exp}\""
)
lt.debug(f"In UfacetFlight.video_dir_name_ext(): searching for videos matching the expression \"{exp}\"")
matches = list(glob.glob(exp))
to_remove, to_append_to_end = [], []
for m in matches:
Expand Down Expand Up @@ -226,15 +220,10 @@ def frame_name_ext_deduplicated(self, frame_number: int):
return self.frames_name_format_deduplicated() % frame_number

def frame_path_name_ext_extracted(self, frame_number: int):
return os.path.join(
self.frames_dir_extracted(), self.frame_name_ext_extracted(frame_number)
)
return os.path.join(self.frames_dir_extracted(), self.frame_name_ext_extracted(frame_number))

def frame_path_name_ext_deduplicated(self, frame_number: int):
return os.path.join(
self.frames_dir_deduplicated(),
self.frame_name_ext_deduplicated(frame_number),
)
return os.path.join(self.frames_dir_deduplicated(), self.frame_name_ext_deduplicated(frame_number))

def _count_frames(self, path: str, name_format: str):
if ft.directory_exists(path, follow_symlinks=True):
Expand Down
Loading