Array Functions

Isopy Functions

sd

isopy.sd(a, axis=None, *, ci=None, zscore=None)[source]

Compute the standard deviation along the specified axis for N-1 degrees of freedom.

Shortcut for np.std(a, ddof = 1, axis=axis).

If ci is given the result will be multiplied by the confidence interval ci of a t-distribution with N-1 degrees of freedom.

If zscore is given then the result is multiplied by zscore.

Functions sd2, sd3, sd95 sd99 are also avaliable for z-score values of 2 and 3 and for 95% and 99% confidence intervals respectivley.

Examples

>>> array = isopy.array(ru = [np.nan, 1.1, 2.2, 1.8],
                        pd = [3.1, 3.8, 2.9, 4.2],
                        cd = [6.1, 5.8, 4.7, 8.1])
>>> isopy.sd(array)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None           nan    0.60553    1.41745
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.sd(array, axis=1)
array([       nan, 2.35867194, 1.28970281, 3.17962262])
>>> isopy.sd2(array) #same as sd(array, zscore=2)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None           nan    1.21106    2.83490
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.sd95(array) #same as sd(array, ci=0.95)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None           nan    1.92707    4.51096
IsopyNdarray(-1, flavour='element', default_value=nan)

See also

nansd(), np.std

nansd

isopy.nansd(a, axis=None, *, ci=None, zscore=None)[source]

Compute the standard deviation along the specified axis for N-1 degrees of freedom, while ignoring NaNs.

Shortcut for np.nanstd(a, ddof = 1, axis=axis).

If ci is given the result will be multiplied by the confidence interval ci of a t-distribution with N-1 degrees of freedom.

If zscore is given then the result is multiplied by zscore.

Functions nansd2, nansd3, nansd95 nansd99 are also avaliable for z-score values of 2 and 3 and for 95% and 99% confidence intervals respectivley.

Examples

>>> array = isopy.array(ru = [np.nan, 1.1, 2.2, 1.8],
                        pd = [3.1, 3.8, 2.9, 4.2],
                        cd = [6.1, 5.8, 4.7, 8.1])
>>> isopy.nansd(array)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       0.55678    0.60553    1.41745
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.nansd(array, axis=1)
array([2.12132034, 2.35867194, 1.28970281, 3.17962262])
>>> isopy.nansd2(array) #same as nansd(array, zscore=2)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       1.11355    1.21106    2.83490
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.nansd95(array) #same as nansd(array, ci=0.95)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       2.39562    1.92707    4.51096
IsopyNdarray(-1, flavour='element', default_value=nan)

See also

sd(), numpy.nanstd

se

isopy.se(a, axis=None, *, ci=None, zscore=None)[source]

Compute the standard error along the specified axis for N-1 degrees of freedom.

Shortcut for scipy.stats.sem(a, axis=axis, nan_policy='propagate').

If ci is given the result will be multiplied by the confidence interval ci of a t-distribution with N-1 degrees of freedom.

If zscore is given then the result is multiplied by zscore.

Functions se2, se3, se95 se99 are also avaliable for z-score values of 2 and 3 and for 95% and 99% confidence intervals respectivley.

Examples

>>> array = isopy.array(ru = [np.nan, 1.1, 2.2, 1.8],
                        pd = [3.1, 3.8, 2.9, 4.2],
                        cd = [6.1, 5.8, 4.7, 8.1])
>>> isopy.se(array)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None           nan    0.30277    0.70873
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.se(array, axis=1)
array([       nan, 1.36177988, 0.74461026, 1.83575598])
>>> isopy.se2(array) #same as se(array, zscore=2)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None           nan    0.60553    1.41745
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.se95(array) #same as se(array, ci=0.95)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None           nan    0.96353    2.25548
IsopyNdarray(-1, flavour='element', default_value=nan)

nanse

isopy.nanse(a, axis=None, *, ci=None, zscore=None)[source]

Compute the standard error along the specified axis for N-1 degrees of freedom, while ignoring NaNs.

Shortcut for scipy.stats.sem(a, axis=axis, nan_policy='omit').

If ci is given the result will be multiplied by the confidence interval ci of a t-distribution with N-1 degrees of freedom.

If zscore is given then the result is multiplied by zscore.

Functions nanse2, nanse3, nanse5 nanse99 are also avaliable for z-score values of 2 and 3 and for 95% and 99% confidence intervals respectivley.

Examples

>>> array = isopy.array(ru = [np.nan, 1.1, 2.2, 1.8],
                        pd = [3.1, 3.8, 2.9, 4.2],
                        cd = [6.1, 5.8, 4.7, 8.1])
>>> isopy.nanse(array)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       0.32146    0.30277    0.70873
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.nanse(array, axis=1) #returns a masked array
masked_array(data=[1.4999999999999996, 1.3617798810543664,
               0.7446102634562892, 1.835755975068582],
         mask=[False, False, False, False],
   fill_value=1e+20)
>>> isopy.nanse2(array) #same as nanse(array, zscore=2)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       0.64291    0.60553    1.41745
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.nanse95(array) #same as nanse(array, ci=0.95)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       1.38311    0.96353    2.25548
IsopyNdarray(-1, flavour='element', default_value=nan)

See also

se(), scipy.stats.sem

mad

isopy.mad(a, axis=None, scale='normal', *, ci=None, zscore=None)[source]

Compute the median absolute deviation of the data along the given axis.

Shortcut for scipy.stats.median_abs_deviation(a, axis, scale=scale, nan_policy='propagate').

If ci is given the result will be multiplied by the confidence interval ci of a t-distribution with N-1 degrees of freedom.

If zscore is given then the result is multiplied by zscore.

Functions mad2, mad3, mad95 mad99 are also avaliable for z-score values of 2 and 3 and for 95% and 99% confidence intervals respectivley.

Examples

>>> array = isopy.array(ru = [np.nan, 1.1, 2.2, 1.8],
                        pd = [3.1, 3.8, 2.9, 4.2],
                        cd = [6.1, 5.8, 4.7, 8.1])
>>> isopy.mad(array)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None           nan    0.66717    1.03782
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.mad(array, axis=1)
array([       nan, 2.96520444, 1.03782155, 3.55824532])
>>> isopy.mad2(array) #same as mad(array, zscore=2)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None           nan    1.33434    2.07564
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.mad95(array) #same as mad(array, ci=0.95)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None           nan    2.12324    3.30281
IsopyNdarray(-1, flavour='element', default_value=nan)

nanmad

isopy.nanmad(a, axis=None, scale='normal', *, ci=None, zscore=None)[source]

Compute the median absolute deviation along the specified axis, while ignoring NaNs.

Shortcut for scipy.stats.median_abs_deviation(a, axis, scale=scale, nan_policy='omit').

If ci is given the result will be multiplied by the confidence interval ci of a t-distribution with N-1 degrees of freedom.

If zscore is given then the result is multiplied by zscore.

Functions nanmad2, nanmad3, nanmad95 nanmad99 are also avaliable for z-score values of 2 and 3 and for 95% and 99% confidence intervals respectivley.

Examples

>>> array = isopy.array(ru = [np.nan, 1.1, 2.2, 1.8],
                        pd = [3.1, 3.8, 2.9, 4.2],
                        cd = [6.1, 5.8, 4.7, 8.1])
>>> isopy.nanmad(array)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       0.59304    0.66717    1.03782
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.nanmad(array, axis=1)
array([2.22390333, 2.96520444, 1.03782155, 3.55824532])
>>> isopy.nanmad2(array) #same as nanmad(array, zscore=2)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       1.18608    1.33434    2.07564
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.nanmad95(array) #same as nanmad(array, ci=0.95)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       2.55165    2.12324    3.30281
IsopyNdarray(-1, flavour='element', default_value=nan)

nancount

isopy.nancount(a, axis=None)[source]

Count all values in array that are not NaN or Inf along the specified axis.

Shortcut for np.count_nonzero(np.isfinite(a), axis=axis).

Examples

>>> array = isopy.array(ru = [np.nan, 1.1, 2.2, 1.8],
                        pd = [3.1, 3.8, 2.9, 4.2],
                        cd = [6.1, 5.8, 4.7, 8.1])
>>> isopy.nancount(array)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       3.00000    4.00000    4.00000
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.nancount(array, axis=1)
array([2, 3, 3, 3])

add

isopy.add(a1, a2, *, keys=None, **kwargs)[source]

Compute a1 + a2.

Same as calling arrayfunc(np.add, *args, keys=keys, **kwargs). See arrayfunc() for a more detailed description on the workings of this function.

Parameters
  • a1 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • a2 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • keys – If given then the this will be the keys of the returned array/dictionary.

  • kwargs – Can either be a valid kwargs for the numpy function or a key filter. If key filters are given then only the columns with matching keys will be used to compute the result.

Examples

>>> a1 = isopy.array(ru = 1, pd = 3, ag = 4)
>>> a2 = isopy.array(ru = 1, rh=2, pd=3)
>>> isopy.add(a1, a2) # same as: a1 + a2
(row)      Ru (f8)    Rh (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------  ---------
None       2.00000        nan    6.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> d2 = a2.to_refval()
>>> isopy.add(a1, d2) # same as: a1 + d2
(row)      Ru (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------
None       2.00000    6.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.add(1, 2, keys='ru pd cd')
(row)      Ru (i8)    Pd (i8)    Cd (i8)
-------  ---------  ---------  ---------
None             3          3          3
IsopyNdarray(-1, flavour='element', default_value=nan)

subtract

isopy.subtract(a1, a2, *, keys=None, **kwargs)[source]

Compute a1 - a2.

Same as calling arrayfunc(np.add, *args, keys=keys, **kwargs). See arrayfunc() for a more detailed description on the workings of this function.

Parameters
  • a1 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • a2 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • keys – If given then the this will be the keys or the returned array.

  • kwargs – Can either be a valid kwargs for the numpy function or a key filter. If key filters are given then only the columns with matching keys will be used to compute the result.

Examples

>>> a1 = isopy.array(ru = 1, pd = 3, ag = 4)
>>> a2 = isopy.array(ru = 1, rh=2, pd=3)
>>> isopy.subtract(a1, a2) # same as: a1 - a2
(row)      Ru (f8)    Rh (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------  ---------
None       0.00000        nan    0.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> d2 = a2.to_refval()
>>> isopy.subtract(a1, d2) # same as: a1 - d2
(row)      Ru (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------
None       0.00000    0.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.subtract(1, 2, keys='ru pd cd')
(row)      Ru (i8)    Pd (i8)    Cd (i8)
-------  ---------  ---------  ---------
None            -1         -1         -1
IsopyNdarray(-1, flavour='element', default_value=nan)

multiply

isopy.multiply(a1, a2, *, keys=None, **kwargs)[source]

Compute a1 * a2.

Same as calling arrayfunc(np.add, *args, keys=keys, **kwargs). See arrayfunc() for a more detailed description on the workings of this function.

Parameters
  • a1 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • a2 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • keys – If given then the this will be the keys or the returned array.

  • kwargs – Can either be a valid kwargs for the numpy function or a key filter. If key filters are given then only the columns with matching keys will be used to compute the result.

Examples

>>> a1 = isopy.array(ru = 1, pd = 3, ag = 4)
>>> a2 = isopy.array(ru = 1, rh=2, pd=3)
>>> isopy.multiply(a1, a2) # same as: a1 * a2
(row)      Ru (f8)    Rh (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------  ---------
None       1.00000        nan    9.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> d2 = a2.to_refval()
>>> isopy.multiply(a1, d2) # same as: a1 * d2
(row)      Ru (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------
None       1.00000    9.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.multiply(1, 2, keys='ru pd cd')
(row)      Ru (i8)    Pd (i8)    Cd (i8)
-------  ---------  ---------  ---------
None             2          2          2
IsopyNdarray(-1, flavour='element', default_value=nan)

divide

isopy.divide(a1, a2, *, keys=None, **kwargs)[source]

Compute a1 / a2.

Same as calling arrayfunc(np.add, *args, keys=keys, **kwargs). See arrayfunc() for a more detailed description on the workings of this function.

Parameters
  • a1 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • a2 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • keys – If given then the this will be the keys or the returned array.

  • kwargs – Can either be a valid kwargs for the numpy function or a key filter. If key filters are given then only the columns with matching keys will be used to compute the result.

Examples

>>> a1 = isopy.array(ru = 1, pd = 3, ag = 4)
>>> a2 = isopy.array(ru = 1, rh=2, pd=3)
>>> isopy.divide(a1, a2) # same as: a1 / a2
(row)      Ru (f8)    Rh (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------  ---------
None       1.00000        nan    1.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> d2 = a2.to_refval()
>>> isopy.divide(a1, d2) # same as: a1 / d2
(row)      Ru (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------
None       1.00000    1.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.divide(1, 2, keys='ru pd cd')
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       0.50000    0.50000    0.50000
IsopyNdarray(-1, flavour='element', default_value=nan)

power

isopy.power(a1, a2, *, keys=None, **kwargs)[source]

Compute a1 ** a2.

Same as calling arrayfunc(np.add, *args, keys=keys, **kwargs). See arrayfunc() for a more detailed description on the workings of this function.

Parameters
  • a1 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • a2 (array_like, numpy_array_like) – Both inputs must have the same shape or at least one of the inputs must have a size of 1.

  • keys – If given then the this will be the keys or the returned array.

  • kwargs – Can either be a valid kwargs for the numpy function or a key filter. If key filters are given then only the columns with matching keys will be used to compute the result.

Examples

>>> a1 = isopy.array(ru = 1, pd = 3, ag = 4)
>>> a2 = isopy.array(ru = 1, rh=2, pd=3)
>>> isopy.power(a1, a2) # same as: a1 ** a2
(row)      Ru (f8)    Rh (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------  ---------
None       1.00000        nan   27.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> d2 = a2.to_refval()
>>> isopy.power(a1, d2) # same as: a1 ** d2
(row)      Ru (f8)    Pd (f8)    Ag (f8)
-------  ---------  ---------  ---------
None       1.00000   27.00000        nan
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.power(1, 2, keys='ru pd cd')
(row)      Ru (i8)    Pd (i8)    Cd (i8)
-------  ---------  ---------  ---------
None             1          1          1
IsopyNdarray(-1, flavour='element', default_value=nan)

is_outlier

isopy.is_outlier(data, cval=<function median>, pmval=functools.partial(<function mad>, zscore=3), axis=None)[source]

Mark all the outliers in the data as True and the rest as False.

Parameters
  • data (isopy_array_like) – The outliers will be calculated for each column in data.

  • cval (scalar, Callable) – Either the center value or a function that returns the center value when called with data.

  • pmval (scalar, Callable) – Either the uncertainty value or a function that returns the uncertainty when called with data.

  • axis ({0, 1}, Optional) – If not given then an array with each individual outlier marked is returned. Otherwise np.any(outliers, axis) is returned.

Presets

The following presets are avaliable for this function:

  • is_outlier.sd(*args, **kwargs, cval = np.mean, pmval = isopy.array_functions.sd)

  • is_outlier.sd2(*args, **kwargs, cval = np.mean, pmval = sd2)

  • is_outlier.sd3(*args, **kwargs, cval = np.mean, pmval = sd3)

  • is_outlier.se(*args, **kwargs, cval = np.mean, pmval = isopy.array_functions.se)

  • is_outlier.se2(*args, **kwargs, cval = np.mean, pmval = se2)

  • is_outlier.se3(*args, **kwargs, cval = np.mean, pmval = se3)

  • is_outlier.mad(*args, **kwargs, cval = np.median, pmval = isopy.array_functions.mad)

  • is_outlier.mad2(*args, **kwargs, cval = np.median, pmval = mad2)

  • is_outlier.mad3(*args, **kwargs, cval = np.median, pmval = mad3)

not_outlier

isopy.not_outlier(data, cval=<function median>, pmval=functools.partial(<function mad>, zscore=3), axis=None)[source]

Mark all the outliers in the data as False and the rest as True.

The inverted value of is_outlier().

Parameters
  • data (isopy_array_like) – The outliers will be calculated for each column in data.

  • cval (scalar, Callable) – Either the center value or a function that returns the center value when called with data.

  • pmval (scalar, Callable) – Either the uncertainty value or a function that returns the uncertainty when called with data.

  • axis ({0, 1}, Optional) – If not given then an array with each individual outlier marked is returned. Otherwise np.any(outliers, axis) is returned.

Presets

The following presets are avaliable for this function:

  • not_outlier.sd(*args, **kwargs, cval = np.mean, pmval = isopy.array_functions.sd)

  • not_outlier.sd2(*args, **kwargs, cval = np.mean, pmval = sd2)

  • not_outlier.sd3(*args, **kwargs, cval = np.mean, pmval = sd3)

  • not_outlier.se(*args, **kwargs, cval = np.mean, pmval = isopy.array_functions.se)

  • not_outlier.se2(*args, **kwargs, cval = np.mean, pmval = se2)

  • not_outlier.se3(*args, **kwargs, cval = np.mean, pmval = se3)

  • not_outlier.mad(*args, **kwargs, cval = np.median, pmval = isopy.array_functions.mad)

  • not_outlier.mad2(*args, **kwargs, cval = np.median, pmval = mad2)

  • not_outlier.mad3(*args, **kwargs, cval = np.median, pmval = mad3)

lower_limit

isopy.lower_limit(data, cval=<function median>, pmval=functools.partial(<function mad>, zscore=3))[source]

Calculate the lower limit of the uncertainty on data as cval + pmval.

Parameters
  • data – The data on which the limit will be calculated

  • cval – The centre value. Can either be a scalar value or a function that returns the centre value.

  • pmval – The uncertainty around cval. Can either be a scalar value or a function that returns the uncertainty.

Presets

The following presets are avaliable for this function:

  • lower_limit.sd(*args, **kwargs, cval = np.mean, pmval = isopy.array_functions.sd)

  • lower_limit.sd2(*args, **kwargs, cval = np.mean, pmval = sd2)

  • lower_limit.sd3(*args, **kwargs, cval = np.mean, pmval = sd3)

  • lower_limit.se(*args, **kwargs, cval = np.mean, pmval = isopy.array_functions.se)

  • lower_limit.se2(*args, **kwargs, cval = np.mean, pmval = se2)

  • lower_limit.se3(*args, **kwargs, cval = np.mean, pmval = se3)

  • lower_limit.mad(*args, **kwargs, cval = np.median, pmval = isopy.array_functions.mad)

  • lower_limit.mad2(*args, **kwargs, cval = np.median, pmval = mad2)

  • lower_limit.mad3(*args, **kwargs, cval = np.median, pmval = mad3)

upper_limit

isopy.upper_limit(data, cval=<function median>, pmval=functools.partial(<function mad>, zscore=3))[source]

Calculate the upper limit of the uncertainty on data as cval + pmval.

Parameters
  • data – The data on which the limit will be calculated

  • cval – The centre value. Can either be a scalar value or a function that returns the centre value.

  • pmval – The uncertainty around cval. Can either be a scalar value or a function that returns the uncertainty.

Presets

The following presets are avaliable for this function:

  • upper_limit.sd(*args, **kwargs, cval = np.mean, pmval = isopy.array_functions.sd)

  • upper_limit.sd2(*args, **kwargs, cval = np.mean, pmval = sd2)

  • upper_limit.sd3(*args, **kwargs, cval = np.mean, pmval = sd3)

  • upper_limit.se(*args, **kwargs, cval = np.mean, pmval = isopy.array_functions.se)

  • upper_limit.se2(*args, **kwargs, cval = np.mean, pmval = se2)

  • upper_limit.se3(*args, **kwargs, cval = np.mean, pmval = se3)

  • upper_limit.mad(*args, **kwargs, cval = np.median, pmval = isopy.array_functions.mad)

  • upper_limit.mad2(*args, **kwargs, cval = np.median, pmval = mad2)

  • upper_limit.mad3(*args, **kwargs, cval = np.median, pmval = mad3)

arrayfunc

isopy.arrayfunc(func, *inputs : isopy_array, dict, keys=None : keystring_like, Optional, **kwargs) IsopyArray[source]
isopy.arrayfunc(func, *inputs : isopy_array, scalar, keys=None : keystring_like, Optional, **kwargs) IsopyArray
isopy.arrayfunc(func, *inputs : isopy_array, keys=None : keystring_like, Optional, **kwargs) IsopyArray
isopy.arrayfunc(func, *inputs : dict, scalar, keys=None : keystring_like, Optional, **kwargs) RefValDict
isopy.arrayfunc(func, *inputs : dict, keys=None : keystring_like, Optional, **kwargs) RefValDict
isopy.arrayfunc(func, *inputs : scalar, keys=None : keystring_like, **kwargs) IsopyArray
isopy.arrayfunc(func, *inputs: scalar, **kwargs) scalar

Call a function func on each column in the inputs.

If the input consists of isopy arrays and dictionaries then the returned array will only contain the keys of the arrays.

If the input consists of more than one isopy array the returned array will contain the keys of both arrays in sorted order.

If kwargs contain any key filters these will be applied the input values before the function is computed.

Parameters
  • func – a function to be applied the to input.

  • *inputs – The input for the function.

  • keys – If given the returned output will contain these keys, irregardless of the keys of the input.

  • **kwargs – Key word arguments to be used with func. If kwargs contain any key filters these will be applied the input values before the function is computed.

Examples

>>> array = isopy.random(100, keys=('ru', 'pd', 'cd')
>>> isopy.arrayfunc(np.std, array, keys=('ru', 'cd'))
(row)      Ru (f8)    Cd (f8)
-------  ---------  ---------
None       1.12864    0.97975
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.arrayfunc(np.std, array, keys_eq=('ru', 'cd'))
(row)      Ru (f8)    Cd (f8)
-------  ---------  ---------
None       1.12864    0.97975
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.arrayfunc(np.add, 2, 3, keys=('ru', 'cd'))
(row)      Ru (f8)    Cd (f8)
-------  ---------  ---------
None       5.00000    5.00000
IsopyNdarray(-1, flavour='element', default_value=nan)

rstack

isopy.rstack(*arrays, sort_keys=False)[source]

Stack the rows of multiple arrays.

If scalar value(s) are given then these values will be appended to each column in the returned array.

Parameters

arrays – Arrays to be joined together.

Returns

Array containing all the row data and all the columns keys found in arrays.

Return type

IsopyArray

Examples

>>> a = isopy.array(ru = 1, pd = 3, cd = 5)
>>> b = isopy.array(rh = [2, 22], pd = [3, 33], ag = [4, 44])
>>> isopy.rstack(a, b, 100)
(row)      Ru (f8)    Pd (f8)    Cd (f8)    Rh (f8)    Ag (f8)
-------  ---------  ---------  ---------  ---------  ---------
0          1.00000    3.00000    5.00000        nan        nan
1              nan    3.00000        nan    2.00000    4.00000
2              nan   33.00000        nan   22.00000   44.00000
3        100.00000  100.00000  100.00000  100.00000  100.00000
IsopyNdarray(2, flavour='element', default_value=nan)
>>> isopy.rstack(a.default(0), b.default([0.1, 0.2]), [100, 200], sort_keys = True)
(row)      Ru (f8)    Rh (f8)    Pd (f8)    Ag (f8)    Cd (f8)
-------  ---------  ---------  ---------  ---------  ---------
0          1.00000    0.00000    3.00000    0.00000    5.00000
1          0.10000    2.00000    3.00000    4.00000    0.10000
2          0.20000   22.00000   33.00000   44.00000    0.20000
3        100.00000  100.00000  100.00000  100.00000  100.00000
4        200.00000  200.00000  200.00000  200.00000  200.00000
IsopyNdarray(4, flavour='element', default_value=nan)

See also

rstack, cstack

cstack

isopy.cstack(*arrays, sort_keys=False)[source]

Stack the columns of multiple arrays.

An error will thrown if a column occurs in more than one array.

Normal numpy broadcasting rules apply so when concatenating columns the shape of the arrays must be compatible. When array with a size of 1 is concatenated to an array of a different size it will be copied into every row of the new shape.

Parameters

arrays – Arrays to be joined together.

Returns

Array containing all the row data and all the columns keys found in arrays.

Return type

IsopyArray

Examples

>>> a = isopy.array(ru = 1, pd = 3, cd = 5)
>>> b = isopy.array(rh = [2, 22],  ag = [4, 44])
>>> isopy.cstack(a, b)
(row)      Ru (f8)    Pd (f8)    Cd (f8)    Rh (f8)    Ag (f8)
-------  ---------  ---------  ---------  ---------  ---------
0          1.00000    3.00000    5.00000    2.00000    4.00000
1          1.00000    3.00000    5.00000   22.00000   44.00000
IsopyNdarray(2, flavour='element', default_value=nan)
>>> isopy.cstack(a, b, sort_keys=True)
(row)      Ru (f8)    Rh (f8)    Pd (f8)    Ag (f8)    Cd (f8)
-------  ---------  ---------  ---------  ---------  ---------
0          1.00000    2.00000    3.00000    4.00000    5.00000
1          1.00000   22.00000    3.00000   44.00000    5.00000
IsopyNdarray(2, flavour='element', default_value=nan)

See also

rstack, cstack

concatenate

isopy.concatenate(*arrays, axis=0)[source]

Join arrays together along specified axis.

If arrays contains at least one isopy array the input is forwarded to rstack/cstack. Otherwise the input is forwarded to np.concatenate.

Parameters
  • arrays – Arrays to be joined together.

  • axis – If 0 rstack is used. If 1 cstack is used.

Returns

Array containing all the row data and all the columns keys found in arrays.

Return type

IsopyArray

See also

rstack, cstack

Numpy Functions

Isopy arrays, and reference value dictionaries, are compatible with a host of numpy functions. The functions that have been tested with isopy arrays are avaliable within the isopy namespace. Other numpy functions may still work with isopy arrays but should be used with caution. A warning will be raised the first time an unvetted function is used.

The numpy functions have been tested and are avaliable within the isopy namespace are: sin(), cos(), tan(), arcsin(), arccos(), arctan(), degrees(), isnan(), radians(), deg2rad(), rad2deg(), sinh(), cosh(), tanh(), arcsinh(), arccosh(), rint(), floor(), ceil(), trunc(), exp(), expm1(), exp2(), log(), log10(), log2(), log1p(), reciprocal(), positive(), negative(), sqrt(), cbrt(), square(), fabs(), sign(), absolute(), abs(), cumprod(), cumsum(), nancumprod(), nancumsum(), prod(), sum(), nanprod(), nansum(), cumprod(), cumsum(), nancumprod(), nancumsum(), amin(), amax(), min(), max(), nanmin(), nanmax(), ptp(), median(), average(), mean(), std(), var(), nanmedian(), nanmean(), nanstd(), nanvar(), nanmax(), nanmin(), all(), any(), copyto(),

These functions in the isopy namespace have the additional functionality that you can include key filter arguments to only perform the function over a subset of the data. E.g.

>>> a = isopy.array(ru = -1, pd = -2, cd = -3)
>>> isopy.abs(a)
(row)      Ru (f8)    Pd (f8)    Cd (f8)
-------  ---------  ---------  ---------
None       1.00000    2.00000    3.00000
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.abs(a, key_eq = ['ru', 'pd'])
(row)      Ru (f8)    Pd (f8)
-------  ---------  ---------
None       1.00000    2.00000
IsopyNdarray(-1, flavour='element', default_value=nan)
>>> isopy.sum(a, axis=0, key_eq = ['ru', 'pd'])
-3

Note

You must specify the comparison type (eq, neq, lt, gt, le, ge) for the attribute you wish to apply

the filter to.