ess.sans.types.SamplePosition#

class ess.sans.types.SamplePosition(x: SUPER)[source]#

Sample position

__init__(self: scipp._scipp.core.Variable, *, dims: object, values: object = None, variances: object = None, unit: Union[str, scipp._scipp.core.Unit, None, scipp._scipp.core.DefaultUnit] = <automatically deduced unit>, dtype: object = None, aligned: bool = True) None#

Initialize a variable with values and/or variances.

At least one argument of values and variances must be used. if you want to preallocate memory to fill later, use scipp.empty().

Attention

This constructor is meant primarily for internal use. Use one of the Specialized creation functions instead. See in particular scipp.array() and scipp.scalar().

Parameters:
  • dims – Dimension labels.

  • values – Sequence of values for constructing an array variable.

  • variances – Sequence of variances for constructing an array variable.

  • unit – Physical unit, defaults to scipp.units.dimensionless.

  • dtype – Type of the variable’s elements. Is deduced from other arguments in most cases. Defaults to sc.DType.float64 if no deduction is possible.

  • aligned – Initial value for the alignment flag.

Methods

__init__(self, *, dims, values, variances, ...)

Initialize a variable with values and/or variances.

all([dim])

Logical AND over input values.

any([dim])

Logical OR over input values.

astype(self, type, *[, copy])

Converts a Variable or DataArray to a different dtype.

bin([arg_dict])

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

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

Broadcast a Variable or a DataArray.

ceil(*[, out])

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

copy(self[, deep])

Return a (by default deep) copy.

cumsum([dim, mode])

Return the cumulative sum along the specified dimension.

flatten([dims, to])

Flatten multiple dimensions into a single dimension.

floor(*[, out])

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

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

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

hist([arg_dict])

Compute a histogram.

max([dim])

Maximum of elements in the input.

mean([dim])

Arithmetic mean of elements in the input.

median([dim])

Compute the median of the input values.

min([dim])

Minimum of elements in the input.

nanhist([arg_dict])

Compute a histogram, skipping NaN values.

nanmax([dim])

Maximum of elements in the input ignoring NaN's.

nanmean([dim])

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

nanmedian([dim])

Compute the median of the input values ignoring NaN's.

nanmin([dim])

Minimum of elements in the input ignoring NaN's.

nanstd([dim])

Compute the standard deviation of the input values ignoring NaN's.

nansum([dim])

Sum of elements in the input ignoring NaN's.

nanvar([dim])

Compute the variance of the input values ignoring NaN's.

plot(**kwargs)

Wrapper function to plot data.

rename([dims_dict])

Rename dimension labels.

rename_dims([dims_dict])

Rename dimensions.

round(*[, out])

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

save_hdf5(filename)

Write an object out to file in HDF5 format.

squeeze([dim])

Remove dimensions of length 1.

std([dim])

Compute the standard deviation of the input values.

sum([dim])

Sum of elements in the input.

to(*[, unit, dtype, copy])

Converts a Variable or DataArray to a different dtype and/or a different unit.

transpose([dims])

Transpose dimensions of the input.

underlying_size(self)

Return the size of the object in bytes.

var([dim])

Compute the variance of the input values.

Attributes

aligned

Alignment flag for coordinates.

bins

Returns helper scipp.Bins allowing bin-wise operations to be performed or None if not binned data.

dim

The only dimension label for 1-dimensional data, raising an exception if the data is not 1-dimensional.

dims

Dimension labels of the data (read-only).

dtype

Data type contained in the variable.

fields

Provides access to fields of structured types such as vectors or matrices.

ndim

Number of dimensions of the data (read-only).

shape

Shape of the data (read-only).

size

Number of elements in the data (read-only).

sizes

dict mapping dimension labels to dimension sizes (read-only).

unit

Physical unit of the data.

value

The only value for 0-dimensional data, raising an exception if the data is not 0-dimensional.

values

Array of values of the data.

variance

The only variance for 0-dimensional data, raising an exception if the data is not 0-dimensional.

variances

Array of variances of the data.