-
Notifications
You must be signed in to change notification settings - Fork 119
Add documentation for logunit
#769
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for getting this going, Chris! To my surprise, it seems that logarithmic quantities are not actually subtypes of This bit me in MakieOrg/Makie.jl#4801, so just wanted to give a heads up in case things like Lines 15 to 16 in f927270
need to be clarified |
Valid arguments to logunit are technically not `Quantity` so be more careful about wording
Good point -- I updated the docstring in the PR, let me know if it looks better |
ugh, I forgot about |
This is just an addition to the docs and should be ready to merge if someone can have a look. |
dB | ||
|
||
julia> logunit(u"dB") | ||
dB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add an additional example for MixedUnits
, since they are already mentioned in the docstring?
julia> logunit(u"dBm/s")
dBm
src/logarithm.jl
Outdated
""" | ||
logunit(x::LogScaled) | ||
logunit(x::Union{Type{<:LogScaled}, MixedUnits}) | ||
Returns the units associated with a `LogScaled` instance, a `LogScaled` type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns the units associated with a `LogScaled` instance, a `LogScaled` type, | |
Returns the logarithmic "units" associated with a `LogScaled` instance, a `LogScaled` type, |
The manual refers to these as logarithmic "units"
. I think this might be less confusing, especially in the case of MixedUnits
.
julia> logunit(u"dB") | ||
dB | ||
``` | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A reference to the unit
docstring might be useful, e.g.
See also: [`unit`](@ref).
(A reference from unit
to logunit
could be added as well.)
Thanks @sostock, I have implemented your feedback in the above two commits. |
logunit
is exported but not documented. This function is useful and documenting it would be beneficial (it recently came up in #582). This PR adds a docstring tologunit
and adds it to the API documentation in thelogarithm.md
file.