"Hetal Patel"
<hetal75 <at> hotmail.com> wrote:
Whenever I try to plot complex data using either plt or gplt from any pyhton
shell(Python,PythonWin,IDLE,PyCrust). windows reports that pythonw has
crashed.
I know that it's a bit unfair to ask the plot routines to plot complex data
but I would expect an error, not python to crash.
I'm running the latest SciPy release on Windows XP.
Example code below crashes.
You probably want to plot the modulus of the complex number. It's interesting that if you use plt.plot(b) it gives you an error message that the array is complex then plots the modulus of b for you! Nice error trapping. gplt failes as you say.
Cliff
>>>from scipy import *
>>>a = arange(1,10,0.2)
>>>b = a + 2.j
>>>b
array([ 1. +2.j, 1.2+2.j, 1.4+2.j, 1.6+2.j, 1.8+2.j, 2. +2.j,
2.2+2.j, 2.4+2.j, 2.6+2.j, 2.8+2.j, 3. +2.j, 3.2+2.j, 3.4+2.j, 3.6+2.j,
3.8+2.j, 4. +2.j, 4.2+2.j, 4.4+2.j, 4.6+2.j, 4.8+2.j, 5. +2.j, 5.2+2.j,
5.4+2.j, 5.6+2.j, 5.8+2.j, 6. +2.j, 6.2+2.j, 6.4+2.j, 6.6+2.j, 6.8+2.j,
7. +2.j, 7.2+2.j, 7.4+2.j, 7.6+2.j, 7.8+2.j, 8. +2.j, 8.2+2.j, 8.4+2.j,
8.6+2.j, 8.8+2.j, 9. +2.j, 9.2+2.j, 9.4+2.j, 9.6+2.j, 9.8+2.j])
>>>gplt.plot(b)
At this point python\pythonw crashes with the following error
"python.exe has encountered a problem and needs to close. We are sorry
for the inconvenience."
If anyone can help me resolve this then I would greatly appreciate it.