Skip to content

unit and dimension are inconsistent for LevelsΒ #582

@sostock

Description

@sostock

For Levels (and mixed quantities based on Levels), unit discards the logarithmic part, dimension does not:

julia> unit(5u"dBV")      # NoUnits

julia> dimension(5u"dBV") # voltage
𝐋^2 𝐌 𝐈^-1 𝐓^-3

julia> unit(5u"dBV*m")      # meters (a length)
m

julia> dimension(5u"dBV*m") # voltage * length
𝐋^3 𝐌 𝐈^-1 𝐓^-3

I think the behavior of dimension makes sense. To fix unit, there are two possibilities:

  1. Use the unit of the reflevel, i.e., unit(5u"dBV") == V
  2. Make unit(::Level) throw an error

Edit: Related: #528.

Metadata

Metadata

Assignees

No one assigned

    Labels

    logarithmiclogarithmic scales (decibels, nepers, …)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions