pyphot.ezunits package

Submodules

pyphot.ezunits.pint module

pint

Pint is Python module/package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement. It allows arithmetic operations between them and conversions from and to different units.

copyright

2012 by Hernan E. Grecco.

license

BSD, see LICENSE for more details.

class pyphot.ezunits.pint.AliasDict(*args, **kwargs)[source]

Bases: dict

add_alias(key, value, preferred=False)[source]
get_aliased(key)[source]
exception pyphot.ezunits.pint.DimensionalityError(units1, units2, dim1=None, dim2=None)[source]

Bases: ValueError

Raised when trying to convert between incompatible units.

exception pyphot.ezunits.pint.UndefinedUnitError(unit_names)[source]

Bases: ValueError

Raised when the units are not defined in the unit registry.

class pyphot.ezunits.pint.UnitRegistry(filename='', force_ndarray=False)[source]

Bases: object

The unit registry stores the definitions and relationships between units.

Parameters
  • filename – path of the units definition file to load. Empty to load the default definition file. None to leave the UnitRegistry empty.

  • force_ndarray – convert any input, scalar or not to a numpy.ndarray.

add_from_file(filename)[source]

Add units and prefixes defined in a definition text file.

add_prefix(name, value, aliases=())[source]

Add prefix to the registry.

add_unit(name, value, aliases=(), **modifiers)[source]

Add unit to the registry.

get_alias(name)[source]

Return the preferred alias for a unit

class pyphot.ezunits.pint.UnitsContainer(*args, **kwargs)[source]

Bases: dict

The UnitsContainer stores the product of units and their respective exponent and implements the corresponding operations

add(key, value)[source]
pyphot.ezunits.pint.converter_from_reference(scale, offset, log_base)[source]
pyphot.ezunits.pint.converter_to_reference(scale, offset, log_base)[source]

Module contents

pint

Pint is Python module/package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement. It allows arithmetic operations between them and conversions from and to different units.

copyright
  1. 2012 by Hernan E. Grecco.

license

BSD, see LICENSE for more details.

pyphot.ezunits.hasUnit(val)[source]