Skip to content

Return False from LineModelND and CircleModel when inputs are underdetermined  #6452

@ghost

Description

Description

Proposed Changes

  1. Replace the ValueError in LineModelND.estimate() with return False
  2. Modify the corresponding tests to assert a False return, instead of checking for a ValueError
  3. Add a return False to CircleModel.estimate() after the warning under the if-statement that checks for collinearity.
  4. Remove the second statement in the above mentioned warning, which states, "In scikit-image 1.0, this warning will become a ValueError."

Justification: Make classes more consistent with analogs

LineModelND raises a ValueError when the input data are under-determined. Similarly, CircleModel is scheduled to raise a ValueError when the input data are collinear.

LineModelND and CircleModel are part of a wider set of classes that include an estimate method for fitting points to a model and may be applied in algorithms such as ransac. Examples include the transforms in _geometric.py and EllipseModel() in fit.py. None of analogous other classes raise a ValueError when the inputs are underdetermined but instead return False.

LineModelND and CircleModel will be more consistent with their analogs if they do not raise ValueErrors when the input data are underdetermined.

Way to reproduce

Not applicable.

Version information

Not sure if applicable, but...

# Paste the output of the following python commands
3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 07:07:06) [Clang 13.0.1 ]
macOS-12.4-arm64-arm-64bit
scikit-image version: 0.19.3
numpy version: 1.23.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions