@@ -223,8 +223,6 @@ def testSZ3(self):
223223 "Values should not be identical" )
224224 self .assertTrue (numpy .allclose (original , output_data , atol = value ),
225225 "Values should be within tolerance" )
226- self .assertTrue (numpy .alltrue (compressed == output_data ),
227- "Compressed data should be identical" )
228226
229227 # relative 1E-4
230228 value = 1E-4
@@ -269,7 +267,10 @@ def testSZ3(self):
269267 self .assertTrue (original .shape == compressed .shape , "Incorrect shape" )
270268 self .assertFalse (numpy .alltrue (original == compressed ),
271269 "Values should not be identical" )
272- self .assertTrue (numpy .allclose (compressed , compressed_back ),
270+ # Absolute error from L2 norm param from:
271+ # https://github.com/szcompressor/SZ3/blob/v3.1.8/include/SZ3/utils/Statistic.hpp#L44
272+ abs_error = numpy .sqrt (3.0 / compressed .ndim ) * value
273+ self .assertTrue (numpy .allclose (compressed , compressed_back , atol = abs_error ),
273274 "Compressed read back values should be identical to compressed data" )
274275
275276 # create a compressed file
@@ -282,7 +283,7 @@ def testSZ3(self):
282283 "Values should not be identical" )
283284 self .assertTrue (numpy .alltrue (compressed == output_data ),
284285 "Compressed data should be identical" )
285- self .assertTrue (numpy .allclose (compressed_back , output_data ),
286+ self .assertTrue (numpy .allclose (compressed_back , output_data , atol = abs_error ),
286287 "Newly L2 norm read back values should be identical to compressed data" )
287288 h5 .close ()
288289
0 commit comments