Bases: enthought.traits.has_traits.HasTraits
This abstract interface must be implemented by any class supplying data to Chaco.
Chaco does not have a notion of a “data format”. For the most part, a data source looks like an array of values with an optional mask and metadata. If you implement this interface, you are responsible for adapting your domain-specific or application-specific data to meet this interface.
Chaco provides some basic data source implementations. In most cases, the easiest strategy is to create one of these basic data source with the numeric data from a domain model. In cases when this strategy is not possible, domain classes (or an adapter) must implement AbstractDataSource.
Traits: | value_dimension : DimensionTrait
index_dimension : DimensionTrait
metadata : Dict
data_changed : Event
bounds_changed : Event
metadata_changed : Event
persist_data : Bool(True)
|
---|
Returns a tuple (min, max) of the bounding values for the data source. In the case of 2-D data, min and max are 2-D points that represent the bounding corners of a rectangle enclosing the data set. Note that these values are not view-dependent, but represent intrinsic properties of the data source.
If data is the empty set, then the min and max vals are 0.0.
get_data() -> data_array
Returns a data array of the dimensions of the data source. This data array must not be altered in-place, and the caller must assume it is read-only. This data is contiguous and not masked.
In the case of structured (gridded) 2-D data, this method may return two 1-D ArrayDataSources as an optimization.
Returns the full, raw, source data array and a corresponding binary mask array. Treat both arrays as read-only.
The mask is a superposition of the masks of all upstream data sources. The length of the returned array may be much larger than what get_size() returns; the unmasked portion, however, matches what get_size() returns.
get_size() -> int
Returns an integer estimate or the exact size of the dataset that get_data() returns for this object. This method is useful for down-sampling.
is_masked() -> bool
Returns True if this data source’s data uses a mask. In this case, to retrieve the data, call get_data_mask() instead of get_data(). If you call get_data() for this data source, it returns data, but that data might not be the expected data.
Bases: enthought.chaco.abstract_data_source.AbstractDataSource
A data source representing a single, continuous array of numerical data.
This class does not listen to the array for value changes; if you need that behavior, create a subclass that hooks up the appropriate listeners.
Traits: | index_dimension : Constant(‘scalar’)
value_dimension : Constant(‘scalar’)
sort_order : SortOrderTrait
|
---|
Returns the minimum and maximum values of the data source’s data.
Implements AbstractDataSource.
Returns the data for this data source, or 0.0 if it has no data.
Implements AbstractDataSource.
get_size() -> int
Implements AbstractDataSource.
is_masked() -> bool
Implements AbstractDataSource.
Returns the index of pt in the data source.
Parameters: | pt : scalar value
index :
outside_returns_none : Boolean
|
---|
Sets the data, and optionally the sort order, for this data source.
Parameters: | newdata : array
sort_order : SortOrderTrait
|
---|
Bases: enthought.chaco.abstract_data_source.AbstractDataSource
A data source representing a single, continuous array of numerical data of potentially more than one dimension.
This class does not listen to the array for value changes; To implement such behavior, define a subclass that hooks up the appropriate listeners.
Traits: | index_dimension : Int(0)
value_dimension : Int(1)
sort_order : SortOrderTrait
|
---|
Returns a tuple (min, max) of the bounding values for the data source. In the case of 2-D data, min and max are 2-D points that represent the bounding corners of a rectangle enclosing the data set. Note that these values are not view-dependent, but represent intrinsic properties of the data source.
If data is the empty set, then the min and max vals are 0.0.
If value and index are both None, then the method returns the global minimum and maximum for the entire data set. If value is an integer, then the method returns the minimum and maximum along the value slice in the value_dimension. If index is an integer, then the method returns the minimum and maximum along the index slice in the index_direction.
get_data() -> data_array
If called with no arguments, this method returns a data array. Treat this data array as read-only, and do not alter it in-place. This data is contiguous and not masked.
If axes is an integer or tuple, this method returns the data array, sliced along the index_dimension.
get_size() -> int
Implements AbstractDataSource. Returns an integer estimate, or the exact size, of the dataset that get_data() returns. This method is useful for downsampling.
get_value_size() -> size
Returns the size along the value dimension.
is_masked() -> bool
Returns True if this data source’s data uses a mask. In this case, retrieve the data using get_data_mask() instead of get_data(). If you call get_data() for this data source, it returns data, but that data may not be the expected data.)
Sets the data for this data source.
Parameters: | value : array
|
---|
Bases: enthought.chaco.array_data_source.ArrayDataSource
A data source representing a (possibly unordered) set of (X,Y) points.
This is internally always represented by an Nx2 array, so that data[i] refers to a single point (represented as a length-2 array).
Most of the traits and methods of ArrayDataSeries work for the PointDataSeries as well, since its data is linear. This class overrides only the methods and traits that are different.
Traits: | index_dimension : ReadOnly(‘scalar’)
value_dimension : ReadOnly(‘point’)
sort_order : SortOrderTrait
sort_index : Enum(0, 1)
|
---|
Returns the data for this data source, or (0.0, 0.0) if it has no data.
Overrides ArryDataSource.
Returns the index of pt in the data source.
Overrides ArrayDataSource.
Parameters: | pt : (x, y)
index : 0 or 1
outside_returns_none : Boolean
|
---|
Bases: enthought.chaco.abstract_data_source.AbstractDataSource
Implements a structured gridded 2-D data source (suitable as an index for an image, for example).
Traits: | index_dimension : Constant(‘image’)
value_dimension : Constant(‘scalar’)
sort_order : Tuple(SortOrderTrait, SortOrderTrait)
|
---|
Implements AbstractDataSource. Returns two 2-D points, min and max, that represent the bounding corners of a rectangle enclosing the data set. Note that these values are not view-dependent, but represent intrinsic properties of the DataSource.
If data axis is the empty set, then the min and max valuess are 0.0.
Sets the data, and optionally the sort order, for this data source.
Parameters: | xdata, ydata : array
sort_order : SortOrderTrait
|
---|
Bases: enthought.chaco.abstract_data_source.AbstractDataSource
Represents a grid of data to be plotted using a Numpy 2-D grid.
The data array has dimensions NxM, but it may have more than just 2 dimensions. The appropriate dimensionality of the value array depends on the context in which the ImageData instance will be used.
Traits: | dimension : ReadOnly(DimensionTrait(‘image’))
value_depth : Int(1)
data : Property(ImageTrait)
transposed : Bool(False)
raw_value : Property(ImageTrait)
|
---|
Returns the minimum and maximum values of the data source’s data.
Implements AbstractDataSource.
Returns the data for this data source.
Implements AbstractDataSource.
get_size() -> int
Implements AbstractDataSource.
is_masked() -> False
Implements AbstractDataSource.
Sets the data for this data source.
Parameters: | data : array
|
---|