chaco.data_range_1d module¶
Defines the DataRange1D class.
-
class
chaco.data_range_1d.
DataRange1D
(*datasources, **kwtraits)¶ Bases:
chaco.base_data_range.BaseDataRange
Represents a 1-D data range.
-
bound_data
(data)¶ Returns a tuple of indices for the start and end of the first run of data that falls within the range.
Implements AbstractDataRange.
-
bounds_func
= Callable¶ A user supplied function returning the proper bounding interval. bounds_func takes (data_low, data_high, margin, tight_bounds) and returns (low, high)
-
clip_data
(data)¶ Returns a list of data values that are within the range.
Implements AbstractDataRange.
-
default_state
= Enum("auto", "high_track", "low_track")¶ Default tracking state. This value is used when self.reset() is called.
‘auto’: Both bounds reset to ‘auto’.
‘high_track’: The high bound resets to ‘track’, and the low bound resets to ‘auto’.
‘low_track’: The low bound resets to ‘track’, and the high bound resets to ‘auto’.
-
default_tracking_amount
= CFloat(20.0)¶ When either high or low tracks the other, track by this amount.
-
epsilon
= CFloat(1.0e-10)¶ The minimum percentage difference between low and high. That is, (high-low) >= epsilon * low. Used to be 1.0e-20 but chaco cannot plot at such a precision!
-
fit_to_subset
= Bool(False)¶ FIXME: this attribute is not used anywhere, is it safe to remove it? Is this range dependent upon another range?
-
high
= Property¶ The actual value of the upper bound of this range (overrides AbstractDataRange). To set it, use high_setting.
-
high_setting
= Property(Union(Constant("auto"), Constant("track"), CFloat))¶ Property for the upper bound of this range (overrides AbstractDataRange).
‘auto’: The upper bound is automatically set at or above the maximum of the data.
‘track’: The upper bound tracks the lower bound by tracking_amount.
CFloat: An explicit value for the upper bound
-
low
= Property¶ The actual value of the lower bound of this range (overrides AbstractDataRange). To set it, use low_setting.
-
low_setting
= Property(Union(Constant("auto"), Constant("track"), CFloat))¶ Property for the lower bound of this range (overrides AbstractDataRange).
‘auto’: The lower bound is automatically set at or below the minimum of the data.
‘track’: The lower bound tracks the upper bound by tracking_amount.
CFloat: An explicit value for the lower bound
-
margin
= Float(0.05)¶ The amount of margin to place on either side of the data, expressed as a percentage of the full data width
-
mask_data
(data)¶ Returns a mask array, indicating whether values in the given array are inside the range.
Implements AbstractDataRange.
-
refresh
(event=None)¶ If any of the bounds is ‘auto’, this method refreshes the actual low and high values from the set of the view filters’ data sources.
-
reset
()¶ Resets the bounds of this range, based on default_state.
-
scale_tracking_amount
(multiplier)¶ Sets the tracking_amount to a new value, scaled by multiplier.
-
set_bounds
(low, high)¶ Sets all the bounds of the range simultaneously.
Implements AbstractDataRange.
-
set_default_tracking_amount
(amount)¶ Sets the default_tracking_amount to a new value, amount.
-
set_tracking_amount
(amount)¶ Sets the tracking_amount to a new value, amount.
-
tight_bounds
= Bool(True)¶ Do “auto” bounds imply an exact fit to the data? If False, they pad a little bit of margin on either side.
-
tracking_amount
= default_tracking_amount¶ The current tracking amount. This value changes with zooming.
-
-
chaco.data_range_1d.
calc_bounds
(low_set, high_set, mins, maxes, epsilon, tight_bounds, margin=0.08, track_amount=0, bounds_func=None)¶ Calculates bounds for a given 1-D set of data.
- Parameters
low_set ('auto', 'track', or number) – Current low setting
high_set ('auto', 'track', or number) – Current high setting
mins (list of numbers) – Potential minima.
maxes (list) – Potential maxima.
epsilon (number) – Minimum percentage difference between bounds
tight_bounds (Boolean) – Do ‘auto’ bounds imply an exact fit to the data? If False, they pad a little bit of margin on either side.
margin (float (default=0.08)) – The margin, expressed as a percentage of total data width, to place on either side of the data if tight_bounds is False.
track_amount (number) – The amount by which a ‘track’ bound tracks another bound.
bounds_func (Callable) – A callable which can override the bounds calculation.
- Returns
(min, max) for the new bounds. If either of the calculated bounds is NaN,
returns (0,0).
Description
———–
Setting both *low_set and high_set to ‘track’ is an invalid state;*
the method copes by setting *high_set to ‘auto’, and proceeding.*