Qudi
Public Member Functions | List of all members
core.util.units.ScaledFloat Class Reference

Format code 'r' for scaled output. More...

Inheritance diagram for core.util.units.ScaledFloat:
Inheritance graph
[legend]
Collaboration diagram for core.util.units.ScaledFloat:
Collaboration graph
[legend]

Public Member Functions

def scale (self)
 Returns the scale. More...
 
def scale_val (self)
 Returns the scale value which can be used to devide the actual value. More...
 
def __format__ (self, fmt)
 Fromats the string using format fmt. More...
 

Detailed Description

Format code 'r' for scaled output.

Examples

'{:.0r}A'.format(ScaledFloat(50))

50 A

'{:.1r}A'.format(ScaledFloat(1.5e3))

1.5 kA

'{:.1r}A'.format(ScaledFloat(2e-3))

2.0 mA

'{:rg}A'.format(ScaledFloat(2e-3))

2 mA

'{:rf}A'.format(ScaledFloat(2e-3))

2.000000 mA

Member Function Documentation

◆ __format__()

def core.util.units.ScaledFloat.__format__ (   self,
  fmt 
)

Fromats the string using format fmt.

r for scaled output.

Parameters

fmt str format string

◆ scale()

def core.util.units.ScaledFloat.scale (   self)

Returns the scale.

(No prefix if 0)

   Examples
   --------

1e m 1e6 M

◆ scale_val()

def core.util.units.ScaledFloat.scale_val (   self)

Returns the scale value which can be used to devide the actual value.

Examples

m 1e-3 M 1e6


The documentation for this class was generated from the following file: