ensure_units_compatible#

mufasa.visualization.spec_viz.ensure_units_compatible(lim, data_unit, suppress_warning=False)[source]#

Ensure the limits have compatible units with the data, converting if needed. If the data has no units, strip units from the limits directly and issue a warning if desired.

Parameters:
  • lim (tuple or None) – The limit tuple (min, max) to be checked and potentially converted.

  • data_unit (astropy.units.Unit or None) – The unit of the data to which the limits should be compatible.

  • suppress_warning (bool, optional) – If True, suppresses warnings when stripping units from limits.

Returns:

Limits in compatible units with data, or stripped of units if data has no units.

Return type:

tuple