Stats_one_arr¶
-
cosmo_utils.utils.stats_funcs.Stats_one_arr(x, y, base=1.0, arr_len=0, arr_digit='n', statfunc=<function nanmean>, bin_statval='average', return_perc=False, failval=nan, type_sigma='std', return_dict=False)[source] [edit on github]¶ Calculates statistics for 2 arrays
Parameters: x, y : array_like, shape(N,)
Sets of elements for the 1st and 2nd observable
base : float, optional
Bin width in units of
x. This variable is set to 1. by default.arr_len : int, optional
Minimum number of elements in each bin of
xarr_digit : {‘n’, ‘y’, ‘o’} str, optional
Option for which elements to return.
- Options:
- ‘n’ : Returns
x_stat,y_stat,y_std,y_std_err - ‘y’ : Returns
x_stat,y_stat,y_std,y_std_err,x_bins_data,y_bins_data - ‘o’ : Returns
x_bins_data,y_bins_data
- ‘n’ : Returns
statfunc : {
numpy.nanmean,numpy.nanmedian} statistical func, optionalNumerical function used to calculate on bins of data. By default, this variable is set to
numpy.nanmeanbin_statval : {‘average’, ‘left’, ‘right’, ‘center’} str, optional
Option for where to put the bin values of
xandy. By default, this variable is set toaverage, which means that the values are those of the averages of the bins inxandy.return_perc :
bool, optionalIf true, it also returns the
percentilesof the data. Last item in the return list. This variable is set to False by default.failval :
int,float,NoneType, orNaN, optionalThis is the value used when no data is available for the bin. This is set to
numpy.nanby defaulttype_sigma : {‘perc’, ‘std’} string, optional (default = ‘std’)
Option for calculating either
percentilesorstandard deviations. This variable is set tostdby default.- Options:
perc: calculates percentilesstd: uses standard deviations as 1-, 2-, and 3-sigmas
return_dict :
bool, optionalReturns: x_stat, y_stat : array_like
Binned array of elements from
xy_std : array_like
Standard deviation of the binned array in
xy_std_err : array_like
Error in the
statfuncofyx_bins_data : array_like, optional
Elements of
xin each bin with spacing ofbase. Only returned ifarr_digit== ‘y’ or ‘o’y_bins_data : array_like, optional
Elements of
yin each bin with spacing ofbase. Only returned ifarr_digit== ‘y’ or ‘o’perc_lims : array_like, shape(N,3)
Percentiles in each bin of
x_stat. Only returned ifarr_digit== ‘y’ or ‘o’