Skip to content

random walker: Display a warning when the probability is outsite [0,1] for a given tol - #4631

Merged
JDWarner merged 10 commits into
scikit-image:masterfrom
sciunto:walker_tol
May 18, 2020
Merged

JDWarner merged 10 commits into
scikit-image:masterfrom
sciunto:walker_tol

Conversation

@sciunto

@sciunto sciunto commented Apr 30, 2020

Copy link
Copy Markdown
Member

Description

I fully agree with the diagnosis explained in this #2360 (comment)

In this PR, I add a new parameter to display a warning when the probability is off.

Closes #2360

Checklist

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.

@emmanuelle

Copy link
Copy Markdown
Member

@sciunto I tried to fix the CI problem, please pull from your remote branch :-).

@emmanuelle

Copy link
Copy Markdown
Member

Thank you very much @sciunto for addressing an old but relevant issue. Since you added a new attribute could you please also add a new test (probably checking that the warning is issued if prob_tol is very low?).

@sciunto

sciunto commented May 2, 2020

Copy link
Copy Markdown
Member Author

Thanks for the fix and the comment. I'll add some tests and might need to revisit others as well.

@emmanuelle

Copy link
Copy Markdown
Member

Now you have to catch the warnings in the tests :-).

@sciunto

sciunto commented May 12, 2020

Copy link
Copy Markdown
Member Author

Now, it should pass, and proper tests are added. :)

@sciunto sciunto added the ⏩ type: Enhancement Improve existing features label May 12, 2020
@sciunto sciunto added this to the 0.18 milestone May 12, 2020

def test_prob_tol():
# Turn warnings into errors
warnings.simplefilter('error')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good for debugging, but I don't think it should persist through the test suite.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just afraid that otherwise, we miss a failure. What's your suggestion?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah good catch. Anyway uncaught warnings make the test suite fail.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emmanuelle shall I understand that you want me also to remove this line?

On my machine, the test was not failing without this line. Is there another configuration in the CI that I missed? I remember that warnings were supposed to fail at some point, but I can't remember how this is set.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found it. The same line is in setup_test()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sciunto so are you going to remove it?? =) At which point you will have my approval. =)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I understand, yes :D

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed the commit

@jni jni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 !

@sciunto

sciunto commented May 18, 2020

Copy link
Copy Markdown
Member Author

Who wants to make a second review over here? :)

@rfezzani rfezzani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a minor comment about a not used import, otherwise LGTM, thx @sciunto ;)

@JDWarner
JDWarner merged commit 9880caf into scikit-image:master May 18, 2020
@sciunto
sciunto deleted the walker_tol branch May 18, 2020 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⏩ type: Enhancement Improve existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Numerical inaccuracies with the random_walker

6 participants