Tutorial — Qty 0.0.1 documentation

# Tutorial

This tutorial will guide you through the basics of Qty.

1. Install Qty (see Installation).

2. Import the relevant classes from the `qty` module. This tutorial uses units of energy.

       1
       >>> from qty import Energy

3. Instantiate a quantity object.

       2
       >>> quantity = Energy()

4. Assign a value to the quantity object using one of the available units. Each unit is implemented as a descriptor that includes a setter and a getter. The setter converts and stores the quantity to the base units of the class. For example, the base units of the `Energy` class are joules (J). The getter converts and returns the quantity in the desired units.

       3
       >>> quantity.meV = 1600.

   Note

   The units are implemented as descriptors and are therefore assigned and accessed without arguments.

5. To obtain the quantity in different units, simply access the corresponding attribute.

       4
       5
       >>> quantity.nm
       774.9012402075016