Skip to content

uint

typing._array._uint.OptionalUInt16 = UInt16 | None module-attribute

typing._array._uint.OptionalUInt32 = UInt32 | None module-attribute

typing._array._uint.OptionalUInt64 = UInt64 | None module-attribute

typing._array._uint.OptionalUInt8 = UInt8 | None module-attribute

Optional 8-bit unsigned integer array type.

Extends Uint8 to include None, representing compact integer arrays that may be missing or not yet initialized.

Type Definition

npt.NDArray[np.uint8] | None

Example

Optional atomic numbers::

atom_z: Data[OptionalUint8] = Data[OptionalUint8](
    dtype=np.uint8,
    meta=Metadata(description="Atomic numbers"),
    default=None
)

# Check if atomic numbers are available
z_values = molecule.atom_z.value
if z_values is not None:
    unique_elements = np.unique(z_values)
See Also

Uint8: Non-optional version OptionalInt32: Signed alternative with larger range

typing._array._uint.UInt16 = npt.NDArray[np.uint16] module-attribute

typing._array._uint.UInt32 = npt.NDArray[np.uint32] module-attribute

typing._array._uint.UInt64 = npt.NDArray[np.uint64] module-attribute

typing._array._uint.UInt8 = npt.NDArray[np.uint8] module-attribute

8-bit unsigned integer array type.

Represents NumPy arrays containing 8-bit unsigned integers. This is the most memory-efficient integer type, suitable for small positive integer values such as atomic numbers, small counts, or categorical data.

Characteristics:

  • Range: 0 to 255 (256 unique values)
  • Memory: 1 byte per element (most efficient)
  • Unsigned: Only non-negative values
  • Commonly used for compact data representation

Typical Use Cases:

  • Atomic numbers (1-118 for all elements)
  • Small categorical identifiers
  • Boolean-like flags (0/1)
  • Compact enumeration indices
Example

Atomic numbers::

atom_z: Data[Uint8] = Data[Uint8](
    dtype=np.uint8,
    meta=Metadata(
        description="Atomic numbers",
        store=StoreKind.ARRAY
    )
)

Creating atomic number data::

# H, H, O for water molecule
atomic_numbers = np.array([1, 1, 8], dtype=np.uint8)
molecule.atom_z = atomic_numbers

Element mapping::

# All periodic table elements fit in uint8
all_elements = np.arange(1, 119, dtype=np.uint8)  # H to Og
Memory Efficiency
  • 8x more memory efficient than Int64
  • 4x more memory efficient than Int32
  • Excellent for large arrays of small values
  • Significant memory savings for molecular systems
Range Limitations
  • Cannot represent negative values
  • Maximum value is 255
  • Consider larger integer types if range is insufficient
Use Cases in Chemistry
  • Perfect for atomic numbers (max 118)
  • Residue types in proteins
  • Bond orders (1, 2, 3)
  • Small multiplicity values
See Also

Int32: Signed integers with larger range OptionalUint8: Optional version including None numpy.uint8: NumPy documentation for uint8 type