OpenColorIO icon indicating copy to clipboard operation
OpenColorIO copied to clipboard

[documentation][python] GradingPrimary: missing expected value type doc

Open MrLixm opened this issue 3 years ago • 4 comments

Hello, When looking at the GradingPrimary class documentation (https://opencolorio.readthedocs.io/en/latest/api/grading_transforms.html), we can see a bunch of property is available but none of them specifies which type of value is expected when set.

This would have not been an issue if they all except the same type but seems some except a GradingRGBM instance while others just expect a float.

Would be cool to have in the documentation what type is expected.

Here are the tests I ran to check who accepts what

import unittest

import PyOpenColorIO as ocio


class OcioGradingPrimary(unittest.TestCase):
    @staticmethod
    def to_rgbm(v):
        rgbm = ocio.GradingRGBM()
        rgbm.master = v
        return rgbm

    def test_properties(self):

        gp = ocio.GradingPrimary(ocio.GRADING_LIN)

        gp.brightness = self.to_rgbm(0.18)
        gp.clampBlack = 0.18
        gp.clampWhite = 0.18
        gp.contrast = self.to_rgbm(0.18)
        gp.exposure = self.to_rgbm(0.18)
        gp.gain = self.to_rgbm(0.18)
        gp.gamma = self.to_rgbm(0.18)
        gp.lift = self.to_rgbm(0.18)
        gp.offset = self.to_rgbm(0.18)
        gp.pivot = 0.18
        gp.saturation = 0.18

        gp.brightness = self.to_rgbm(0.18)
        with self.assertRaises(TypeError): gp.clampBlack = self.to_rgbm(0.18)
        with self.assertRaises(TypeError): gp.clampWhite = self.to_rgbm(0.18)
        gp.contrast = self.to_rgbm(0.18)
        gp.exposure = self.to_rgbm(0.18)
        gp.gain = self.to_rgbm(0.18)
        gp.gamma = self.to_rgbm(0.18)
        gp.lift = self.to_rgbm(0.18)
        gp.offset = self.to_rgbm(0.18)
        with self.assertRaises(TypeError): gp.pivot = self.to_rgbm(0.18)
        with self.assertRaises(TypeError): gp.saturation = self.to_rgbm(0.18)


if __name__ == "__main__":
    unittest.main()

Cheers. Liam.

MrLixm avatar May 08 '22 16:05 MrLixm

@MrLixm can you help me where can I get to know more about this documentation to gain knowledge in type of expected value? I want to work on this

sumana-2705 avatar Jun 27 '24 13:06 sumana-2705

Hello, sorry but I am not familiar with how the OCIO documentation is built. I am only an user for it and as mentioned in the first message the python documentation doesn't mention which data type must be used: image While the C++ documentation indicate the type: image https://opencolorio.readthedocs.io/en/latest/api/grading_transforms.html#gradingprimary

Hope this helps, Liam.

MrLixm avatar Jun 27 '24 13:06 MrLixm

yeah it works, thanks for information, should I need to perform additional tests or update the results based on these test results, which was provided by you, that is which property accepts which type? @MrLixm

sumana-2705 avatar Jun 29 '24 05:06 sumana-2705

@MrLixm I have opened a pull request, please review it suggest me if any changes required. Thank you

sumana-2705 avatar Jul 01 '24 12:07 sumana-2705

Closing this as fixed in PR #1989.

doug-walker avatar Sep 12 '24 03:09 doug-walker