Skip to main content

Standard physical units are imported from intec.units.si

from intec.units.si import METER, MILLIMETER, NANOMETER, AMPERE, VOLT, OHM

A Quantity is created by multiplying a number (the magnitude) and a Unit

d = 1550*NANOMETER
print(d)
1550.000000 nm
d
LengthQuantity( 1.5500000000e+03, nm )

Quantities of the same physical dimension can be added or substracted

1*METER + 5*MILLIMETER
LengthQuantity( 1.0050000000e+00, m )

The resulting quantity gets the unit of the first term.

print(5*MILLIMETER + 1*METER)
1005.000000 mm
1*METER + 1*AMPERE
---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-6-26114287a935> in <module>
----> 1 1*METER + 1*AMPERE


TypeError: Cannot convert unit [A] to unit [m]

Quantities of the same physical dimension can be compared

p = 1*VOLT*2*AMPERE
print(p)
2.000000 V.A
from intec.units.si import WATT, MILLIWATT, DBM
p == 2*WATT
True
3*VOLT/AMPERE > 2*OHM
True

Use the to member function to convert a quantity to a related unit.

print(p.to(MILLIWATT))
print(p.to(DBM))
2000.000000 mW
33.010300 dBm
from intec.units.si import METER, KILOMETER, SECOND
from intec.units.extra import HOUR
speed = 10*METER/SECOND
print(speed.to(KILOMETER/HOUR))
36.000000 km/h

Use the member magnitude or m to retrieve the numerical value of a quantity

speed.magnitude
10.0
speed.m
10.0

Use the member unit or u to retrieve the unit of a quantity

speed.unit
Unit( 'm/s' [m/s] )
speed.u
Unit( 'm/s' [m/s] )

For (wave)lengths there is a convenience function to convert to frequency.

from intec.units.si import NANOMETER,HERTZ
λ = 1550*NANOMETER
λ.to_frequency()
FrequencyQuantity( 1.9341448903e+02, THz )
λ.to_frequency(HERTZ)
FrequencyQuantity( 1.9341448903e+14, Hz )

For photonic experiments, use intec.units.photonic to import all common units in one fell swoop

from intec.units.photonic import *
from .si import METER, MILLIMETER, MICROMETER, NANOMETER, PICOMETER, FEMTOMETER
from .si import WATT, MILLIWATT, MICROWATT, DBM
from .si import VOLT, MILLIVOLT, MICROVOLT
from .si import AMPERE, MILLIAMPERE, MICROAMPERE
from .si import HERTZ, KILOHERTZ, MEGAHERTZ, GIGAHERTZ, TERAHERTZ
from .si import SECOND, MILLISECOND, MICROSECOND
from .si import KELVIN, CELCIUS

Release files for intec-units 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for intec-units 0.0.5
File
intec_units-0.0.5-cp38-cp38m-win_amd64.whl CPython 3.8 CPython 3.8 pymalloc Windows x86-64 Details
intec_units-0.0.5-cp38-cp38m-win32.whl CPython 3.8 CPython 3.8 pymalloc Windows x86-32 Details
intec_units-0.0.5-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
intec_units-0.0.5-cp37-cp37m-win32.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-32 Details
intec_units-0.0.5-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
intec_units-0.0.5-cp36-cp36m-win32.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-32 Details
intec_units-0.0.5-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
intec_units-0.0.5-cp35-cp35m-win32.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-32 Details
intec_units-0.0.5-cp34-cp34m-win_amd64.whl CPython 3.4 CPython 3.4 pymalloc Windows x86-64 Details
intec_units-0.0.5-cp34-cp34m-win32.whl CPython 3.4 CPython 3.4 pymalloc Windows x86-32 Details

Total release size: 256.9 kB

Release files / intec_units-0.0.5-cp38-cp38m-win_amd64.whl

Download URL intec_units-0.0.5-cp38-cp38m-win_amd64.whl
Size 26.6 kB
Tags CPython 3.8 CPython 3.8 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
779d9f2c2040c390bfa73b9718c42fb69c306a421d68731825a78e511afa11a6
BLAKE2b-256 checksum
How to use checksums
d78fb8d9828efda08a53781ae2716d1c3f8e945752cf544c4737dc0e4a85dbcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / intec_units-0.0.5-cp38-cp38m-win32.whl

Download URL intec_units-0.0.5-cp38-cp38m-win32.whl
Size 24.7 kB
Tags CPython 3.8 CPython 3.8 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
36761f6b25e38d06cce69ffbc040809c9bbe1bfec2ff0694f1d52fed34628763
BLAKE2b-256 checksum
How to use checksums
834b3b58e43d429b4795004510756df2e3aacf64b407959e6dd1bcefa88638b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / intec_units-0.0.5-cp37-cp37m-win_amd64.whl

Download URL intec_units-0.0.5-cp37-cp37m-win_amd64.whl
Size 26.6 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
2fbb5bee0cef86a88cfbfbbbcc9ac6f6af8cbe4ef73cfeba3f84a91ef20f385e
BLAKE2b-256 checksum
How to use checksums
6fa23187f641373a1b025bd36662ed3e0955e1b454b94f5ee501f4b1d5d53360
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / intec_units-0.0.5-cp37-cp37m-win32.whl

Download URL intec_units-0.0.5-cp37-cp37m-win32.whl
Size 24.8 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
0efb72a0fc086b406f8f27f4a5e1f85a1f6540831bc18537dc770be5e5355dec
BLAKE2b-256 checksum
How to use checksums
2ae197679d5265dd2313d7c51279ffbb1043434904f5b9191917487a3b230d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / intec_units-0.0.5-cp36-cp36m-win_amd64.whl

Download URL intec_units-0.0.5-cp36-cp36m-win_amd64.whl
Size 26.6 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
b4f0df35f459cc0ffdf312783c24af1e3024491736a70b90c292326c1074c76d
BLAKE2b-256 checksum
How to use checksums
e10d9358414afbcc7a31f18e6f62de99bd6af213732aa9fdbab1082c94dd0640
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / intec_units-0.0.5-cp36-cp36m-win32.whl

Download URL intec_units-0.0.5-cp36-cp36m-win32.whl
Size 24.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
1ca61300a1fef2931c92d62c71a7f019acac0b588e0cc212a346cea7aa459957
BLAKE2b-256 checksum
How to use checksums
013ea02781b2e7776455341d6c16bebb859d5bc2846344c127e4a4a5b1218eea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / intec_units-0.0.5-cp35-cp35m-win_amd64.whl

Download URL intec_units-0.0.5-cp35-cp35m-win_amd64.whl
Size 26.6 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
50333cbcda09140c7c29f81128561d1f4f7a5c9de5cad8d584c98324f3d4387d
BLAKE2b-256 checksum
How to use checksums
2d4d8b84a6d4cdcbaa51100830d8e784e874ebc6f71982d1c3e114c3e778a946
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / intec_units-0.0.5-cp35-cp35m-win32.whl

Download URL intec_units-0.0.5-cp35-cp35m-win32.whl
Size 24.8 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
eadb471ba6b08a1b3d16eb958cee7a1b79e9f8583c8e834f48731a2ba21a88c3
BLAKE2b-256 checksum
How to use checksums
16dfc7d12c7c4b705eda325107db059a2defe7072824b41dca52dba5aef2a034
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / intec_units-0.0.5-cp34-cp34m-win_amd64.whl

Download URL intec_units-0.0.5-cp34-cp34m-win_amd64.whl
Size 26.6 kB
Tags CPython 3.4 CPython 3.4 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
ebe6abd18d06becb365a04f1c9d8fa2b053a47677a5796da6ed16f3a8682f903
BLAKE2b-256 checksum
How to use checksums
b5387333e2334d6c29c1a862458611e6c06ec40b730e8e6244c22aa3a31c321d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / intec_units-0.0.5-cp34-cp34m-win32.whl

Download URL intec_units-0.0.5-cp34-cp34m-win32.whl
Size 24.8 kB
Tags CPython 3.4 CPython 3.4 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
02bddfe4c953557a4753c0ae3be72d29a59268cfdd4b6c230a05de216e7fb757
BLAKE2b-256 checksum
How to use checksums
3d48556575a4db97bb2d58311235cec2f75109cc82acee3e7febfdf43c82b076
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.5 This release

10 release files

0.0.4

10 release files

0.0.3

10 release files

0.0.2

10 release files

0.0.1

10 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page