Skip to content

Commit

Permalink
Merge branch 'topic/default/save-error-codes' into 'branch/default'
Browse files Browse the repository at this point in the history
PIV files: save UVmat error codes

See merge request fluiddyn/fluidimage!108
  • Loading branch information
paugier committed May 14, 2024
2 parents ca518ec + e15cf60 commit e99a984
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/fluidimage/data_objects/piv.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,23 @@ def _save_in_hdf5_object(self, file, tag="piv0"):
g.create_dataset("keys", data=keys)
g.create_dataset("values", data=values)

if name_dict == "errors":
error_codes = np.empty(len(values), dtype=np.uint8)
code_unknow = np.iinfo(error_codes.dtype).max
for idx, error in enumerate(values):
if error.startswith(b"Correlation peak touching"):
code = 1
elif error.startswith(b"correl < correl_min"):
code = 2
elif error.startswith(b"delta2 < displacement_max2"):
code = 3
elif error.startswith(b"diff neighbour too large"):
code = 4
else:
code = code_unknow
error_codes[idx] = code
g.create_dataset("codes", data=error_codes)

if "deltaxs_tps" in self.__dict__:
g = g_piv.create_group("deltaxs_tps")
for i, arr in enumerate(self.deltaxs_tps):
Expand Down

0 comments on commit e99a984

Please sign in to comment.