colour-science / colour

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

Implement support for negative number handling in "colour.gamma" definition. #281

Closed KelSolaar closed 7 years ago

KelSolaar commented 8 years ago

@Nick-Shaw is suggesting we add some more arguments to colour.gamma definition:

 Is there a case for adding kwargs defining handling of negative input, emulating other implementations? I could imagine four possible options:

- `negative='error'` (current behaviour)
- `negative='mirror'` (Resolve behaviour)
- `negative='passthrough'` (Nuke behaviour)
- `negative='clamp'`
KevinJW commented 8 years ago

@Nick-Shaw is suggesting we add some more arguments to colour.gamma definition:

Is there a case for adding kwargs defining handling of negative input, emulating other implementations? I could imagine four possible options, negative='error' (current behaviour) negative='mirror' (Resolve behaviour) negative='passthrough' (Nuke behaviour) and negative='clamp'

passthrough sounds like the wrong name for negative handling, it describes how the function does what it does rather than the result, though I'm not that fussed for such simple behaviour. I'm also not 100% on the parameter name. I do support the general idea though.

Kevin

nick-shaw commented 8 years ago

I didn't spent a lot of time thinking what the parameter or options should be called. I agree they are not great. But I couldn't think of obvious ones. I just wanted to suggest the concept.

KelSolaar commented 7 years ago

@Nick-Shaw, @KevinJW: I was going through the opened issues and saw this one, I can implement it just need to know if you have any fancy names for the options?

nick-shaw commented 7 years ago

Afraid I can't think of anything other than my original suggestions. @KevinJW do you have any thoughts? Particularly on the one where you weren't keen on my suggestions.

KelSolaar commented 7 years ago

error somehow imply that the function will fail which is not the case as it generates nan thus what about using indeterminate or simply nan instead?

passthrough is trickier :)

KelSolaar commented 7 years ago

I have updated colour.gamma_function definition signature with a new negative_number_handling argument with the following options: