Classes

Bins(obj)

Proxy for access to bin contents and operations on bins of a variable.

DataArray

Named variable with associated coords, masks, and attributes.

Dataset

Dict of data arrays with aligned dimensions.

GroupByDataArray

GroupBy object implementing to split-apply-combine mechanism.

GroupByDataset

GroupBy object implementing to split-apply-combine mechanism.

Unit

A physical unit.

Variable

Array of values with dimension labels and a unit, optionally including an array of variances.

typing.VariableLike

Any object that behaves like a scipp.Variable, that is an array with labeled dimensions.

typing.MetaDataMap

dict-like object mapping dimension labels to Variables.

Creation functions

array(*, dims, values[, variances, unit, dtype])

Constructs a Variable with given dimensions, containing given values and optional variances.

arange(dim, start[, stop, step, unit, dtype])

Constructs a Variable with evenly spaced values within a given interval.

empty(*[, dims, shape, sizes, unit, dtype, ...])

Constructs a Variable with uninitialized values with given dimension labels and shape.

empty_like(var)

Constructs a Variable with the same dims, shape, unit and dtype as the input variable, but with uninitialized values.

full(*[, dims, shape, sizes, unit, dtype, ...])

Constructs a Variable with values initialized to the specified value with given dimension labels and shape.

full_like(var, value[, variance])

Constructs a Variable with values initialized to the specified value with dimensions labels and shape provided by an existing variable.

geomspace(dim, start, stop, num, *[, unit, ...])

Constructs a Variable with values spaced evenly on a log scale (a geometric progression).

linspace(dim, start, stop, num, *[, unit, dtype])

Constructs a Variable with num evenly spaced samples, calculated over the interval [start, stop].

logspace(dim, start, stop, num, *[, unit, dtype])

Constructs a Variable with values spaced evenly on a log scale.

matrix(*[, unit])

Constructs a zero dimensional Variable holding a single 3x3 matrix.

matrices(*, dims[, unit])

Constructs a Variable with given dimensions holding an array of 3x3 matrices.

ones(*[, dims, shape, sizes, unit, dtype, ...])

Constructs a Variable with values initialized to 1 with given dimension labels and shape.

ones_like(var)

Constructs a Variable with the same dims, shape, unit and dtype as the input variable, but with all values initialized to 1.

scalar(value[, variance, unit, dtype])

Constructs a zero dimensional Variable with a unit and optional variance.

vector(*[, unit])

Constructs a zero dimensional Variable holding a single length-3 vector.

vectors(*, dims[, unit])

Constructs a Variable with given dimensions holding an array of length-3 vectors.

zeros(*[, dims, shape, sizes, unit, dtype, ...])

Constructs a Variable with default initialized values with given dimension labels and shape.

zeros_like(var)

Constructs a Variable with the same dims, shape, unit and dtype as the input variable, but with all values initialized to 0.

Free functions

General

bin(x, *[, edges, groups, erase])

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

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

Create a binned variable from bin indices.

choose(key, choices, dim)

Choose slices of choices base on coord values.

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.

histogram(x, *, bins)

Create dense data by histogramming data along all dimension given by edges.

logical_and(*args, **kwargs)

Overloaded function.

logical_or(*args, **kwargs)

Overloaded function.

logical_xor(*args, **kwargs)

Overloaded function.

merge(lhs, rhs)

Merge two datasets into one.

rebin(x, dim, bins)

Rebin a dimension of a data array or dataset.

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 object containing the stddevs of the input as values.

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

Convert the variable to a different unit.

transform_coords(x, coords, graph, *[, ...])

Compute new coords based on transformation of input coords.

values(x)

Return the object without variances.

variances(x)

Return object containing the variances of the input 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.

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(a, b)

Element-wise product.

norm(x)

Element-wise norm.

reciprocal(x, *[, out])

Element-wise reciprocal.

round(x, *[, out])

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

sqrt(x, *[, out])

Element-wise square-root.

subtract(minuend, subtrahend)

Element-wise difference.

Shape

broadcast(x, dims, shape)

Broadcast a variable.

concatenate(x, y, dim)

Concatenate input arrays along the given dimension.

flatten(x[, dims, to])

Flatten multiple dimensions of a variable or data array into a single dimension.

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

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

transpose(x[, dims])

Transpose dimensions of a variable, an data array, or a dataset.

Comparison

Comparison operators compare element-wise and ignore variances.

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

Verifies that ALL element-wise comparisons meet the condition:

allsorted(x, dim[, order])

Check if the 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)

Full comparison of x and y.

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

Compares values (x, y) element by element against absolute and relative tolerances (non-symmetric).

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, out])

Element-wise AND over the specified dimension or all dimensions if not provided.

any(x[, dim, out])

Element-wise OR over the specified dimension or all dimensions if not provided.

cumsum(a[, dim, mode])

Return the cumulative sum along the specified dimension.

max(x[, dim, out])

Element-wise max over the specified dimension or all dimensions if not provided.

mean(x[, dim, out])

Element-wise mean over the specified dimension.

min(x[, dim, out])

Element-wise min over the specified dimension or all dimensions if not provided.

nanmax(x[, dim, out])

Element-wise max ignoring not a number values over the specified dimension or all dimensions if not provided.

nanmean(x[, dim, out])

Element-wise mean over the specified dimension ignoring NaNs.

nanmin(x[, dim, out])

Element-wise min ignoring not at number values over the specified dimension or all dimensions if not provided.

nansum(x[, dim, out])

Element-wise sum over the specified dimension; NaNs are treated as zero.

sum(x[, dim, out])

Element-wise sum over the specified dimension.

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

show(container)

Show a graphical representation of a variable or dataset.

show_graph(graph[, size, simplified])

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

table(scipp_obj)

Create a html table from the contents of a Dataset (0D and 1D Variables only), DataArray, Variable or raw numpy array.

to_html(container)

plot(*args, **kwargs)

Plot a Scipp object.

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)

Convenience method to convert an xarray object into the corresponding scipp object.

Modules

constants

Physical and mathematical constants with units.

spatial