exa.core.plotting.qpu_core.utils.change_unit_magnitude

exa.core.plotting.qpu_core.utils.change_unit_magnitude#

change_unit_magnitude(unit, quantity, observation_type, quantity_error=None)#

Change the magnitude of units.

Changes some units into other common magnitudes. For instance, Hz -> GHz, s -> microseconds etc. This function is similar to _fix_data_units function in topology.py, but works with lists instead of dictionaries.

Parameters:
  • unit (str) – The unit to be scaled.

  • quantity (list[float] | ndarray) – Determines rescaling.

  • observation_type (str) – Certain types can rescale values for empty unit.

  • quantity_error (None | list[float]) – Uncertainties of the quantity.

Returns:

The new unit, the converted data, and the converted error if provided.

Return type:

tuple[str, list[Any] | ndarray, None | ndarray]