You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The LinearMapper.map_screen method normally returns a scalar output given scalar input. However, if self._null_data_range is True, it'll return a 1d array instead of a scalar, given scalar input.
While we're here, there's also an isinstance check that makes little sense: it checks for either an ndarray, a tuple, or a list, but then looks up the .shape attribute in all three cases:
map_screen() is not a very coherent interface. In some of the AbstractMapper interfaces, like LinearMapper, map_screen() behaves inconsistently when given a scalar. If the data range is null, it returns a 1-element array. When it has a non-null data range, it computes the result via a very standard arithmetic expression involving only scalars, so the result is a scalar. In others, like LogMapper, it coerces the input to an array first so it always returns an array, regardless of branch. Returning an array is the intended interface of map_screen(), it seems.
Closing this; from discussion, map_screenshould be returning arrays. (There's still the looking up .shape on a list/tuple part, but that's a separate issue.)
The
LinearMapper.map_screen
method normally returns a scalar output given scalar input. However, ifself._null_data_range
isTrue
, it'll return a 1d array instead of a scalar, given scalar input.While we're here, there's also an
isinstance
check that makes little sense: it checks for either an ndarray, a tuple, or a list, but then looks up the.shape
attribute in all three cases:chaco/chaco/linear_mapper.py
Lines 47 to 48 in e0e4f7d
The text was updated successfully, but these errors were encountered: