Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions quantities/unitquantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ class UnitInformation(IrreducibleUnit):
class UnitCurrency(IrreducibleUnit):

_primary_order = 9

class UnitLogIntensity(IrreducibleUnit):

_primary_order = 10

class UnitLogPower(IrreducibleUnit):

_primary_order = 11


class CompoundUnit(UnitQuantity):
Expand Down
3 changes: 3 additions & 0 deletions quantities/units/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
from . import length
from .length import *

from . import logunits
from .logunits import *

from . import mass
from .mass import *

Expand Down
27 changes: 27 additions & 0 deletions quantities/units/logunits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
"""
from __future__ import absolute_import

from ..unitquantity import UnitLogIntensity, UnitLogPower, UnitQuantity

bel = UnitLogIntensity(
'bel',
symbol='bel'
)
decibel = dB = UnitQuantity(
'decibel',
bel / 10,
'dB'
)

bel_milliwatt = UnitLogPower(
'bel_milliwatt',
symbol='Bm'
)
decibel_milliwatt = dBm = UnitQuantity(
'decibel_milliwatt',
bel_milliwatt / 10,
symbol='dBm'
)

del UnitLogIntensity, UnitLogPower, UnitQuantity