openqlab.conversion – Data Conversions

dB

Decibel conversions.

openqlab.conversion.db.subtract(signal: DataFrame | ndarray | float, noise: DataFrame | ndarray | float) DataFrame | ndarray | float

Subtract noise from the signal.

Both signal and noise are converted from logarithmic scale to linear, then subtracted and converted back to logarithmic scale.

Parameters:
  • signal

  • noise

Utils

Some unit utils.

openqlab.conversion.utils.human_readable(value: float, unit: str = '', tenth_steps: bool = False) str

Return an approximate string representation of a value, with appropriate unit prefixes (µ, k, M, …) added. Accuracy is ~0.1%.

Parameters:
  • value (float) – the value to convert into human-readable representation

  • unit (string) – an optional unit string, such as ‘Hz’, ‘m’

Returns:

the human-readable representation

Return type:

str

Wavelength

Wavelength calucations.