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

Sofast Fixed multi facet capability #164

Merged
merged 54 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b4fd325
Reorganized ProcessSofastFixed function names.
braden6521 Aug 19, 2024
8d1be2e
Added optic_type and num_facets to process_single_facet_optic
braden6521 Aug 19, 2024
bc2cb49
Surface and facet data are now lists.
braden6521 Aug 19, 2024
f22b8fc
Data surface and facet data are lists.
braden6521 Aug 19, 2024
32e4a79
Updated documentation in PSF
braden6521 Aug 19, 2024
5ff9374
fixed docs in process_optics_geometry
braden6521 Aug 19, 2024
64e532d
Updated test sofast fixed (for single facet only)
braden6521 Aug 19, 2024
b924dd7
Fixed documentation in PSFr
braden6521 Aug 19, 2024
b5e8bcb
Made slope_solver and data lists in PSFi
braden6521 Aug 19, 2024
0ca1398
First implimentation of PSFi multi
braden6521 Aug 19, 2024
4409986
Updated documentation and typing in PSFi.
braden6521 Aug 19, 2024
1d2ebcf
Fixed error in process_optics_geometry when finding expected ensemble…
braden6521 Aug 21, 2024
9bdbfe9
Updated mask histogram calculations in image_processing.
braden6521 Aug 21, 2024
c688cce
Fixed error with variable name in calc_mask_raw
braden6521 Aug 21, 2024
1d9fb9c
Changed surface to surfaces
braden6521 Aug 21, 2024
24aaf37
ProcessSofastFixed now takes in origin point and xy index as input fo…
braden6521 Aug 21, 2024
f66761f
Added docs, stub, and checks to blobIndex
braden6521 Aug 21, 2024
46cbf3d
Added get-data_in_region to BlobIndex
braden6521 Aug 22, 2024
0e911d5
Added facet pointing and ensemble output to processSofastFixed
braden6521 Aug 22, 2024
f8ad6f5
Added check in FacetEnsemble that catches when corner z values cannot…
braden6521 Aug 22, 2024
e5a45af
Fixed testProcessSofastFixed
braden6521 Aug 22, 2024
7883af0
Made slope_solver attribute a list in ProcessSofastFixed
braden6521 Aug 22, 2024
289e961
Fixed test_SofastConfiguration
braden6521 Aug 22, 2024
45801e8
Fixed calibrateSofastFixedDots
braden6521 Aug 22, 2024
8e58a69
Updated Facet so that if z values cannot be interpolated for corners,…
braden6521 Aug 22, 2024
bb9d945
Added test ensemble HDF5 input and output files
braden6521 Aug 22, 2024
ef2413c
Reduced size of single facet fixed test data
braden6521 Aug 22, 2024
7900855
Added facet and ensemble definitions for SFi
braden6521 Aug 22, 2024
b37a01f
Fixed _000 prefix in SofastFixed HDF5 save output
braden6521 Aug 22, 2024
3553e1b
Updated testProcessSofastFixed to include ensemble testing.
braden6521 Aug 22, 2024
2a0d0ee
Unified PSFr and PSFi data container names
braden6521 Aug 22, 2024
90e6b48
Changed get_mirror to get_optic in SFi
braden6521 Aug 22, 2024
0924ae7
Changed slope_solver to slope_solvers
braden6521 Aug 22, 2024
00a1748
Instantiated ProcessSofastAbstract and integrated into SFr and SFi
braden6521 Aug 22, 2024
f1a5257
Added save_to_hdf to PSA.
braden6521 Aug 22, 2024
b0cbd4a
Added facet pointing test data to SFi calcultion HDF5
braden6521 Aug 22, 2024
ac67069
Added facet pointing test to SFi test
braden6521 Aug 22, 2024
d3d63c1
Moved get_optic and _calculate_facet_pointing methods to abstract pro…
braden6521 Aug 22, 2024
61a4e42
Updated all calls to data_characterization_facet to data_calculation_…
braden6521 Aug 22, 2024
6fc92cd
Revert of removing ABC from OO
braden6521 Aug 22, 2024
6dd5d97
Fixed reference to slope_solver and slope_solver_data in SofastConfig…
braden6521 Aug 22, 2024
71ba3a6
Fixed typing in generate_dataset()
braden6521 Oct 8, 2024
6c226ac
Got rid or explianed 'magic numbers' in example process facet ensembl…
braden6521 Oct 8, 2024
43c6422
Added typing argument in ProcessSofastFringe
braden6521 Oct 8, 2024
99d7d0d
Used Enum in BlobIndex step.
braden6521 Oct 8, 2024
0d6be36
Fixed typo in Processsofastabstract
braden6521 Oct 8, 2024
c6a83b8
Updated readability in ProcessSofastAbstract
braden6521 Oct 8, 2024
4f38436
Updated typing in PSF
braden6521 Oct 8, 2024
0c35060
Updated documentation in test PSF
braden6521 Oct 8, 2024
d798e1c
updated docs in test_sofastConfiguration
braden6521 Oct 8, 2024
0591705
updated docs in FacetEnsemble
braden6521 Oct 8, 2024
14ab577
Updated calculated facet hdf5
braden6521 Oct 8, 2024
3d7640c
Fixed typo
braden6521 Oct 9, 2024
18e7b4e
Added defaults in docstrings
braden6521 Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def generate_dataset(
image = np.zeros(mask.shape) * np.nan
for idx in range(sofast.num_facets):
mask = sofast.data_image_processing_facet[idx].mask_processed
slopes_xy = sofast.data_characterization_facet[idx].slopes_facet_xy
slopes_xy = sofast.data_calculation_facet[idx].slopes_facet_xy
slopes = np.sqrt(np.sum(slopes_xy**2, 0))
image[mask] = slopes
plt.figure()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from os.path import join, dirname, exists
from typing import Literal
from typing import Literal, Final

import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -73,8 +73,9 @@ def generate_dataset(
print(f'All data saved to: {file_dataset_out:s}')

# Show slope map
mask = sofast.data_image_processing_facet[0].mask_processed
slopes_xy = sofast.data_characterization_facet[0].slopes_facet_xy
idx_facet: Final = 0
mask = sofast.data_image_processing_facet[idx_facet].mask_processed
slopes_xy = sofast.data_calculation_facet[idx_facet].slopes_facet_xy
slopes = np.sqrt(np.sum(slopes_xy**2, 0))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same as above for 2

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a duplicate of above?

image = np.zeros(mask.shape) * np.nan
image[mask] = slopes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def generate_dataset(

# Show slope map
mask = sofast.data_image_processing_facet[0].mask_processed
slopes_xy = sofast.data_characterization_facet[0].slopes_facet_xy
slopes_xy = sofast.data_calculation_facet[0].slopes_facet_xy
slopes = np.sqrt(np.sum(slopes_xy**2, 0))
image = np.zeros(mask.shape) * np.nan
image[mask] = slopes
Expand Down
20 changes: 9 additions & 11 deletions example/sofast_fringe/example_process_facet_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from opencsp.app.sofast.lib.MeasurementSofastFringe import MeasurementSofastFringe
from opencsp.app.sofast.lib.ProcessSofastFringe import ProcessSofastFringe
from opencsp.app.sofast.lib.SpatialOrientation import SpatialOrientation
from opencsp.app.sofast.lib.SofastConfiguration import SofastConfiguration
from opencsp.common.lib.camera.Camera import Camera
from opencsp.common.lib.csp.FacetEnsemble import FacetEnsemble
from opencsp.common.lib.deflectometry.Surface2DParabolic import Surface2DParabolic
Expand Down Expand Up @@ -132,21 +133,16 @@ def example_process_facet_ensemble():
data['robust_least_squares'] = bool(data['robust_least_squares'])
surfaces.append(Surface2DParabolic(**data))

# Update search parameters
# sofast.params.mask_hist_thresh = 0.83
# sofast.params.geometry.perimeter_refine_perpendicular_search_dist = 15.0
# sofast.params.geometry.facet_corns_refine_frac_keep = 1.0
# sofast.params.geometry.facet_corns_refine_perpendicular_search_dist = 3.0
# sofast.params.geometry.facet_corns_refine_step_length = 5.0

# Process
sofast.process_optic_multifacet(facet_data, ensemble_data, surfaces)

# 3. Log best-fit parabolic focal lengths
# =======================================
for idx in range(sofast.num_facets):
surf_coefs = sofast.data_characterization_facet[idx].surf_coefs_facet
focal_lengths_xy = [1 / 4 / surf_coefs[2], 1 / 4 / surf_coefs[5]]
sofast_config = SofastConfiguration()
sofast_config.load_sofast_object(sofast)
sofast_stats = sofast_config.get_measurement_stats()
for stat in sofast_stats:
focal_lengths_xy = stat['focal_lengths_parabolic_xy']
lt.info(f'Facet {idx:d} xy focal lengths (meters): {focal_lengths_xy[0]:.3f}, {focal_lengths_xy[1]:.3f}')

# 4. Plot slope magnitude
Expand All @@ -165,8 +161,10 @@ def example_process_facet_ensemble():
axis_control_m = rca.meters()

# Plot slope map
res = 0.002 # meter, make the plot with 2mm spatial resolution
clim = 7 # mrad, draw the plot with +/-7mrad scale bars, this mirror has erorrs that extend to about +/-7mrad
fig_record = fm.setup_figure(figure_control, axis_control_m, title='')
ensemble.plot_orthorectified_slope(res=0.002, clim=7, axis=fig_record.axis)
ensemble.plot_orthorectified_slope(res=res, clim=clim, axis=fig_record.axis)
fig_record.save(dir_save, 'slope_magnitude', 'png')

# 5. Plot 3d representation of facet ensemble
Expand Down
2 changes: 1 addition & 1 deletion example/sofast_fringe/example_process_single_facet.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def example_process_single_facet():

# 3. Log best-fit parabolic focal lengths
# =======================================
surf_coefs = sofast.data_characterization_facet[0].surf_coefs_facet
surf_coefs = sofast.data_calculation_facet[0].surf_coefs_facet
focal_lengths_xy = [1 / 4 / surf_coefs[2], 1 / 4 / surf_coefs[5]]
lt.info(f'Facet xy focal lengths (meters): ' f'{focal_lengths_xy[0]:.3f}, {focal_lengths_xy[1]:.3f}')

Expand Down
2 changes: 1 addition & 1 deletion example/sofast_fringe/example_process_undefined_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def example_process_undefined_shape_facet():

# 3. Log best-fit parabolic focal lengths
# =======================================
surf_coefs = sofast.data_characterization_facet[0].surf_coefs_facet
surf_coefs = sofast.data_calculation_facet[0].surf_coefs_facet
focal_lengths_xy = [1 / 4 / surf_coefs[2], 1 / 4 / surf_coefs[5]]
lt.info(f'Facet xy focal lengths (meters): ' f'{focal_lengths_xy[0]:.3f}, {focal_lengths_xy[1]:.3f}')

Expand Down
Loading