kim_tools package

Subpackages

Submodules

kim_tools.kimunits module

Simple wrapper for executable for converting arbitrary units to SI units

Copyright (c) 2014-2022, Regents of the University of Minnesota. All rights reserved.

This software may be distributed as-is, without modification.

exception kim_tools.kimunits.UnitConversion

Bases: Exception

Class for unit conversion errors

kim_tools.kimunits.check_units_util()

Figure out if units (first choice) or gunits (second choice) works with the options that we use

Return type:

str

kim_tools.kimunits.linear_fit(x, y)

Perform a linear fit between x,y, returning the average error for each data point as well. This is written this way so as to not add a numpy dependency

kim_tools.kimunits.islinear(unit, to_unit=None)

Detect if the conversion from unit to to_unit is a linear map. Apparently the units utility is float precision, so if error is less than 1e-7 we know it is linear.

kim_tools.kimunits.convert_units(from_value, from_unit, wanted_unit=None, suppress_unit=False)

Works with 'units' utility

kim_tools.kimunits.convert(from_value, from_unit, wanted_unit=None, suppress_unit=False)

Works with 'units' utility

kim_tools.kimunits.convert_list(x, from_unit, to_unit=None, convert=<function convert_units>, dofit=True)

Thread conversion over a list, or list of lists

kim_tools.kimunits.add_si_units(doc, convert=<function convert_units>)

Given a document, add all of the appropriate si-units fields

Module contents