Skip to content

[BUG]: SpectralDistribution.align makes unwanted results with specific wavelengths condition. #1325

@geniuskey

Description

@geniuskey

Description

Here is a bug on SpectralDistribution.align and MultiSpectralDistributions.align methods

Code for Reproduction

from colour import SpectralDistribution, SpectralShape

sd = SpectralDistribution({401.5:1, 402.1:2, 403:2, 405:4, 410:5, 420:10, 430:8, 440:12, 470:10})
sd2 = sd.align(SpectralShape(400, 450, 10))
print(sd2)

Results:

[[ 400.            1.92959479]
 [ 402.            1.92959479]
 [ 411.6           5.33446107]
 [ 421.2          10.1550418 ]
 [ 430.8           7.9643628 ]
 [ 440.4          12.29989911]
 [ 450.           19.78778283]]

Expected results:

[[ 400.            1.92959479]
 [ 410.            4.41990611]
 [ 420.            9.96913531]
 [ 430.            8.04080918]
 [ 440.           11.99018586]
 [ 450.           19.78778283]]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions