kdavies4 / natu

Natural units in Python
http://kdavies4.github.io/natu/
Other
33 stars 5 forks source link

Hz not compatible with seconds #25

Open endolith opened 8 years ago

endolith commented 8 years ago

After a lot of work I finally figured out why my calculations weren't working:

a = 1*Hz

a.display_unit = '1/s'

a
Traceback (most recent call last):
...
  File "...\natu\core.py", line 363, in wrapped
    "({1} vs. {0.dimension}).").format(self, unit_dim)

AssertionError: The display unit (1/s) and the quantity have different dimensions (1/T vs. A/T).

I couldn't figure out what A meant, finally found it in http://kdavies4.github.io/natu/base-ini.html "an additional dimension to track angle (A)."

So I guess this is used to differentiate between ordinary frequency vs angular frequency? It's usually considered that Hz = 1/s, though.

SweRavn commented 6 years ago

I also wonder about this issue, is there any resolution to how it is supposed to be handled in natu? If I set frequency as f = 1*Hz and import speed of light from natu as from natu.groups.constants import c and then compute wavelength as w = c/f w gets the dimension m/cyc. This is not what one typically has. So, how should I treat this in my code to get it right?