recursion - Python- matplotlib maximum recurrsion error- Just stopped working -
to start with, have code:
import numpy import scipy import scipy.fftpack import matplotlib import matplotlib.pyplot plt scipy import pi import pylab pylab import * import cmath #defining test function k = scipy.linspace(0, 2*pi, 8, false) #sample 8 times in interval 0 - 2pi f_k = .8**k #define f[k] acc = lambda k: (f_k) #define f[k] in terms of k variable in python's eyes signal = acc(k) #make signal function of k plt.subplot(211) #set plot markerline, stemlines, baseline = stem(k, signal, '--') #plot stem lines #part w = scipy.linspace(0,2*pi,8) #define w , sample 8 times between 0 , 2pi f_ohmega = 0 #going used @ dtft result = 0 #this k, since k going used in f[k], shall called in range(0,100): #this loop used summation dtft f_ohmega = .8**i * exp(-1j*i*w) + f_ohmega #this obtains value 1000 times @ each succesive value of w yf = abs(f_ohmega) #the y coordinates of magnitude spectra #print(f_ohmega) #periodically used trouble shoot plt.subplot(212) #put on same plot fft markerline, stemlines, baseline = stem(w, yf, '--') #plot stem lines #part b #part c fft = scipy.fft(signal) #perform fast fourier transform fft = abs(scipy.fft(signal)) #get magnitude spectra of fft #plt.subplot(212) #set second plot #markerline, stemlines, baseline = stem(k, fft, '--') #plot stem lines plt.show() #show plot now, worked until reordered it. had part c first, part a. moved it, , gives me horrendous error.
traceback (most recent call last): file "/home/hollis/fast_fourier.py", line 17, in <module> plt.subplot(211) #set plot file "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 766, in subplot = fig.add_subplot(*args, **kwargs) file "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 789, in add_subplot = subplot_class_factory(projection_class)(self, *args, **kwargs) file "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 8455, in __init__ self._axes_class.__init__(self, fig, self.figbox, **kwargs) file "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 463, in __init__ self.cla() file "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 842, in cla spine.cla() file "/usr/lib/pymodules/python2.7/matplotlib/spines.py", line 157, in cla self.axis.cla() file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 731, in cla self.reset_ticks() file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 744, in reset_ticks self.majorticks.extend([self._get_tick(major=true)]) file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 1553, in _get_tick return xtick(self.axes, 0, '', major=major, **tick_kw) file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 141, in __init__ self.tick2line = self._get_tick2line() file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 401, in _get_tick2line l.set_transform(self.axes.get_xaxis_transform(which='tick2')) file "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 586, in get_xaxis_transform return self.spines['top'].get_spine_transform() file "/usr/lib/pymodules/python2.7/matplotlib/spines.py", line 374, in get_spine_transform self._ensure_position_is_set() file "/usr/lib/pymodules/python2.7/matplotlib/spines.py", line 140, in _ensure_position_is_set self.set_position(self._position) file "/usr/lib/pymodules/python2.7/matplotlib/spines.py", line 365, in set_position self.axis.cla() file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 731, in cla self.reset_ticks() file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 744, in reset_ticks self.majorticks.extend([self._get_tick(major=true)]) file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 1553, in _get_tick return xtick(self.axes, 0, '', major=major, **tick_kw) file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 140, in __init__ self.tick1line = self._get_tick1line() file "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 383, in _get_tick1line zorder=self._zorder, file "/usr/lib/pymodules/python2.7/matplotlib/lines.py", line 195, in __init__ self._marker = markerstyle() file "/usr/lib/pymodules/python2.7/matplotlib/markers.py", line 112, in __init__ self.set_marker(marker) file "/usr/lib/pymodules/python2.7/matplotlib/markers.py", line 171, in set_marker self._recache() file "/usr/lib/pymodules/python2.7/matplotlib/markers.py", line 116, in _recache self._path = path(np.empty((0,2))) file "/usr/lib/pymodules/python2.7/matplotlib/path.py", line 132, in __init__ self.should_simplify = (rcparams['path.simplify'] , file "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 673, in __getitem__ return dict.__getitem__(self, key) runtimeerror: maximum recursion depth exceeded while calling python object any ideas went wrong? line referenced in actual code line 17, 'plt.subplot(211)' don't understand why worked, didn't. didn't change anything... help!
Comments
Post a Comment