-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Implement Support for Executing CLF Workflows #1310
base: develop
Are you sure you want to change the base?
Conversation
249fa6a
to
fe57049
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Michael for the work! This is just a first batch of important notes WRT to the implementation, core idea is that we try as much as possible to use our existing code.
pyproject.toml
Outdated
@@ -49,8 +49,12 @@ dependencies = [ | |||
"numpy>=1.24,<3", | |||
"scipy>=1.10,<2", | |||
"typing-extensions>=4,<5", | |||
"colour-clf-io" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major
This should be an optional dependency as we do not want to hard-depend on CLF.
We will thus need a new requirement entry and callable here: https://github.com/colour-science/colour/blob/develop/colour/utilities/requirements.py
We will also want to track its version in colour.utilities.describe_environment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be done after the clf_io
package is released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
pyproject.toml
Outdated
] | ||
|
||
[tool.uv.sources] | ||
colour-clf-io = {git = 'https://github.com/colour-science/colour-clf-io.git'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor
This is fine for now but we will need to release it on Pypi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely. Just wanted to wait until everything else is ironed out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
import numpy.typing as npt | ||
from colour_clf_io import ExponentStyle | ||
from colour_clf_io.values import Channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor
Do you have the precommit hooks running, it looks like isort
is not really running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They seem to be running without error on my machine at the moment.
return result | ||
|
||
|
||
def apply( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major
We should try to use colour.io.LUTSequence
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
65b9f3f
to
e6169a8
Compare
b9f32a5
to
385a4a4
Compare
Thanks @MichaelMauderer! Not a full review yet because I would like to tame some high level issues first before going deeper. Singleton BehaviourWas there any reason to have a class CLFNode(AbstractLUTSequenceOperator):
node: clf.ProcessNode
def __init__(self, node: clf.ProcessNode) -> None:
super().__init__(node.name, node.description)
self.node = node The consequence is that if we instantiate multiple CLF nodes of the same type, they behave like a singleton and changing one will change all the others: I think that this would be better: class CLFNode(AbstractLUTSequenceOperator):
def __init__(self, node: clf.ProcessNode) -> None:
super().__init__(node.name, node.description)
self._node = node
@property
def node(self) -> clf.ProcessNode:
class LUT3D(CLFNode):
def __init__(self, node: clf.LUT3D) -> None:
super().__init__(node)
# self.node = node <--- We don't even need to assign it here because it is taken care of in the super class. The classes from import colour_clf_io as clf
LUT_1 = clf.LUT1D("Foo", "Bar", clf.BitDepth.f32, clf.BitDepth.f32, "Baz", clf.Array([0, 1, 2, 3, 4], [0, 1, 2, 3, 4]), False, False, clf.Interpolation1D.LINEAR)
LUT_2 = clf.LUT1D("John", "Doe", clf.BitDepth.f16, clf.BitDepth.f16, "Luke", clf.Array([4, 3, 2, 1, 0], [4, 3, 2, 1, 0]), True, True, clf.Interpolation1D.LINEAR)
print(LUT_1.array)
print(LUT_2.array)
BTW, I noted that @dataclass
class ProcessNode(XMLParsable, ABC)
|
Thanks for spotting this! This bit was a bit tricky due to typing requirements. We want the
This passes type checking and avoids the singleton bug.
I agree that is a much better API. I went with the |
Summary
Add support for executing CLF workflows defined as per https://docs.acescentral.com/specifications/clf/#common-lut-format-clf-a-common-file-format-for-look-up-tables
Closes #636
TODO
pyproject.toml
to use that instead of directly referring to the repo.Preflight
Code Style and Quality
colour
,colour.models
.Documentation