|
From: John H. <jd...@gm...> - 2009-01-15 23:05:21
|
On Thu, Jan 15, 2009 at 4:58 PM, Ryan May <rm...@gm...> wrote:
> Ok, my debugging tells me the problem comes down to the units support,
> specifically this code starting at line 130 in units.py:
>
> if converter is None and iterable(x):
> # if this is anything but an object array, we'll assume
> # there are no custom units
> if isinstance(x, np.ndarray) and x.dtype != np.object:
> return None
>
> for thisx in x:
> converter = self.get_converter( thisx )
> return converter
>
> Because a string is iterable, and even a single character is considered iterable,
> this code recurses forever. I can think this can be solved by, in addition to
> the iterable() check, make sure that x is not string like. If it is, this will
> return None as the converter. Somehow, this actually will then plot properly.
> I'm still trying to run down why this works, but I'm running out of time for the
> day. I will say that the data set for the line2D object is indeed a masked array
> of dtype ('|S4').
>
> Anyone object to adding the check?
Nope -- good idea
> In addition, why are we looping over thisx in x but returning inside the loop?
> Wouldn't this *always* be the same as x[0]?
The loop works for generic iterables that are not indexable and also
for length 0 iterables
JDH
|