Closed gul916 closed 2 months ago
Hi @gul916,
colour.sd_to_XYZ
does not support integration over a colour.MultiSpectralDistributions
as you are doing it here. The case where a colour.MultiSpectralDistributions
is supported is if it carries a single signal: https://github.com/colour-science/colour/blob/develop/colour/colorimetry/tests/test_tristimulus_values.py#L1594
Failure on our part to not make that clearer! For what you are trying to achieve here, I would recommend that you either:
colour.sd_to_XYZ
:
XYZ = np.array([colour.sd_to_XYZ(sd, cmfs, ilum_sds) / 100 for sd in colour.SDS_COLOURCHECKERS['babel_average'].values()])
XYZ = colour.sd_to_XYZ(np.transpose(multi_sds.values), cmfs, ilum_sds, method="integration", shape=colour.SpectralShape(380, 730, 10))/100
Cheers,
Thomas
Hi @KelSolaar, Thank you for this clarification, I understand. I will modify my code acordingly. I am surprised that the same code is working with sds = colour.SDS_COLOURCHECKERS['cc_ohta']. This dataset only differs by the used spectral range and the interval of points. Can you explain the reason? Regards
I will need to dig into the code to understand why it is working. I would not expect it to work but looks like it does indeed. I haven't touched this part of the codebase in a while so maybe it is somehow intentional.
I will keep you posted!
Ok so I took a look, and I understand. Our Integration method is vectorised but we default to the ASTME-308 method and in the specific case of 10nm interval, it goes through the colour.colorimetry.tristimulus_weighting_factors_ASTME2022 definition which is not vectorised. For 5 nm interval it goes through colour.colorimetry.sd_to_XYZ_integration
Takeaway:
colour.MultiSpectralDistributions
, I had forgotten that I implemented support for it when I did the NDArray integration support.method="Integration"
in you colour.sd_to_XYZ
call.Thank you @KelSolaar for investigating and for your explanation. The first method you proposed with a loop over every single SD was working well. Regards,
This should be fixed in develop.
I haven't tested the new version but that seems wonderful, many thanks!
Description
Hello, thank you for this amazing package. It's really powerful and well-documented.
I found a bug when converting a multispectraldistribution to XYZ using 'babel_average' dataset. The expected behavior is obtained when using 'cc_ohta'.
sds = colour.SDS_COLOURCHECKERS['cc_ohta']
Thank you, gul916
Code for Reproduction
Exception Message
Environment Information