Skip to content

Commit

Permalink
Updated SPO to not save numbers in name. Updated unit test and data.
Browse files Browse the repository at this point in the history
  • Loading branch information
braden6521 committed Jun 26, 2024
1 parent 7f8fbb8 commit 7e3bef0
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 29 deletions.
42 changes: 31 additions & 11 deletions opencsp/common/lib/csp/StandardPlotOutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class _OptionsFileOutput:
save_dpi: int = 200
save_format: str = 'png'
close_after_save: bool = False
number_in_name: bool = True


@dataclass
Expand Down Expand Up @@ -200,7 +201,12 @@ def _plot_slope_deviation(self):
quiver_colors = self._process_plot_options(self.options_slope_vis.quiver_color)

# Slope magnitude
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name="Slope Deviation Magnitude")
fig_rec = fm.setup_figure(
self.fig_control,
self.axis_control,
name="Slope Deviation Magnitude",
number_in_name=self.options_file_output.number_in_name,
)
self.optic_measured.plot_orthorectified_slope_error(
self.optic_reference,
self.options_slope_vis.resolution,
Expand All @@ -220,7 +226,9 @@ def _plot_slope_deviation(self):
)

# Slope x
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name="Slope Deviation X")
fig_rec = fm.setup_figure(
self.fig_control, self.axis_control, name="Slope Deviation X", number_in_name=False
)
self.optic_measured.plot_orthorectified_slope_error(
self.optic_reference,
self.options_slope_vis.resolution,
Expand All @@ -240,7 +248,9 @@ def _plot_slope_deviation(self):
)

# Slope Y
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name="Slope Deviation Y")
fig_rec = fm.setup_figure(
self.fig_control, self.axis_control, name="Slope Deviation Y", number_in_name=False
)
self.optic_measured.plot_orthorectified_slope_error(
self.optic_reference,
self.options_slope_vis.resolution,
Expand Down Expand Up @@ -273,7 +283,7 @@ def _plot_ray_trace_image_reference_optic(self):

def _plot_enclosed_energy(self):
"""Makes measured and/or reference enclosed energy plots"""
fig_rec = fm.setup_figure(self.fig_control, name='Ensquared Energy')
fig_rec = fm.setup_figure(self.fig_control, name='Ensquared Energy', number_in_name=False)

# Dray reference if available
if self._ray_trace_output_reference is not None:
Expand Down Expand Up @@ -319,7 +329,9 @@ def _plot_curvature(self, optic: MirrorAbstract, suffix: str):
widths = self._process_plot_options(self.options_curvature_vis.smooth_kernel_width)

# Curvature combined
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name='Curvature Combined ' + suffix)
fig_rec = fm.setup_figure(
self.fig_control, self.axis_control, name='Curvature Combined ' + suffix, number_in_name=False
)
optic.plot_orthorectified_curvature(
res=self.options_curvature_vis.resolution,
type_='combined',
Expand All @@ -337,7 +349,9 @@ def _plot_curvature(self, optic: MirrorAbstract, suffix: str):
)

# Curvature X
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name='Curvature X ' + suffix)
fig_rec = fm.setup_figure(
self.fig_control, self.axis_control, name='Curvature X ' + suffix, number_in_name=False
)
optic.plot_orthorectified_curvature(
res=self.options_curvature_vis.resolution,
type_='x',
Expand All @@ -355,7 +369,9 @@ def _plot_curvature(self, optic: MirrorAbstract, suffix: str):
)

# Curvature Y
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name='Curvature Y ' + suffix)
fig_rec = fm.setup_figure(
self.fig_control, self.axis_control, name='Curvature Y ' + suffix, number_in_name=False
)
optic.plot_orthorectified_curvature(
res=self.options_curvature_vis.resolution,
type_='y',
Expand All @@ -379,7 +395,9 @@ def _plot_slope(self, optic: MirrorAbstract, suffix: str):
quiver_colors = self._process_plot_options(self.options_slope_vis.quiver_color)

# Slope Magnitude
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name="Slope Magnitude " + suffix)
fig_rec = fm.setup_figure(
self.fig_control, self.axis_control, name="Slope Magnitude " + suffix, number_in_name=False
)
optic.plot_orthorectified_slope(
self.options_slope_vis.resolution,
type_='magnitude',
Expand All @@ -398,7 +416,7 @@ def _plot_slope(self, optic: MirrorAbstract, suffix: str):
)

# X Slope
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name="Slope X " + suffix)
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name="Slope X " + suffix, number_in_name=False)
optic.plot_orthorectified_slope(
self.options_slope_vis.resolution,
type_='x',
Expand All @@ -417,7 +435,7 @@ def _plot_slope(self, optic: MirrorAbstract, suffix: str):
)

# Y Slope
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name="Slope Y " + suffix)
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name="Slope Y " + suffix, number_in_name=False)
optic.plot_orthorectified_slope(
self.options_slope_vis.resolution,
type_='y',
Expand All @@ -437,7 +455,9 @@ def _plot_slope(self, optic: MirrorAbstract, suffix: str):

def _plot_ray_trace_image(self, ray_trace_data: _RayTraceOutput, suffix: str):
# Draw sun image on target
fig_rec = fm.setup_figure(self.fig_control, self.axis_control, name='Ray Trace Image ' + suffix)
fig_rec = fm.setup_figure(
self.fig_control, self.axis_control, name='Ray Trace Image ' + suffix, number_in_name=False
)
fig_rec.axis.imshow(
ray_trace_data.histogram,
cmap='jet',
Expand Down
37 changes: 19 additions & 18 deletions opencsp/common/lib/csp/test/test_StandardPlotOutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def test_facet(self):
# Update file options
output.options_file_output.to_save = True
output.options_file_output.output_dir = dir_out
output.options_file_output.number_in_name = False

# Update raytrace options
output.options_ray_trace_vis.ensquared_energy_max_semi_width = 1
Expand All @@ -81,24 +82,24 @@ def test_facet(self):

# Get list of created plots
files = [
"001_Slope_Magnitude_measured_xy.png",
"002_Slope_X_measured_xy.png",
"003_Slope_Y_measured_xy.png",
"004_Curvature_Combined_measured_xy.png",
"005_Curvature_X_measured_xy.png",
"006_Curvature_Y_measured_xy.png",
"007_Slope_Magnitude_reference_xy.png",
"008_Slope_X_reference_xy.png",
"009_Slope_Y_reference_xy.png",
"010_Curvature_Combined_reference_xy.png",
"011_Curvature_X_reference_xy.png",
"012_Curvature_Y_reference_xy.png",
"013_Slope_Deviation_Magnitude_xy.png",
"014_Slope_Deviation_X_xy.png",
"015_Slope_Deviation_Y_xy.png",
"016_Ray_Trace_Image_measured_xy.png",
"017_Ray_Trace_Image_reference_xy.png",
"018_Ensquared_Energy_xy.png",
"Slope_Magnitude_measured_xy.png",
"Slope_X_measured_xy.png",
"Slope_Y_measured_xy.png",
"Curvature_Combined_measured_xy.png",
"Curvature_X_measured_xy.png",
"Curvature_Y_measured_xy.png",
"Slope_Magnitude_reference_xy.png",
"Slope_X_reference_xy.png",
"Slope_Y_reference_xy.png",
"Curvature_Combined_reference_xy.png",
"Curvature_X_reference_xy.png",
"Curvature_Y_reference_xy.png",
"Slope_Deviation_Magnitude_xy.png",
"Slope_Deviation_X_xy.png",
"Slope_Deviation_Y_xy.png",
"Ray_Trace_Image_measured_xy.png",
"Ray_Trace_Image_reference_xy.png",
"Ensquared_Energy_xy.png",
]
for file in files:
file_in = join(dir_in, file)
Expand Down

0 comments on commit 7e3bef0

Please sign in to comment.