[SciPy-User] Seg. fault from scipy.interpolate or numpy

Bruce Southey bsouthey at gmail.com
Thu Apr 7 12:33:35 EDT 2011


On 04/07/2011 11:00 AM, James Turner wrote:
> Sorry, I didn't see this right away. Thanks for the reply.
>
> On 28/03/11 11:23, Bruce Southey wrote:
>> [snip]
>> [I did see the ticket comments and it doesn't crash for me on Linux
>> and Python2.7.]
>>
>> Why do you use 'input' for as the variable name?
>> This could be a problem because input is a builtin function. If the
>> error goes away then it is most likely a Python bug.
>
> Oh, I hadn't noticed that. That's unfortunate. Changing it doesn't
> make any difference though.
>
>> Second, is there a reason for using copy() for 'objfit' instead of 
>> one of these?
>>      zeros_like : Return an array of zeros with shape and type of input.
>>      ones_like : Return an array of ones with shape and type of input.
>>      empty_like : Return an empty array with shape and type of input.
>>      ones : Return a new array setting values to one.
>>      empty : Return a new uninitialized array.
>
> Not really. I was partly inheriting what someone else had done.
> Thanks for the tip. Are these faster? I have changed it to zeros_like,
> without affecting the segmentation fault.
>
>> So can you determine exactly which line it crashes on (especially the
>> value yc) and the shapes of the arrays?
>
> Yes, it crashes on the last line, beginning "noise=", not in the loop.
>
> Good question about yc; it's value is 127, which is correct, as the
> test array has a shape of (128, 2048).
>
> I just tried splitting up the last line into separate operations and
> the one that crashes is objfit.clip(min=0.0). If I replace the last
> line with just that call, I still get the crash.
>
> I thought I'd try printing objfit.min() and max() just for fun and
> those work without crashing, returning -185.079 and 711.543.
>
> Thanks,
>
> James.
Good!
I think that you should be using 'a_min' not 'min' an the argument to an 
ndarray:
clip(...)
     a.clip(a_min, a_max, out=None)

Also you could try using np.clip(objfit, 0.0) as it should be the same 
as objfit.clip(0.0).

But I am still curious is why it is crashing on your system. The ticket 
says Python 2.5 on a 64-bit Linux but your backtrace includes 'i686' 
which suggests that it is 32-bit. Can you be more specific of the 
versions of the software regarding 32 vs 64 bit?

Bruce



More information about the SciPy-User mailing list