BaseCartesianData¶

class
glue.core.data.
BaseCartesianData
[source]¶ Bases:
glue.core.data.BaseData
Base class for any glue data object which indicates which methods should be provided at a minimum.
The underlying data can be any kind of data (structured or unstructured) but it needs to expose an interface that looks like a regular ndimensional cartesian dataset. This means exposing e.g.
shape
andndim
, and means that get_data can expect ndarray slices. Nonregular datasets should therefore have the concept of ‘virtual’ pixel coordinates and should typically match the highest resolution a user might want to access the data at.Attributes Summary
The number of dimensions of the data, as an integer.
The ndimensional shape of the dataset, as a tuple.
The size of the data (the product of the shape dimensions), as an integer.
Methods Summary
compute_histogram
(self, cids[, weights, …])Compute an ndimensional histogram with regularly spaced bins.
compute_statistic
(self, statistic, cid[, …])Compute a statistic for the data.
get_data
(self, cid[, view])Get the data values for a given component
get_mask
(self, subset_state[, view])Get a boolean mask for a given subset state.
Attributes Documentation

ndim
¶ The number of dimensions of the data, as an integer.

shape
¶ The ndimensional shape of the dataset, as a tuple.

size
¶ The size of the data (the product of the shape dimensions), as an integer.
Methods Documentation

compute_histogram
(self, cids, weights=None, range=None, bins=None, log=None, subset_state=None)[source]¶ Compute an ndimensional histogram with regularly spaced bins.
 Parameters
 cidslist of str or ComponentID
Component IDs to compute the histogram over
 weightsstr or ComponentID
Component IDs to use for the histogram weights
 rangelist of tuple
The
(min, max)
of the histogram range binslist of int
The number of bins
 loglist of bool
Whether to compute the histogram in log space
 subset_stateSubsetState, optional
If specified, the histogram will only take into account values in the subset state.

compute_statistic
(self, statistic, cid, subset_state=None, axis=None, finite=True, positive=False, percentile=None, view=None, random_subset=None)[source]¶ Compute a statistic for the data.
 Parameters
 statistic{‘minimum’, ‘maximum’, ‘mean’, ‘median’, ‘sum’, ‘percentile’}
The statistic to compute
 cidComponentID or str
The component ID to compute the statistic on  if given as a string this will be assumed to be for the component belonging to the dataset (not external links).
 subset_stateSubsetState
If specified, the statistic will only include the values that are in the subset specified by this subset state.
 axisNone or int or tuple of int
If specified, the axis/axes to compute the statistic over.
 finitebool, optional
Whether to include only finite values in the statistic. This should be True to ignore NaN/Inf values
 positivebool, optional
Whether to include only (strictly) positive values in the statistic. This is used for example when computing statistics of data shown in log space.
 percentilefloat, optional
If
statistic
is'percentile'
, thepercentile
argument should be given and specify the percentile to calculate in the range [0:100] random_subsetint, optional
If specified, this should be an integer giving the number of values to use for the statistic. This can only be used if
axis
is None
