colour-science / colour

Colour Science for Python
https://www.colour-science.org
BSD 3-Clause "New" or "Revised" License
2.14k stars 263 forks source link

PR: Fix incorrect `colour.colorimetry.sd_gaussian_fwhm` definition output. #1184

Closed KelSolaar closed 1 year ago

KelSolaar commented 1 year ago

Summary

The colour.colorimetry.sd_gaussian_fwhm output was not correct as per #1171.

Preflight

Code Style and Quality

Documentation

coveralls commented 1 year ago

Coverage Status

coverage: 99.775%. remained the same when pulling 2f51cc63b681ca5ee3f7049a8a4ca54a214ea399 on feature/sd_gaussian into 1966033e6112b650f51a6932ea4166dc60e36575 on develop.

tjdcs commented 1 year ago

@KelSolaar This is still wrong:

from colour.colorimetry.generation import sd_gaussian_fwhm
from colour.colorimetry.spectrum import SPECTRAL_SHAPE_DEFAULT
from colour.plotting.colorimetry import plot_single_sd
from matplotlib import pyplot as plt
center = 500
fwhm = 10

spd = sd_gaussian_fwhm(center,fwhm,SPECTRAL_SHAPE_DEFAULT)
fig, ax = plot_single_sd(spd, standalone=False)
ax.set_xlim(450,550)
ax.set_xticks([center-fwhm, center-fwhm/2, center, center+fwhm/2, center+fwhm])
ax.set_yticks([0,.5,1])
ax.grid(visible=True)
plt.show()
Screen Shot 2023-07-22 at 9 32 41 PM

The acronym FWHM is shorthand for "full width at half maximum" meaning at center + half the fwhm, the spd should have a value of 0.5

tjdcs commented 1 year ago

Ugh.... sorry. My mistake. My local pull to check this didn't go through.

Screen Shot 2023-07-22 at 9 37 56 PM
KelSolaar commented 1 year ago

I added a unit test to verify the width.