Skip to content

Commit

Permalink
warning are annoying when called in monte carlo simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
Boxylmer committed Nov 19, 2023
1 parent 07e84ce commit 497e5ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MembraneBase"
uuid = "a9449b16-1c3f-48ab-aa2c-0b9c6d97beee"
authors = ["Will <[email protected]> and contributors"]
version = "0.1.25"
version = "0.1.26"

[deps]
Bootstrap = "e28b5b4c-05e8-5b66-bc03-6f0c0a0a06e0"
Expand Down
6 changes: 4 additions & 2 deletions src/HelperFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ function fit_linear_data(x::AbstractVector{<:Number}, y::AbstractVector{<:Number
return slope, intercept
end

function fit_linear_data(x::AbstractVector{<:Number}, y::AbstractVector{<:Measurement})
function fit_linear_data(x::AbstractVector{<:Number}, y::AbstractVector{<:Measurement}; verbose=false)
weights = [1 / (meas.err^2) for meas in y]
for wt in weights
if isinf(wt)
@warn("A measurement uncertainty was zero. (weight_i = 1/var_i^2 = Inf when var_i = 0)\nDefaulting to unweighted linear regression.")
if verbose
@warn("A measurement uncertainty was zero. (weight_i = 1/var_i^2 = Inf when var_i = 0)\nDefaulting to unweighted linear regression.")
end
weights = missing
end
end
Expand Down

2 comments on commit 497e5ac

@Boxylmer
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/95618

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.26 -m "<description of version>" 497e5ac360a8c2090606a4d7aac0eace8fe2323b
git push origin v0.1.26

Please sign in to comment.