arraymean#

arraymean(data, stds=2, mean_sf=None, err_sf=None, doprint=False, **kwargs)[source]#

Quickly calculate the mean and standard deviation of an array.

By default, will calculate the correct number of significant figures based on the deviation.

Parameters:
  • data (array) – the data to summarize

  • stds (int) – the number of multiples of the standard deviation to show (default 2; can also use 1)

  • mean_sf (int) – if provided, use this number of significant figures for the mean rather than the auto-calculated

  • err_sf (int) – ditto, but for the error (standard deviation)

  • doprint (bool) – whether to print (else, return the string)

  • kwargs (dict) – passed to sc.sigfig()

Example:

data = [1210, 1072, 1722, 1229, 1902]
sc.printmean(data) # Returns 1430 ± 320

New in version 3.0.0.