qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec. half_integer_to_str  (  val ,  symbol='/'  )[source]

Convert a half-integer into a rational str representation, e.g., "3/2".

Parameters:
valscalar

A half-integer value.

symbolstr

The symbol to use for the fraction.

Returns:
sstr

A rational str representation of the half-integer.

Raises:
ValueError

If val is not a multiple of 1/2.