convert_memory_units

  • full name: tenpy.tools.misc.convert_memory_units

  • parent module: tenpy.tools.misc

  • type: function

tenpy.tools.misc.convert_memory_units(value, unit_from='bytes', unit_to=None)[source]

Convert between different memory units.

Parameters:
  • value (float) – The value to convert.

  • unit_from ('bytes'| 'KB'| 'MB'| 'GB'| 'TB') – The unit to convert from.

  • unit_to (None | 'bytes'| 'KB'| 'MB'| 'GB'| 'TB') – The unit to convert to. The default None chooses a human-readable largest unit smaller than value.

Returns:

  • value (float) – The value in the unit unit_to.

  • unit_to (str) – The unit to which value was converted.