Skip to content

Commit

Permalink
Merge branch 'develop' into sofast_fixed_point_light
Browse files Browse the repository at this point in the history
  • Loading branch information
braden6521 authored Apr 4, 2024
2 parents d4221a7 + f7e798c commit 7f95e0a
Show file tree
Hide file tree
Showing 32 changed files with 572 additions and 302 deletions.
4 changes: 2 additions & 2 deletions contrib/app/sofast/run_and_characterize_sofast_1_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def main():
output_file = None

# Define measurement parameters
optic_screen_dist = 10.516 # meter
dist_optic_screen = 10.516 # meter
optic_name = 'NSTTF Facet'
optic_measure_point = Pxyz((0, 0, 0)) # meter

Expand Down Expand Up @@ -126,7 +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, dist_optic_screen, optic_name)[0]
calibration = calibrations[0]

# Process data
Expand Down
4 changes: 2 additions & 2 deletions contrib/app/sofast/run_and_characterize_sofast_2_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def main():
output_file_base = None

# Define measurement parameters
optic_screen_dist = 10.516 # meter
dist_optic_screen = 10.516 # meter
optic_name = 'NSTTF Facet'
optic_measure_point = Pxyz((0, 0, 0)) # meter

Expand Down Expand Up @@ -152,7 +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, dist_optic_screen, optic_name)

# Process data
print('Processing data')
Expand Down
15 changes: 11 additions & 4 deletions contrib/scripts/sensitive_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from opencsp.common.lib.opencsp_path import opencsp_settings
import opencsp.common.lib.opencsp_path.opencsp_root_path as orp
import opencsp.common.lib.process.subprocess_tools as st
import opencsp.common.lib.tool.exception_tools as et
import opencsp.common.lib.tool.file_tools as ft
import opencsp.common.lib.tool.hdf5_tools as h5
import opencsp.common.lib.tool.image_tools as it
Expand Down Expand Up @@ -124,15 +125,21 @@ def _is_binary_file(self, file_path: str, file_name_ext: str):

return is_binary_file

def _enqueue_binary_file_for_later_processing(self, file_path: str, file_name_ext: str):
def _enqueue_unknown_binary_files_for_later_processing(self, file_path: str, file_name_ext: str):
"""If the given file is recognized as an allowed file, and it's fingerprint matches the allowed file, then we
can dismiss it from the list of unfound files and add it to the list of the accepted files.
However, if the given file isn't recognized or it's fingerprint is different, then add it to the unknown list,
to be dealt with later."""
file_ff = ff.FileFingerprint.for_file(self.root_search_dir, file_path, file_name_ext)

if file_ff in self.allowed_binary_files:
# we already know and trust this binary file
self.unfound_allowed_binary_files.remove(file_ff)
with et.ignored(ValueError):
self.unfound_allowed_binary_files.remove(file_ff)
self.accepted_binary_files.append(file_ff)
else:
# we'll deal with unknown files as a group
# we'll deal with unknown files as a group later
self.unknown_binary_files.append(file_ff)

def parse_file(self, file_path: str, file_name_ext: str) -> list[str]:
Expand Down Expand Up @@ -437,7 +444,7 @@ def search_files(self):
# need to check this file
if self._is_binary_file(file_path, file_name_ext):
# deal with non-parseable binary files as a group, below
self._enqueue_binary_file_for_later_processing(file_path, file_name_ext)
self._enqueue_unknown_binary_files_for_later_processing(file_path, file_name_ext)
else:
# check text files for sensitive strings
file_matches = self.search_file(file_path, file_name_ext)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
relative path,name_ext,size,hash
c,img1.png,1,01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
c,img2.jpg,1,01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
c,img1.png,19,37b29d95963d70c6c969272b7b03b9ca4e4a832c86ef059768b15293be74582c
c,img2.jpg,4,6987740fb624e3e9943ec5d9ac5519b72cea1b35fb4bde5719df3923a36c08f7
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
relative path,name_ext,size,hash
c,img1.png,1,01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
c,img1.png,19,37b29d95963d70c6c969272b7b03b9ca4e4a832c86ef059768b15293be74582c
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions contrib/test_data_generation/sofast_fringe/downsample_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys

from opencsp.app.sofast.lib.MeasurementSofastFringe import MeasurementSofastFringe as Measurement
import opencsp.app.sofast.lib.DistanceOpticScreen as osd
from opencsp.common.lib.opencsp_path.opencsp_root_path import opencsp_code_dir

sys.path.append(os.path.join(opencsp_code_dir(), '..'))
Expand All @@ -31,13 +32,15 @@ def downsample_measurement(file: str, n: int) -> Measurement:
# Downsample measurement
mask_images = ddg.downsample_images(measurement_orig.mask_images, n)
fringe_images = ddg.downsample_images(measurement_orig.fringe_images, n)
dist_optic_screen_measure = osd.DistanceOpticScreen(
measurement_orig.v_measure_point_facet, measurement_orig.dist_optic_screen
)
return Measurement(
mask_images=mask_images,
fringe_images=fringe_images,
fringe_periods_x=measurement_orig.fringe_periods_x,
fringe_periods_y=measurement_orig.fringe_periods_y,
measure_point=measurement_orig.measure_point,
optic_screen_dist=measurement_orig.optic_screen_dist,
dist_optic_screen_measure=dist_optic_screen_measure,
date=measurement_orig.date,
name=measurement_orig.name,
)
6 changes: 3 additions & 3 deletions example/sofast_fixed/run_and_characterize_fixed_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from opencsp.app.sofast.lib.DotLocationsFixedPattern import DotLocationsFixedPattern
from opencsp.app.sofast.lib.MeasurementSofastFixed import MeasurementSofastFixed
import opencsp.app.sofast.lib.DistanceOpticScreen as osd
from opencsp.app.sofast.lib.ProcessSofastFixed import ProcessSofastFixed
from opencsp.app.sofast.lib.SystemSofastFixed import SystemSofastFixed
from opencsp.common.lib.camera.Camera import Camera
Expand Down Expand Up @@ -102,9 +103,8 @@ def run_next():
# Capture image
frame = image_acquisition.get_frame()
# Process
measurement = MeasurementSofastFixed(
frame, v_measure_point_facet, dist_optic_screen, pt_origin, name='NSTTF Facet'
)
dist_optic_screen_measure = osd.DistanceOpticScreen(v_measure_point_facet, dist_optic_screen)
measurement = MeasurementSofastFixed(frame, dist_optic_screen_measure, pt_origin, name='NSTTF Facet')
process(fixed_pattern_dot_locs, spatial_orientation, camera, facet_data, measurement, surface_data)
# Continue or exit
image_projection.root.after(200, run_next)
Expand Down
5 changes: 3 additions & 2 deletions opencsp/app/camera_calibration/CameraCalibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from opencsp.common.lib.camera.Camera import Camera
from opencsp.common.lib.geometry.Vxy import Vxy
from opencsp.common.lib.geometry.Vxyz import Vxyz
import opencsp.common.lib.tool.tk_tools as tkt


class CalibrationGUI:
Expand All @@ -29,7 +30,7 @@ def __init__(self):
"""
# Create tkinter object
self.root = tkinter.Tk()
self.root = tkt.window()

# Set title
self.root.title('Camera Calibration')
Expand Down Expand Up @@ -275,7 +276,7 @@ def find_corners(self):

def view_found_corners(self):
# Create new window
root_corns = tkinter.Toplevel(self.root)
root_corns = tkt.window(self.root, TopLevel=True)

# Get number checkerboard points
npts = self.get_npts()
Expand Down
4 changes: 3 additions & 1 deletion opencsp/app/select_image_points/SelectImagePoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import numpy as np
import rawpy

import opencsp.common.lib.tool.tk_tools as tkt


class SelectImagePoints:
"""
Expand Down Expand Up @@ -200,5 +202,5 @@ def _load_raw_image(file) -> np.ndarray:
)
if file_selected != '':
# Create window
win = SelectImagePoints(tk.Tk(), file_selected)
win = SelectImagePoints(tkt.window(), file_selected)
win.run()
Loading

0 comments on commit 7f95e0a

Please sign in to comment.