glasspy package

Subpackages

Submodules

glasspy.support module

glasspy.support.round_number_with_error(x, error)

Round numbers with respect of their errors.

x:

Array-like object with numbers. These are the values that will be rounded.

Error

Array-like object with numbers. These are the errors that will guid the rounding of x.

Returns

Rounded values of x. .. error:: Error of x with 1 significant digit.

text:

String array with the values of x with error represented in parenthesis.

Return type

x

Raises

AssertionError – Happens when you have a negative value in the error argument. Errors must be positive.

glasspy.support.round_to_closest_base(x, base)

Round numbers to closest base number.

Parameters
  • x – Array-like object with numbers.

  • base – Float to which the numbers will be rounded.

Returns

Numpy array with the rounded numbers.

Note

Implementation by Alok Singhal found in https://stackoverflow.com/a/2272174.

glasspy.support.round_to_significant_figure(x, n)

Round numbers to n sifnificant digits.

Parameters
  • x – Array-like object with numbers.

  • n – Integer representing the number of significant digits to round to. Must be the same shape as x.

Returns

Numpy array with the numbers rounded to the desired significant digits.

Note

Implementation by Scott Gigante found in https://stackoverflow.com/a/59888924.

Module contents