[bugsearch] trying to fix UnpicklingError by clearing GUI element containing attributes
This commit is contained in:
parent
1f1d0aa118
commit
4fdcf1cf60
@ -2,6 +2,7 @@
|
||||
import sys
|
||||
import numpy as np
|
||||
from pylot.core.active import seismicshot
|
||||
from pylot.core.active.surveyUtils import cleanUp
|
||||
|
||||
class Survey(object):
|
||||
def __init__(self, path, sourcefile, receiverfile, useDefaultParas = False):
|
||||
@ -428,6 +429,7 @@ class Survey(object):
|
||||
|
||||
def saveSurvey(self, filename = 'survey.pickle'):
|
||||
import cPickle
|
||||
cleanUp(self)
|
||||
outfile = open(filename, 'wb')
|
||||
|
||||
cPickle.dump(self, outfile, -1)
|
||||
|
@ -631,6 +631,9 @@ class SeismicShot(object):
|
||||
cid = fig.canvas.mpl_connect('button_press_event', onclick)
|
||||
self.traces4plot[traceID]['cid'] = cid
|
||||
|
||||
def cleanup(event):
|
||||
self.traces4plot[traceID] = {}
|
||||
|
||||
fig = plt.figure()
|
||||
ax1 = fig.add_subplot(2,1,1)
|
||||
ax2 = fig.add_subplot(2,1,2, sharex = ax1)
|
||||
@ -640,18 +643,10 @@ class SeismicShot(object):
|
||||
button1.on_clicked(connectButton)
|
||||
button2 = Button(axb2, 'delete', color = 'green', hovercolor = 'grey')
|
||||
button2.on_clicked(rmPick)
|
||||
fig.canvas.mpl_connect('close_event', cleanup)
|
||||
|
||||
if traceID not in self.traces4plot.keys():
|
||||
self.traces4plot[traceID] = {}
|
||||
|
||||
self.traces4plot[traceID] = {'fig': fig,
|
||||
'ax1': ax1,
|
||||
'ax2': ax2,
|
||||
'axb1': axb1,
|
||||
'axb2': axb2,
|
||||
'button1': button1,
|
||||
'button2': button2,
|
||||
'cid': None}
|
||||
self.traces4plot[traceID] = dict(fig=fig, ax1=ax1, ax2=ax2, axb1=axb1, axb2=axb2, button1=button1,
|
||||
button2=button2, cid=None)
|
||||
|
||||
self._drawStream(traceID)
|
||||
self._drawCFs(traceID, folm)
|
||||
|
@ -86,3 +86,8 @@ def findTracesInRanges(shot_dict, distancebin, pickbin):
|
||||
shots_found[shot.getShotnumber()].append(traceID)
|
||||
|
||||
return shots_found
|
||||
|
||||
def cleanUp(survey):
|
||||
|
||||
for shot in survey.data.values():
|
||||
shot.traces4plot = {}
|
||||
|
Loading…
Reference in New Issue
Block a user