-
Notifications
You must be signed in to change notification settings - Fork 10
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
Recipe request for logarithmic units #47
Comments
Interesting, thanks for reporting! The issue is, that we dispatch on julia> using Unitful
julia> supertypes(typeof(2u"dB"))
(Gain{Unitful.LogInfo{:Decibel, 10, 10}, :?, Int64}, Unitful.LogScaled{Unitful.LogInfo{:Decibel, 10, 10}}, Number, Any)
julia> supertypes(typeof(2u"m"))
(Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}, Unitful.AbstractQuantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}, Number, Any) This can probably be fixed by replacing |
I'm actually surprised that there is no parent abstract type for those: julia> typejoin(typeof(1u"m"), typeof(1u"dB"))
Number And I'm not sure there's a reason for that. Maybe worth asking the Unitful.jl peeps? Otherwise, I think @jw3126's suggestion is the best and quickest solution, unless I'm missing something. Maybe we could add it a constant const QuantityOrLogScaled = Union{AbstractQuantity, LogScaled} and then dispatch on that? (and also maybe it's worth upstreaming that up into Unitful?) Also, side note: I realize we use |
There's also that the function |
OK so it looks like we need to think this through a bit more (and it will require a bit more work)! |
Just a comment for this if you decide to go for it, a common construction is |
I looked into this a little, and my conclusions so far:
https://github.com/gustaphe/UnitfulRecipes.jl/blob/logarithmic/src/logarithmic.jl |
plot([2u"dB", 3u"dB"])
doesn't work for me. Quick tests like this suggest that logarithmic units aren't working, for either axis. Is it possible/easy to add a recipe for these?The text was updated successfully, but these errors were encountered: