perun.io.util

IO Util.

Functions

getTFactorMag(→ Tuple[float, ...)

Get transformation factor and magnitude to improve string formating.

value2ValueUnitStr(→ str)

Return a printable representation as [Value:.3f][mag][unit] (e.g. 3.05mV) of the value based on its metric metadata.

value2MeanStdStr(→ str)

Return a printable representation as [Value:.3f]±[std:.3f][mag][unit] (e.g. 3.05±0.1mV) of the value based on its metric metadata.

Module Contents

perun.io.util.getTFactorMag(value: perun.data_model.measurement_type.Number, metric_md: perun.data_model.measurement_type.MetricMetaData) Tuple[float, perun.data_model.measurement_type.Magnitude][source]

Get transformation factor and magnitude to improve string formating.

Parameters:
  • value (Number) – Reference value

  • metric_md (MetricMetaData) – Value description

Returns:

Scaling factor and Magnitude Enum

Return type:

Tuple[float, Magnitude]

perun.io.util.value2ValueUnitStr(value: perun.data_model.measurement_type.Number, metric_md: perun.data_model.measurement_type.MetricMetaData) str[source]

Return a printable representation as [Value:.3f][mag][unit] (e.g. 3.05mV) of the value based on its metric metadata.

Parameters:
  • value (Number) – Value to apply formating to.

  • metric_md (MetricMetaData) – Value metadata.

Returns:

String represenation

Return type:

str

perun.io.util.value2MeanStdStr(stats: perun.data_model.data.Stats) str[source]

Return a printable representation as [Value:.3f]±[std:.3f][mag][unit] (e.g. 3.05±0.1mV) of the value based on its metric metadata.

Parameters:
  • stats (Stats obj) – Stats to apply formating to.

  • metric_md (MetricMetaData) – Value metadata.

Returns:

String represenation

Return type:

str