chaco.array_data_source module

Defines the ArrayDataSource class.

class chaco.array_data_source.ArrayDataSource(data=array([], dtype=float64), sort_order='none', **kw)

Bases: 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.

get_bounds()

Returns the minimum and maximum values of the data source’s data.

Implements AbstractDataSource.

get_data()

Returns the data for this data source, or 0.0 if it has no data.

Implements AbstractDataSource.

get_data_mask()

Implements AbstractDataSource.

get_size()int

Implements AbstractDataSource.

index_dimension = Constant("scalar")

The dimensionality of the indices into this data source (overrides AbstractDataSource).

is_masked()bool

Implements AbstractDataSource.

remove_mask()

Removes the mask on this data source.

reverse_map(pt, index=0, outside_returns_none=True)

Returns the index of pt in the data source.

Parameters
  • pt (scalar value) – value to find

  • index – ignored for data series with 1-D indices

  • outside_returns_none (Boolean) – Whether the method returns None if pt is outside the range of the data source; if False, the method returns the value of the bound that pt is outside of.

set_data(newdata, sort_order=None)

Sets the data, and optionally the sort order, for this data source.

Parameters
  • newdata (array) – The data to use.

  • sort_order (SortOrderTrait) – The sort order of the data

set_mask(mask)

Sets the mask for this data source.

sort_order = SortOrderTrait

The sort order of the data. This is a specialized optimization for 1-D arrays, but it’s an important one that’s used everywhere.

value_dimension = Constant("scalar")

The dimensionality of the value at each index point (overrides AbstractDataSource).

chaco.array_data_source.bounded_nanargmax(arr)

Find the index of the maximum value, ignoring NaNs.

If all NaNs, return -1.

chaco.array_data_source.bounded_nanargmin(arr)

Find the index of the minimum value, ignoring NaNs.

If all NaNs, return 0.