Free functions#

General#

bin(x[, arg_dict])

Create binned data by binning input along all dimensions given by edges.

bins(*, data, dim[, begin, end])

Create a binned variable from bin indices.

bins_like(x, fill_value)

Create a binned variable by "broadcasting" fill values to bins of given sizes.

collapse(scipp_obj, keep)

Slice down the input object until only the supplied keep dimension is left (effectively 'collapsing' all but one dimension), and return a dict of 1D slices.

elemwise_func([func, unit_func, dtype, ...])

Create a function for transforming input variables based on element-wise operation.

group(x, /, *args)

Create binned data by grouping input by one or more coordinates.

hist(x[, arg_dict])

Compute a histogram.

logical_not(x)

Element-wise logical negation.

logical_and(a, b)

Element-wise logical and.

logical_or(a, b)

Element-wise logical or.

logical_xor(a, b)

Element-wise logical exclusive-or.

lookup(func[, dim, mode, fill_value])

Create a "lookup table" from a histogram (data array with bin-edge coord).

nanhist(x[, arg_dict])

Compute a histogram, skipping NaN values.

merge(lhs, rhs)

Merge two datasets into one.

midpoints(x[, dim])

Computes the points in the middle of adjacent elements of x.

rebin(x[, arg_dict, deprecated])

Rebin a data array or dataset.

reduce(x)

Create helper object for reduction operations over list or tuple of inputs.

slices(scipp_obj, dim)

Slice input along given dim, and return all the slices in a dict.

sort(x, key[, order])

Sort variable along a dimension by a sort key or dimension label.

stddevs(x)

Return the input's standard deviations as values.

to_unit(x, unit, *[, copy])

Convert the variable to a different unit.

transform_coords(x[, targets, graph, ...])

Compute new coords based on transformations of input coords.

values(x)

Return the input without variances.

variances(x)

Return the input's variances as values.

where(condition, x, y)

Return elements chosen from x or y depending on condition.

Math#

abs(x, *[, out])

Element-wise absolute value.

add(a, b)

Element-wise addition.

ceil(x, *[, out])

Round up to the nearest integer of all values passed in x.

cross(x, y)

Element-wise cross product.

divide(dividend, divisor)

Element-wise true division.

dot(x, y)

Element-wise dot product.

erf(x)

Computes the error function.

erfc(x)

Computes the complementary error function.

exp(x, *[, out])

Element-wise exponential.

floor(x, *[, out])

Round down to the nearest integer of all values passed in x.

floor_divide(dividend, divisor)

Element-wise floor division.

log(x, *[, out])

Element-wise natural logarithm.

log10(x, *[, out])

Element-wise base 10 logarithm.

mod(dividend, divisor)

Element-wise remainder.

multiply(left, right)

Element-wise product.

negative(a)

Element-wise negative.

norm(x)

Element-wise norm.

pow(base, exponent)

Element-wise power.

reciprocal(x, *[, out])

Element-wise reciprocal.

round(x, *[, out])

Round to the nearest integer of all values passed in x.

sqrt(x, *[, out])

Element-wise square-root.

subtract(minuend, subtrahend)

Element-wise difference.

Shape#

broadcast(x[, dims, shape, sizes])

Broadcast a Variable or a DataArray.

concat(x, dim)

Concatenate input arrays along the given dimension.

flatten(x[, dims, to])

Flatten multiple dimensions into a single dimension.

fold(x, dim[, sizes, dims, shape])

Fold a single dimension of a variable or data array into multiple dims.

squeeze(x[, dim])

Remove dimensions of length 1.

transpose(x[, dims])

Transpose dimensions of the input.

Comparison#

Comparison operators compare element-wise and ignore variances.

allclose(x, y[, rtol, atol, equal_nan])

Checks if all elements in the inputs are close to each other.

allsorted(x, dim[, order])

Check if all values of a variable are sorted.

equal(x, y)

Element-wise '==' (equal).

greater(x, y)

Element-wise '>' (greater).

greater_equal(x, y)

Element-wise '>=' (greater_equal).

identical(x, y, *[, equal_nan])

Full comparison of x and y.

isclose(x, y, *[, rtol, atol, equal_nan])

Checks element-wise if the inputs are close to each other.

islinspace(x[, dim])

Check if the values of a variable are evenly spaced.

issorted(x, dim[, order])

Check if the values of a variable are sorted.

less(x, y)

Element-wise '<' (less).

less_equal(x, y)

Element-wise '<=' (less_equal).

not_equal(x, y)

Element-wise '!=' (not_equal).

inf and nan handling#

Special-value (inf and nan) checks. inf and nan in the variances is ignored.

isnan(x)

Element-wise isnan (true if an element is nan).

isinf(x)

Element-wise isinf (true if an element is inf).

isfinite(x)

Element-wise isfinite (true if an element is finite).

isposinf(x)

Element-wise isposinf (true if an element is a positive infinity).

isneginf(x)

Element-wise isneginf (true if an element is a negative infinity).

nan_to_num(x, *[, nan, posinf, neginf, out])

Element-wise special value replacement.

Reduction#

Reduction operations are operations to remove one or more dimension, e.g., by performing a sum over all elements along a dimension.

all(x[, dim])

Logical AND over input values.

any(x[, dim])

Logical OR over input values.

cumsum(a[, dim, mode])

Return the cumulative sum along the specified dimension.

max(x[, dim])

Maximum of elements in the input.

mean(x[, dim])

Arithmetic mean of elements in the input.

min(x[, dim])

Minimum of elements in the input.

nanmax(x[, dim])

Maximum of elements in the input ignoring NaN's.

nanmean(x[, dim])

Arithmetic mean of elements in the input ignoring NaN's.

nanmin(x[, dim])

Minimum of elements in the input ignoring NaN's.

nansum(x[, dim])

Sum of elements in the input ignoring NaN's.

sum(x[, dim])

Sum of elements in the input.

Trigonometric#

sin(x, *[, out])

Element-wise sine.

cos(x, *[, out])

Element-wise cosine.

tan(x, *[, out])

Element-wise tangent.

asin(x, *[, out])

Element-wise inverse sine.

acos(x, *[, out])

Element-wise inverse cosine.

atan(x, *[, out])

Element-wise inverse tangent.

atan2(*, y, x[, out])

Element-wise inverse tangent of y/x determining the correct quadrant.

Geometric#

geometry.position(x, y, z)

Element-wise zip functionality to produce a 3 element vector.

geometry.rotation_matrix_from_quaternion_coeffs(value)

Construct a rotation matrix from quaternions.

Group-by (split-apply-combine)#

Reduction#

groupby(data, /, group, *[, bins])

Group dataset or data array based on values of specified labels.

Counts#

“Counts” refers to the default unit of data after histogramming. It is also known as frequency. This can be converted into a counts (frequency) density, e.g., for visualization purposes.

counts_to_density(x, dim)

Converts counts to count density on a given dimension.

density_to_counts(x, dim)

Converts counts to count density on a given dimension.

Visualization#

make_html(container)

Return the HTML representation of an object.

make_svg(container[, content_only])

Return an SVG representation of a variable, data array, or dataset.

plot(*args, **kwargs)

show(container)

Show a graphical representation of a variable, data array, or dataset.

show_graph(graph[, size, simplified])

Show graphical representation of a graph as required by transform_coords()

table(obj[, max_rows])

Create an HTML table from the contents of the supplied object.

to_html(container)

Render am object to HTML in a Jupyter notebook.

Compatibility#

to_dict(scipp_obj)

Convert a Scipp object (Variable, DataArray or Dataset) to a Python dict.

from_dict(dict_obj)

Convert a Python dict to a Scipp Variable, DataArray or Dataset.

compat.from_pandas(pd_obj)

Converts a pandas.DataFrame or pandas.Series object into a scipp Dataset or DataArray respectively.

compat.from_xarray(obj)

Convert an xarray object to the corresponding scipp object.

compat.to_xarray(obj)

Convert a scipp object to the corresponding xarray object.

Logging#

get_logger()

Return the global logger used by Scipp.

display_logs()

Display the log widget associated with the Scipp logger.