Skip to content

Delta e image plot#1922

Open
joshqsumner wants to merge 27 commits into
v5.0from
delta_e_image_plot
Open

Delta e image plot#1922
joshqsumner wants to merge 27 commits into
v5.0from
delta_e_image_plot

Conversation

@joshqsumner

Copy link
Copy Markdown
Contributor

Describe your changes
Adds a function to make a barplot of delta E values to the qc module.

Type of update
This is a new feature

Associated issues
Part of #1910

Additional context
This builds off of PRs #1905, #1920, and #1779

For the reviewer
See this page for instructions on how to review the pull request.

  • PR functionality reviewed in a Jupyter Notebook
  • All tests pass
  • Test coverage remains 100%
  • Documentation tested
  • New documentation pages added to plantcv/mkdocs.yml
  • Changes to function input/output signatures added to updating.md
  • Code reviewed
  • PR approved

@joshqsumner joshqsumner added this to the PlantCV v5.0 milestone May 13, 2026
@joshqsumner joshqsumner added the merge in order Set of PRs that need to be merged sequentially label May 13, 2026
@deepsource-io

deepsource-io Bot commented May 13, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 2308749...bed8a5e on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Coverage  

Code Review Summary

Analyzer Status Updated (UTC) Details
Python Jun 15, 2026 5:37p.m. Review ↗
Code coverage Jun 15, 2026 5:37p.m. Review ↗

Code Coverage Summary

Language Line Coverage (New Code) Line Coverage (Overall)
Aggregate
100%
[✓ above threshold]
100%
Python
100%
[✓ above threshold]
100%

➟ Additional coverage metrics may have been reported. See full coverage report ↗


Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@joshqsumner joshqsumner changed the base branch from main to v5.0 May 13, 2026 19:12
@nfahlgren nfahlgren requested review from Copilot and removed request for Copilot June 15, 2026 17:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds new QC visualizations to support the emerging color quality tooling in pcv.qc, including a Delta E per-image bar plot, and updates tests + documentation/navigation to reflect the move of color QC plots into the QC module.

Changes:

  • Add pcv.qc.plot_deltaE() (Altair) for per-chip Delta E bar plots (Macbeth + AstroBotany).
  • Add pcv.qc.color_chip_comparison() (Altair) and pcv.qc.color_correction_plot() (matplotlib) and expose them via plantcv.plantcv.qc.
  • Update tests and MkDocs navigation for QC plot pages; remove color_correction_plot export from plantcv.visualize.

Reviewed changes

Copilot reviewed 12 out of 18 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/plantcv/qc/test_plot_deltaE.py Adds tests asserting plot_deltaE returns an Altair layered chart.
tests/plantcv/qc/test_color_correction_scatter.py Updates import to pull color_correction_plot from plantcv.plantcv.qc.
tests/plantcv/qc/test_color_chip_comparison.py Adds a test asserting color_chip_comparison returns an Altair vconcat chart.
plantcv/plantcv/visualize/init.py Stops exporting color_correction_plot from plantcv.visualize.
plantcv/plantcv/qc/plot_delta_e.py Implements Delta E bar plot with category coloring + reference lines + chip swatches.
plantcv/plantcv/qc/color_correction_scatter.py Adds QC scatter plot implementation (matplotlib).
plantcv/plantcv/qc/color_chip_comparison.py Adds greenness-rank comparison visualization (Altair).
plantcv/plantcv/qc/init.py Exports new QC plotting functions from the module.
mkdocs.yml Adds QC docs pages to nav; removes visualize scatter page from nav.
docs/updating.md Adds an updating entry for the color chip comparison plot (needs correction to qc).
docs/qc_plot_delta_e.md Adds documentation page for the new Delta E plot (contains a truncated comment).
docs/qc_color_correction_scatter.md Updates docs page to reflect the QC module path and images.
docs/qc_color_chip_comparison.md Adds documentation page for the new chip comparison plot.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +100 to +104
swatch_chip_nos = (std_mat[:, 0] / 10).astype(int)
swatch_hex = [
f"{int(r * 255):02X}{int(g * 255):02X}{int(b * 255):02X}"
for r, g, b in std_mat[:, 1:4]
]
Comment on lines +1 to +12
# Visualize a scatter plot representation of color correction

import pandas as pd
import altair as alt


def color_chip_comparison(std_matrix, *args):
"""
Plot 4 panels showing the difference in observed vs expected colors and optionally
the calibrated colors in a color card.
The color of each dot is given by the RGB value either of the original image, known color card, or corrected image.

df["std_B"] = stddf["std_B"]
df_list.append(df)
# rbind all dataframes from list
fulldf = pd.concat(*[df_list], ignore_index=True)
method="first", ascending=False
)
# label chips 1 to 24
fulldf["chip"] = fulldf["chip"] / 10
Comment thread docs/updating.md
Comment on lines +1540 to +1543
#### plantcv.visualize.color_chip_comparison

* pre v4.10: NA
* post v4.10: plot = plantcv.visualize.color_chip_comparison**(*std_matrix, \*args*)
Comment thread mkdocs.yml
Comment on lines 147 to 152
- "Quality Control Tools":
- 'Color Correction Scatter Plot': qc_color_correction_scatter.md
- 'Color Chip Comparison Plot': qc_color_chip_comparison.md
- "Exposure": qc_exposure.md
- "Quick Color Check": quick_color_check.md
- 'Read Image': read_image.md
Comment thread docs/qc_plot_delta_e.md
Comment on lines +27 to +29
# Calculate Delta E values for each chip relative to the standard color matrix
# Note this is
de_matrix = deltaE(rgb_img=img, color_chip_size="classic")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge in order Set of PRs that need to be merged sequentially ready to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants