Skip to content

Commit 18d8414

Browse files
committed
Write output using scientific notation
The velocities were previously hard cut off if too low. This is an unnecessary restrictions for users and leads to misleading confidence in large velocities, as more digits are preserved. Using scientific notation solves this problem. Compared to the previous notation ten more characters are used per line (that is two additional characters per value). However, the benefit of handling a wider range of velocities outweighs this in my opinion. For the test to still pass, the threshold of image comparison needed to be adjusted. This is due to the higher round-off error with the old notation used in the reference image (specifically in 'u').
1 parent 842ec6a commit 18d8414

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

openpiv/test/test_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_display_vector_field(file_a=_file_a, file_b=_file_b, test_file=_test_fi
4343
display_vector_field('tmp.txt', on_img=True, image_name=file_a, ax=ax)
4444
decorators.remove_ticks_and_titles(fig)
4545
fig.savefig('./tmp.png')
46-
res = compare.compare_images('./tmp.png', test_file, 0.001)
46+
res = compare.compare_images('./tmp.png', test_file, 0.05)
4747
assert res is None
4848

4949
def test_file_patterns():
@@ -62,4 +62,4 @@ def test_file_patterns():
6262
# settings.frame_pattern_b = '(1+2),(3+4)'
6363
"""
6464

65-
65+

openpiv/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def find_boundaries(threshold, list_img1, list_img2, filename, picname):
329329
return list_bound
330330

331331

332-
def save(x, y, u, v, mask, filename, fmt="%8.4f", delimiter="\t"):
332+
def save(x, y, u, v, mask, filename, fmt="%.4e", delimiter="\t"):
333333
"""Save flow field to an ascii file.
334334
335335
Parameters
@@ -652,4 +652,4 @@ def transform_coordinates(x, y, u, v):
652652
y = y[::-1, :]
653653
v *= -1
654654
return x, y, u, v
655-
655+

0 commit comments

Comments
 (0)