Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

santize w_dens #86

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

santize w_dens #86

wants to merge 5 commits into from

Conversation

CyGei
Copy link
Contributor

@CyGei CyGei commented Aug 16, 2022

Trying my first PR.

Issue: when w_dens contains 0s (not necessarily trailing 0s), the arbritary threshold 1e-15 can lead to some errors.
Solution: replace any 0s with the minimum value in w_dens.
Test : see tests/test_w_dens.R.

Questions: should we use the same procedure for f_dens?
Should we use dexp() for the starting 0s ?
Why the dexp() tail sums to 1e-4?

Copy link
Collaborator

@thibautjombart thibautjombart left a comment

Choose a reason for hiding this comment

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

Thanks for getting this started, and well done on your first PR! I would recommend:

  • implementing the feature as a separate function in a dedicated file in R/
  • adding a warning (already added to the code as suggestion); note we may want to check if we need to add a 'quiet' option
  • the test needs to use testthat syntax

Looking forward to discussing these points :)

R/outbreaker_data.R Outdated Show resolved Hide resolved
@@ -0,0 +1,58 @@
here::here()
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a specific syntax for test to use in a package, using testthat. See other test files in this project for some examples. Here, the additional tests should include:

  • testing that the warning is issued when it should, and that it is the exact message expected
  • testing that the replacement of non-positive values is made when it should

If we go down the road of implementing satitize_pmf then ideally the test is in a file test-satitize_pmf.R.

@finlaycampbell
Copy link
Collaborator

@CyGei - going through other open issues now, is this still relevant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants