Fix failure in Geometric task caused by nanmedian
behavior
Arthur Eigenbrot
Branch: fix_nanmedian_failure
Branch: main
Merged
Merged pull request
Merged in fix_nanmedian_failure (pull request #118)
nanmedian
behaviorMerged in fix_nanmedian_failure (pull request #118)
This PR fixes some recent failures in the pipeline.
The issue is that a different number of hairline regions were discovered for the modstates in a single beam. In other words modstate X had 3 hairline regions while modstate Y had 4 hairline regions. (Having more than 2 hairline regions is possible in some older(?) data sets that suffer from reflections(?) of higher-order hairline images. The ViSP team is aware of this).
The bug occurred when trying to take
nanmedian
of a list containing arrays of different lengths. For example,np.nanmedian([np.array([1, 2, 3]), np.array([1, 2, 3])])
works, butnp.nanmedian([np.array([1, 2]), np.array([1, 2, 3])])
errors out because the individual arrays do not have the same length.To fix this we simply flatten the list of input arrays prior to sending it to
nanmedian
. So in the above, failing example we would instead havenp.nanedian(np.array([1, 2, 1, 2, 3])
, which works just fine.