/usr/share/pyshared/chaco/abstract_mapper.py is in python-chaco 4.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | """ Defines the base class for mappings.
"""
# Major library imports
from numpy import array
# Enthought library imports
from traits.api import Event, HasTraits, Tuple
class AbstractMapper(HasTraits):
""" Defines an abstract mapping from a region in input space to a
region in output space.
"""
# A generic "update" event that generally means that anything that relies
# on this mapper for visual output should do a redraw or repaint.
updated = Event
# A tuple representing the minimum and maximum values of the domain (data
# space). The dimensionality of each value varies depending on the
# dimensions of the mapper, so for 1D mappers these will be scalars, for
# image and 2D mappers these will be tuples.
domain_limits = Tuple(None, None)
def map_screen(self, data_array):
""" map_screen(data_array) -> screen_array
Maps values from data space into screen space.
"""
return
def map_data(self, screen_val):
""" map_data(screen_val) -> data_val
Maps values from screen space into data space.
"""
return
def map_data_array(self, screen_vals):
""" map_data_array(screen_vals) -> data_vals
Maps an array of values from screen space into data space.
By default, this method just loops over the points, calling map_data()
on each one. For vectorizable mapping functions, override this
implmentation with a faster one.
"""
return array([self.map_data(v) for v in screen_vals])
#------------------------------------------------------------------------
# Persistence-related methods
#------------------------------------------------------------------------
def __getstate__(self):
state = super(AbstractMapper,self).__getstate__()
for key in ['_cache_valid']:
if state.has_key(key):
del state[key]
return state
def _post_load(self):
self._cache_valid = False
self._range_changed(None, self.range)
return
# EOF
|