nice_number#

cosmicjellyfish.analysis.utilities.nice_number(num, mode=1, digits=1)[source]#

This function returns a nice number built with num. This is useful to build the axes of a plot. The nice number is built by taking the first digit of the number.

Parameters:
  • num (float or int) – input number

  • mode (int) –

    (optional) operation to use to build the nice number

    0 – use ceil
    1 – use round
    2 – use floor

  • digits (int) – input number of digits to keep

Returns:

a nice number!

Return type:

float