MCPcopy Create free account
hub / github.com/ImageEngine/cortex / testMinToAndMaxTo

Method testMinToAndMaxTo

test/IECoreImage/ClampOpTest.py:108–132  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

106 self.assertFalse( intermediateValues )
107
108 def testMinToAndMaxTo( self ) :
109
110 image = IECore.Reader.create( os.path.join( "test", "IECoreImage", "data", "exr", "ramp.exr" ) ).read()
111 minInputValue = min( image["R"] )
112 maxInputValue = max( image["R"] )
113
114 self.assertTrue( minInputValue < 0.125 )
115 self.assertTrue( maxInputValue > 0.5 )
116
117 image2 = IECoreImage.ClampOp()( input=image, min=0.25, max=0.5, enableMinTo=True, minTo=0.125, enableMaxTo=True, maxTo=0.75 )
118
119 minOutputValue = min( image2["R"] )
120 maxOutputValue = max( image2["R"] )
121
122 self.assertEqual( minOutputValue, 0.125 )
123 self.assertEqual( maxOutputValue, 0.75 )
124
125 intermediateValues = False
126 for v in image2["R"] :
127 if v > 0.5 and v < 0.75 :
128 intermediateValues = True
129 elif v > 0.5 and v < 0.75 :
130 intermediateValues = True
131
132 self.assertFalse( intermediateValues )
133
134if __name__ == "__main__":
135 unittest.main()

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
ClampOpMethod · 0.80
readMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected