From 76d629f5ce129853104b2f43c28128d97167ea3b Mon Sep 17 00:00:00 2001 From: Sean Wallitsch Date: Fri, 9 May 2014 20:06:20 -0700 Subject: [PATCH 1/6] Adds --halt flag to trigger HALT_ON_ERROR behavior. Closes #10 --- cdl_convert/cdl_convert.py | 14 ++++++++++++++ tests/test_cdl_convert.py | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/cdl_convert/cdl_convert.py b/cdl_convert/cdl_convert.py index 8741f9e..fdcef9c 100644 --- a/cdl_convert/cdl_convert.py +++ b/cdl_convert/cdl_convert.py @@ -2264,6 +2264,16 @@ def parse_args(): "accepted. Defaults to a .cc XML. Supported output formats are: " # pylint: disable=C0330 "{outputs}".format(outputs=str(OUTPUT_FORMATS.keys())) # pylint: disable=C0330 ) + parser.add_argument( + "--halt", + action='store_true', + help="turns off exception handling default behavior. Turn this on if " + "you want the conversion process to fail and not continue," + "rather than relying on default behavior for bad values. Examples " + "are clipping negative values to 0.0 for Slope, Power and " + "Saturation, and automatically generating a new id for a " + "ColorCorrect if no or a bad id is given." + ) args = parser.parse_args() @@ -2299,6 +2309,10 @@ def parse_args(): else: args.output = ['cc', ] + if args.halt: + global HALT_ON_ERROR + HALT_ON_ERROR = True + return args # ============================================================================== diff --git a/tests/test_cdl_convert.py b/tests/test_cdl_convert.py index 0a2b6e1..cd28726 100644 --- a/tests/test_cdl_convert.py +++ b/tests/test_cdl_convert.py @@ -326,6 +326,24 @@ def testNoProvidedOutput(self): args.output ) + #========================================================================== + + def testHaltOnError(self): + """Tests that providing the --halt flag triggers HALT_ON_ERROR""" + self.assertFalse( + cdl_convert.HALT_ON_ERROR + ) + + sys.argv = ['scriptname', 'inputFile', '--halt'] + + cdl_convert.parse_args() + + self.assertTrue( + cdl_convert.HALT_ON_ERROR + ) + + cdl_convert.HALT_ON_ERROR = False + # main() ====================================================================== From 2904141a709dac82213f275a98b7c8cc6ef5e110 Mon Sep 17 00:00:00 2001 From: Sean Wallitsch Date: Fri, 9 May 2014 22:31:52 -0700 Subject: [PATCH 2/6] Adds --no-output arg. Closes #14 --- cdl_convert/cdl_convert.py | 13 +++++++++++- tests/test_cdl_convert.py | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/cdl_convert/cdl_convert.py b/cdl_convert/cdl_convert.py index fdcef9c..da62dad 100644 --- a/cdl_convert/cdl_convert.py +++ b/cdl_convert/cdl_convert.py @@ -2274,6 +2274,13 @@ def parse_args(): "Saturation, and automatically generating a new id for a " "ColorCorrect if no or a bad id is given." ) + parser.add_argument( + "--no-output", + action='store_true', + help="parses all incoming files but no files will be written. Use this " + "in conjunction with '--halt' and '--sanity-check to try and " + "track down any oddities observed in the CDLs." + ) args = parser.parse_args() @@ -2322,6 +2329,9 @@ def main(): """Will figure out input and destination filetypes, then convert""" args = parse_args() + if args.no_output: + print("Dry run initiated, no files will be written.") + filepath = os.path.abspath(args.input_file) if not args.input: @@ -2341,7 +2351,8 @@ def main(): path=cdl.file_out ) ) - OUTPUT_FORMATS[ext](cdl) + if not args.no_output: + OUTPUT_FORMATS[ext](cdl) if __name__ == '__main__': # pragma: no cover try: diff --git a/tests/test_cdl_convert.py b/tests/test_cdl_convert.py index cd28726..add6070 100644 --- a/tests/test_cdl_convert.py +++ b/tests/test_cdl_convert.py @@ -344,6 +344,47 @@ def testHaltOnError(self): cdl_convert.HALT_ON_ERROR = False + #========================================================================== + + @mock.patch('cdl_convert.cdl_convert.write_cc') + @mock.patch('cdl_convert.cdl_convert.parse_flex') + @mock.patch('os.path.abspath') + def testNoOutput(self, abspath, mockParse, mockWrite): + """Tests that we don't write a converted file""" + + abspath.return_value = 'file.flex' + cdl = cdl_convert.ColorCorrection( + id='uniqueId', cdl_file='file.flex' + ) + + mockParse.return_value = [cdl, ] + sys.argv = ['scriptname', 'file.flex', '-o', 'cc', '--no-output'] + + inputFormats = cdl_convert.INPUT_FORMATS + outputFormats = cdl_convert.OUTPUT_FORMATS + + mockInputs = dict(inputFormats) + mockInputs['flex'] = mockParse + cdl_convert.INPUT_FORMATS = mockInputs + + mockOutputs = dict(outputFormats) + mockOutputs['cc'] = mockWrite + cdl_convert.OUTPUT_FORMATS = mockOutputs + + cdl_convert.main() + + mockParse.assert_called_once_with('file.flex') + # Determine dest should have set a file_out + self.assertEqual( + 'uniqueId.cc', + cdl.file_out + ) + # But the write should never have been called. + mockWrite.assert_has_calls([]) + + cdl_convert.INPUT_FORMATS = inputFormats + cdl_convert.OUTPUT_FORMATS = outputFormats + # main() ====================================================================== From ff817f74e2e9627fe8d6cc415741ddfe585edb46 Mon Sep 17 00:00:00 2001 From: Sean Wallitsch Date: Fri, 9 May 2014 22:35:09 -0700 Subject: [PATCH 3/6] Adds some pylint ignores because C0330 is still broken. --- cdl_convert/cdl_convert.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/cdl_convert/cdl_convert.py b/cdl_convert/cdl_convert.py index da62dad..0a26203 100644 --- a/cdl_convert/cdl_convert.py +++ b/cdl_convert/cdl_convert.py @@ -105,6 +105,10 @@ # HALT_ON_ERROR is the exception handling variable for exceptions that can # be handled silently. +# +# If we begin to get more config options, this will be moved into a singleton +# config class. +# # Used in the following places: # Slope, power and sat values can't be negative and will truncate to 0.0 # If id given to ColorCorrection is blank, will set to number of CCs @@ -2268,18 +2272,18 @@ def parse_args(): "--halt", action='store_true', help="turns off exception handling default behavior. Turn this on if " - "you want the conversion process to fail and not continue," - "rather than relying on default behavior for bad values. Examples " - "are clipping negative values to 0.0 for Slope, Power and " - "Saturation, and automatically generating a new id for a " - "ColorCorrect if no or a bad id is given." + "you want the conversion process to fail and not continue," # pylint: disable=C0330 + "rather than relying on default behavior for bad values. Examples " # pylint: disable=C0330 + "are clipping negative values to 0.0 for Slope, Power and " # pylint: disable=C0330 + "Saturation, and automatically generating a new id for a " # pylint: disable=C0330 + "ColorCorrect if no or a bad id is given." # pylint: disable=C0330 ) parser.add_argument( "--no-output", action='store_true', help="parses all incoming files but no files will be written. Use this " - "in conjunction with '--halt' and '--sanity-check to try and " - "track down any oddities observed in the CDLs." + "in conjunction with '--halt' and '--sanity-check to try and " # pylint: disable=C0330 + "track down any oddities observed in the CDLs." # pylint: disable=C0330 ) args = parser.parse_args() @@ -2317,7 +2321,7 @@ def parse_args(): args.output = ['cc', ] if args.halt: - global HALT_ON_ERROR + global HALT_ON_ERROR # pylint: disable=W0603 HALT_ON_ERROR = True return args From e4032e98a312eb87b51d2d20b27bf75bd2ca7253 Mon Sep 17 00:00:00 2001 From: Sean Wallitsch Date: Sat, 10 May 2014 00:01:51 -0700 Subject: [PATCH 4/6] Adds sanity checking. Closes #13 --- cdl_convert/cdl_convert.py | 97 +++++++++++++++++++++++- tests/test_cdl_convert.py | 147 +++++++++++++++++++++++++++++++++++++ 2 files changed, 243 insertions(+), 1 deletion(-) diff --git a/cdl_convert/cdl_convert.py b/cdl_convert/cdl_convert.py index 0a26203..872c0cb 100644 --- a/cdl_convert/cdl_convert.py +++ b/cdl_convert/cdl_convert.py @@ -515,6 +515,12 @@ class ColorCorrection(AscDescBase, AscColorSpaceBase, AscXMLBase): # pylint: di file_out : (str) Filepath this CDL will be written to. + has_sat : (bool) + Returns True if SOP values are set + + has_sop : (bool) + Returns True if SOP values are set + id : (str) Unique XML URI to identify this CDL. Often a shot or sequence name. @@ -630,6 +636,22 @@ def file_out(self): """Returns a theoretical absolute filepath based on output ext""" return self._files['file_out'] + @property + def has_sat(self): + """Returns True if SOP values are set""" + if self.sat_node: + return True + else: + return False + + @property + def has_sop(self): + """Returns True if SOP values are set""" + if self.sop_node: + return True + else: + return False + @property def id(self): # pylint: disable=C0103 """Returns unique color correction id field""" @@ -2198,6 +2220,67 @@ def build_cc(line_id, edl_path, sop_dict, sat_value, title_line): cdls.append(cdl) return cdls +# ============================================================================== + + +def sanity_check(cdl): + """Checks values on :class:`ColorCorrection` for sanity. + + **Args:** + cdl : (:class:`ColorCorrection`) + The :class:`ColorCorrection` to check for sane values. + + **Returns:** + (bool) + Returns True if all values are sane. + + **Raises:** + N/A + + Will print a warning to stdout if any values exceed normal limits. + Normal limits are defined as: + + For Slope, Power and Saturation: + Any value over 3 or under 0.1 + + For Offset: + Any value over 1 or under -1 + + Note that depending on the desired look for a shot or sequence, it's + possible that a single ColorCorrection element might have very odd + looking values and still achieve a correct look. + + """ + sane_values = True + + def _check_value(value, range, value_type): + """Checks if a value falls outside of min or max""" + if value <= range[0] or value >= range[1]: + print( + 'The ColorCorrection "{id}" was given a {type} value of ' + '"{value}", which might be incorrect.'.format( + id=cdl.id, + type=value_type, + value=value + ) + ) + return False + else: + return True + + if cdl.has_sop: + for i in xrange(3): + slope = _check_value(cdl.slope[i], (0.1, 3.0), 'Slope') + offset = _check_value(cdl.offset[i], (-1.0, 1.0), 'Offset') + power = _check_value(cdl.power[i], (0.1, 3.0), 'Power') + if not slope or not offset or not power: + sane_values = False + + if cdl.has_sat: + if not _check_value(cdl.sat, (0.1, 3.0), 'Saturation'): + sane_values = False + + return sane_values # ============================================================================== @@ -2282,9 +2365,18 @@ def parse_args(): "--no-output", action='store_true', help="parses all incoming files but no files will be written. Use this " - "in conjunction with '--halt' and '--sanity-check to try and " # pylint: disable=C0330 + "in conjunction with '--halt' and '--check to try and " # pylint: disable=C0330 "track down any oddities observed in the CDLs." # pylint: disable=C0330 ) + parser.add_argument( + "--check", + action='store_true', + help="checks all ColorCorrects that were parsed for odd values. Odd " + "values are any values over 3 or under 0.1 for Slope, Power " # pylint: disable=C0330 + "and Saturation. For offset, any value over 1 and under -1 is " # pylint: disable=C0330 + "flagged. Note that depending on the look, these still might " # pylint: disable=C0330 + "be correct values." # pylint: disable=C0330 + ) args = parser.parse_args() @@ -2347,6 +2439,9 @@ def main(): if cdls: for cdl in cdls: + if args.check: + for cdl in cdls: + sanity_check(cdl) for ext in args.output: cdl.determine_dest(ext) print( diff --git a/tests/test_cdl_convert.py b/tests/test_cdl_convert.py index add6070..79fecb1 100644 --- a/tests/test_cdl_convert.py +++ b/tests/test_cdl_convert.py @@ -200,6 +200,112 @@ def testEmptyString(self): result ) +# sanity_check() ============================================================== + + +class TestSanityCheck(unittest.TestCase): + """Tests the sanity check function""" + + #========================================================================== + # SETUP & TEARDOWN + #========================================================================== + + def setUp(self): + self.stdout = sys.stdout + sys.stdout = StringIO() + self.cdl = cdl_convert.ColorCorrection('uniqueId', 'banana.cc') + + #========================================================================== + + def tearDown(self): + sys.stdout = self.stdout + cdl_convert.ColorCorrection.members = {} + + #========================================================================== + # TESTS + #========================================================================== + + def testGoodRun(self): + """Tests that if no bad values were found, sanity_check returns True""" + self.cdl.slope = [1.2, 0.23, 2.487] + self.cdl.offset = [-0.87, 0.987, 0.0] + self.cdl.power = [2.97, 1.25, 1.0] + self.cdl.sat = 2.9999 + + self.assertTrue( + cdl_convert.sanity_check(self.cdl) + ) + + #========================================================================== + + def testSlope(self): + """Tests that a bad slope value is reported""" + self.cdl.slope = [0.1, 3.1, 1.5] + + self.assertFalse( + cdl_convert.sanity_check(self.cdl) + ) + + self.assertEqual( + 'The ColorCorrection "uniqueId" was given a Slope value of ' + '"0.1", which might be incorrect.\n' + 'The ColorCorrection "uniqueId" was given a Slope value of ' + '"3.1", which might be incorrect.\n', + sys.stdout.getvalue() + ) + + #========================================================================== + + def testOffset(self): + """Tests that a bad slope value is reported""" + self.cdl.offset = [-1.01, 1.5, 0.157] + + self.assertFalse( + cdl_convert.sanity_check(self.cdl) + ) + + self.assertEqual( + 'The ColorCorrection "uniqueId" was given a Offset value of ' + '"-1.01", which might be incorrect.\n' + 'The ColorCorrection "uniqueId" was given a Offset value of ' + '"1.5", which might be incorrect.\n', + sys.stdout.getvalue() + ) + + #========================================================================== + + def testPower(self): + """Tests that a bad slope value is reported""" + self.cdl.power = [0.1, 3.1, 1.5] + + self.assertFalse( + cdl_convert.sanity_check(self.cdl) + ) + + self.assertEqual( + 'The ColorCorrection "uniqueId" was given a Power value of ' + '"0.1", which might be incorrect.\n' + 'The ColorCorrection "uniqueId" was given a Power value of ' + '"3.1", which might be incorrect.\n', + sys.stdout.getvalue() + ) + + #========================================================================== + + def testSaturation(self): + """Tests that a bad sat value is reported""" + self.cdl.sat = 3.01 + + self.assertFalse( + cdl_convert.sanity_check(self.cdl) + ) + + self.assertEqual( + 'The ColorCorrection "uniqueId" was given a Saturation value of ' + '"3.01", which might be incorrect.\n', + sys.stdout.getvalue() + ) + # parse_args() ================================================================ @@ -212,11 +318,15 @@ class TestParseArgs(unittest.TestCase): def setUp(self): self.sysargv = sys.argv + self.stdout = sys.stdout + sys.stdout = StringIO() #========================================================================== def tearDown(self): + sys.stdout = self.stdout sys.argv = self.sysargv + cdl_convert.ColorCorrection.members = {} #========================================================================== # TESTS @@ -346,6 +456,19 @@ def testHaltOnError(self): #========================================================================== + def testSanityCheck(self): + """Tests the sanity check --check flag to be set""" + + sys.argv = ['scriptname', 'inputFile', '--check'] + + args = cdl_convert.parse_args() + + self.assertTrue( + args.check + ) + + #========================================================================== + @mock.patch('cdl_convert.cdl_convert.write_cc') @mock.patch('cdl_convert.cdl_convert.parse_flex') @mock.patch('os.path.abspath') @@ -524,6 +647,30 @@ def testDetermineDestCalled(self, abspath, mockParse, mockWrite, dirname): self.cdl.file_out ) + #========================================================================== + + @mock.patch('cdl_convert.cdl_convert.sanity_check') + @mock.patch('cdl_convert.cdl_convert.write_cc') + @mock.patch('cdl_convert.cdl_convert.parse_flex') + @mock.patch('os.path.abspath') + def testSanityCheckCalled(self, abspath, mockParse, mockWrite, mockSanity): + """Tests that we try and write a converted file""" + + abspath.return_value = 'file.flex' + mockParse.return_value = [self.cdl, ] + sys.argv = ['scriptname', 'file.flex', '--check'] + + mockInputs = dict(self.inputFormats) + mockInputs['flex'] = mockParse + cdl_convert.INPUT_FORMATS = mockInputs + + mockOutputs = dict(self.outputFormats) + mockOutputs['cc'] = mockWrite + cdl_convert.OUTPUT_FORMATS = mockOutputs + + cdl_convert.main() + + mockSanity.assert_called_once_with(self.cdl) #========================================================================== From 71470d2071a2ac2a49b8a9813d3c9314163b3200 Mon Sep 17 00:00:00 2001 From: Sean Wallitsch Date: Sat, 10 May 2014 00:06:20 -0700 Subject: [PATCH 5/6] Moves no_output integration style test to main testing, replaces it with basic args check --- tests/test_cdl_convert.py | 69 ++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/tests/test_cdl_convert.py b/tests/test_cdl_convert.py index 79fecb1..112d6ec 100644 --- a/tests/test_cdl_convert.py +++ b/tests/test_cdl_convert.py @@ -469,44 +469,16 @@ def testSanityCheck(self): #========================================================================== - @mock.patch('cdl_convert.cdl_convert.write_cc') - @mock.patch('cdl_convert.cdl_convert.parse_flex') - @mock.patch('os.path.abspath') - def testNoOutput(self, abspath, mockParse, mockWrite): - """Tests that we don't write a converted file""" - - abspath.return_value = 'file.flex' - cdl = cdl_convert.ColorCorrection( - id='uniqueId', cdl_file='file.flex' - ) + def testNoOutput(self): + """Tests that --no-output was picked up correctly""" - mockParse.return_value = [cdl, ] - sys.argv = ['scriptname', 'file.flex', '-o', 'cc', '--no-output'] + sys.argv = ['scriptname', 'inputFile', '--no-output'] - inputFormats = cdl_convert.INPUT_FORMATS - outputFormats = cdl_convert.OUTPUT_FORMATS - - mockInputs = dict(inputFormats) - mockInputs['flex'] = mockParse - cdl_convert.INPUT_FORMATS = mockInputs - - mockOutputs = dict(outputFormats) - mockOutputs['cc'] = mockWrite - cdl_convert.OUTPUT_FORMATS = mockOutputs - - cdl_convert.main() + args = cdl_convert.parse_args() - mockParse.assert_called_once_with('file.flex') - # Determine dest should have set a file_out - self.assertEqual( - 'uniqueId.cc', - cdl.file_out + self.assertTrue( + args.no_output ) - # But the write should never have been called. - mockWrite.assert_has_calls([]) - - cdl_convert.INPUT_FORMATS = inputFormats - cdl_convert.OUTPUT_FORMATS = outputFormats # main() ====================================================================== @@ -674,6 +646,35 @@ def testSanityCheckCalled(self, abspath, mockParse, mockWrite, mockSanity): #========================================================================== + @mock.patch('cdl_convert.cdl_convert.ColorCorrection.determine_dest') + @mock.patch('cdl_convert.cdl_convert.write_cc') + @mock.patch('cdl_convert.cdl_convert.parse_flex') + @mock.patch('os.path.abspath') + def testNoOutput(self, abspath, mockParse, mockWrite, mockDest): + """Tests that we don't write a converted file""" + + abspath.return_value = 'file.flex' + mockParse.return_value = [self.cdl, ] + sys.argv = ['scriptname', 'file.flex', '--no-output'] + + mockInputs = dict(self.inputFormats) + mockInputs['flex'] = mockParse + cdl_convert.INPUT_FORMATS = mockInputs + + mockOutputs = dict(self.outputFormats) + mockOutputs['cc'] = mockWrite + cdl_convert.OUTPUT_FORMATS = mockOutputs + + cdl_convert.main() + + mockParse.assert_called_once_with('file.flex') + # Determine dest should have set a file_out + mockDest.assert_called_once_with('cc') + # But the write should never have been called. + mockWrite.assert_has_calls([]) + + #========================================================================== + @mock.patch('cdl_convert.cdl_convert.write_cc') @mock.patch('cdl_convert.cdl_convert.parse_flex') @mock.patch('os.path.abspath') From f779c9518f839113a483fc45310f8b765d50c5f9 Mon Sep 17 00:00:00 2001 From: Sean Wallitsch Date: Sat, 10 May 2014 00:21:52 -0700 Subject: [PATCH 6/6] Updates docs with new CLI options and API for sanity_check --- cdl_convert/cdl_convert.py | 18 +++++++++--------- docs/cdl_convert.rst | 8 ++++++++ docs/usage.rst | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/cdl_convert/cdl_convert.py b/cdl_convert/cdl_convert.py index 872c0cb..8a31f81 100644 --- a/cdl_convert/cdl_convert.py +++ b/cdl_convert/cdl_convert.py @@ -2223,11 +2223,11 @@ def build_cc(line_id, edl_path, sop_dict, sat_value, title_line): # ============================================================================== -def sanity_check(cdl): +def sanity_check(colcor): """Checks values on :class:`ColorCorrection` for sanity. **Args:** - cdl : (:class:`ColorCorrection`) + colcor : (:class:`ColorCorrection`) The :class:`ColorCorrection` to check for sane values. **Returns:** @@ -2259,7 +2259,7 @@ def _check_value(value, range, value_type): print( 'The ColorCorrection "{id}" was given a {type} value of ' '"{value}", which might be incorrect.'.format( - id=cdl.id, + id=colcor.id, type=value_type, value=value ) @@ -2268,16 +2268,16 @@ def _check_value(value, range, value_type): else: return True - if cdl.has_sop: + if colcor.has_sop: for i in xrange(3): - slope = _check_value(cdl.slope[i], (0.1, 3.0), 'Slope') - offset = _check_value(cdl.offset[i], (-1.0, 1.0), 'Offset') - power = _check_value(cdl.power[i], (0.1, 3.0), 'Power') + slope = _check_value(colcor.slope[i], (0.1, 3.0), 'Slope') + offset = _check_value(colcor.offset[i], (-1.0, 1.0), 'Offset') + power = _check_value(colcor.power[i], (0.1, 3.0), 'Power') if not slope or not offset or not power: sane_values = False - if cdl.has_sat: - if not _check_value(cdl.sat, (0.1, 3.0), 'Saturation'): + if colcor.has_sat: + if not _check_value(colcor.sat, (0.1, 3.0), 'Saturation'): sane_values = False return sane_values diff --git a/docs/cdl_convert.rst b/docs/cdl_convert.rst index 307a1c8..819ec36 100644 --- a/docs/cdl_convert.rst +++ b/docs/cdl_convert.rst @@ -138,6 +138,14 @@ SopNode .. autoclass:: cdl_convert.SopNode +General Functions +=============== + +Sanity Check +------------ + +.. autofunction:: cdl_convert.sanity_check + Parse Functions =============== diff --git a/docs/usage.rst b/docs/usage.rst index c9f191f..d79ea07 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -32,10 +32,28 @@ input file format. This can be done with the ``-i`` flag. but if you're running into trouble, it might help to indicate to ``cdl_convert`` what the input file type is. +When converting large batches of color corrections, it can be helpful to know +if there's anything odd about any of them. Using the ``--check`` flag will +cause any potentially invalid numbers to be flagged and printed to the shell. + +For Slope, Power and Saturation, any values below ``0.1`` or above ``3.0`` will +flag. For Offset, any values below ``-1.0`` or above ``1.0`` will flag. +:: + $ cdl_convert ./di_v001.flex + The ColorCorrection "a347.x700" was given a Slope value of "0.978", which + might be incorrect. + The ColorCorrection "a400.x050" was given a Saturation value of "3.1", + which might be incorrect. + +This is especially useful when combined with the ``--no-output`` flag, which +will enable a dry run mode and allow you to spot odd values before running. + Full help is available using the standard ``--help`` command: :: $ cdl_convert --help - usage: cdl_convert [-h] [-i INPUT] [-o OUTPUT] input_file + usage: cdl_convert.py [-h] [-i INPUT] [-o OUTPUT] [--halt] [--no-output] + [--check] + input_file positional arguments: input_file the file to be converted @@ -51,6 +69,22 @@ Full help is available using the standard ``--help`` command: specify the filetype to convert to, comma separated lists are accepted. Defaults to a .cc XML. Supported output formats are: ['cc', 'cdl'] + --halt turns off exception handling default behavior. Turn + this on if you want the conversion process to fail and + not continue,rather than relying on default behavior + for bad values. Examples are clipping negative values + to 0.0 for Slope, Power and Saturation, and + automatically generating a new id for a ColorCorrect + if no or a bad id is given. + --no-output parses all incoming files but no files will be + written. Use this in conjunction with '--halt' and '-- + check to try and track down any oddities observed in + the CDLs. + --check checks all ColorCorrects that were parsed for odd + values. Odd values are any values over 3 or under 0.1 + for Slope, Power and Saturation. For offset, any value + over 1 and under -1 is flagged. Note that depending on + the look, these still might be correct values. Python Usage ============