Skip to content

Enhancement/improve handling of warnings

Daniel Scheffler requested to merge enhancement/improve_handling_of_warnings into main

This improves the handling of warnings raised from child processes during the tie point computation. So far, warnings were shown by every child process which may lead to a long list of recurring warnings in STDERR. The changes made here record the warnings from the main process and add a function to display a summary of the warnings like this:

Matching window position (X,Y): 345539.8269161515/5847665.997243915
Initializing tie points grid...
Equalizing pixel grids and projections of reference and target image...
Calculating tie point grid (453 points) using 32 CPU cores...
Found 385 matches.
Performing validity checks...
47 tie points flagged by level 1 filtering (reliability).
14 tie points flagged by level 2 filtering (SSIM).
19 tie points flagged by level 3 filtering (RANSAC)
314 valid tie points remain after filtering.
.

======================================================================================================================== warnings summary ========================================================================================================================
tests/test_COREG_LOCAL.py::CompleteWorkflow_INTER1_S2A_S2A::test_calculation_of_tie_point_grid_float_coords
  /home/gfz-fe/scheffler/python/arosics/arosics/Tie_Point_Grid.py:436: UserWarning: The following warnings were recorded during tie point computation:
  - 435x (for ~97% of all tie point candidates):        'UserWarning('Test warning!')'
    warn("The following warnings were recorded during tie point computation:\n" +

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

Related to #94.

Edited by Daniel Scheffler

Merge request reports

Loading