Minor changes to adjust to python 3. Temporary Fix for file exporting not working properly. WIP spectrogram view.

This commit is contained in:
Jeldrik Gaal 2023-04-11 14:59:58 +02:00
commit e4e7afa996
6 changed files with 149 additions and 86 deletions

View File

@ -117,17 +117,19 @@ class MainWindow(QMainWindow):
if not infile: if not infile:
infile = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in') infile = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in')
print('Using default input file {}'.format(infile)) print('Using default input file {}'.format(infile))
if os.path.isfile(infile) == False: if os.path.isfile(infile) is False:
infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file') infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file')[0]
if not os.path.exists(infile[0]): if not os.path.exists(infile):
QMessageBox.warning(self, "PyLoT Warning", QMessageBox.warning(self, "PyLoT Warning",
"No PyLoT-input file declared!") "No PyLoT-input file declared! Using default parameters!")
sys.exit(0) infile = None
self.infile = infile[0]
else:
self.infile = infile
self._inputs = PylotParameter(infile) self._inputs = PylotParameter(infile)
if not infile:
self._inputs.reset_defaults()
self.infile = infile
self._props = None self._props = None
self.gain = 1. self.gain = 1.
@ -481,7 +483,7 @@ class MainWindow(QMainWindow):
"automatic pick " "automatic pick "
"data.", False) "data.", False)
self.compare_action.setEnabled(False) self.compare_action.setEnabled(False)
self.qualities_action = self.createAction(parent=self, text='Show pick qualitites...', self.qualities_action = self.createAction(parent=self, text='Show pick qualities...',
slot=self.pickQualities, shortcut='Alt+Q', slot=self.pickQualities, shortcut='Alt+Q',
icon=qualities_icon, tip='Histogram of pick qualities') icon=qualities_icon, tip='Histogram of pick qualities')
self.qualities_action.setEnabled(False) self.qualities_action.setEnabled(False)
@ -732,18 +734,15 @@ class MainWindow(QMainWindow):
_widget.setLayout(self._main_layout) _widget.setLayout(self._main_layout)
_widget.showFullScreen() _widget.showFullScreen()
self.logwidget = LogWidget(parent=None)
if use_logwidget: if use_logwidget:
self.logwidget = LogWidget(parent=None)
self.logwidget.show() self.logwidget.show()
self.stdout = self.logwidget.stdout self.stdout = self.logwidget.stdout
self.stderr = self.logwidget.stderr self.stderr = self.logwidget.stderr
self.stdout = self.stdout
self.stderr = self.stderr
# Not sure why but the lines above kept messing with the Ouput even with use_logwidget disabled # Not sure why but the lines above kept messing with the Ouput even with use_logwidget disabled
sys.stdout = sys.__stdout__ sys.stdout = self.stdout
sys.stderr = sys.__stderr__ sys.stderr = self.stderr
self.setCentralWidget(_widget) self.setCentralWidget(_widget)
@ -1181,7 +1180,7 @@ class MainWindow(QMainWindow):
''' '''
if not self.project: if not self.project:
self.createNewProject() self.createNewProject()
ed = getExistingDirectories(self, 'Select event directories...') ed = GetExistingDirectories(self, 'Select event directories...')
if ed.exec_(): if ed.exec_():
eventlist = [event for event in ed.selectedFiles() if not event.endswith('EVENTS-INFO')] eventlist = [event for event in ed.selectedFiles() if not event.endswith('EVENTS-INFO')]
basepath = eventlist[0].split(os.path.basename(eventlist[0]))[0] basepath = eventlist[0].split(os.path.basename(eventlist[0]))[0]
@ -2517,13 +2516,9 @@ class MainWindow(QMainWindow):
self.dataPlot.draw() self.dataPlot.draw()
def pickOnStation(self, gui_event): def pickOnStation(self, gui_event):
sys.stdout = sys.__stdout__
print ( "xxxxxxxxxxx" )
if self.pg: if self.pg:
button = gui_event.button() button = gui_event.button()
if not button in [1,2, 4]: if not button in [1, 4]:
return return
else: else:
button = gui_event.button button = gui_event.button
@ -2543,25 +2538,8 @@ class MainWindow(QMainWindow):
station = self.getStationName(wfID) station = self.getStationName(wfID)
location = self.getLocationName(wfID) location = self.getLocationName(wfID)
seed_id = self.getTraceID(wfID) seed_id = self.getTraceID(wfID)
if button == 2: if button == 1:
self.pickDialog(wfID, seed_id) self.pickDialog(wfID, seed_id)
elif button == 1:
print ( " XXX " )
stations = []
names = []
traces = {}
for tr in self.get_data().wfdata.traces:
if not tr.stats.station in stations:
stations.append(tr.stats.station)
names.append(tr.stats.network + '.' + tr.stats.station)
for station in stations:
traces[station] = {}
for ch in ['Z', 'N', 'E']:
for tr in self.get_data().wfdata.select(component=ch).traces:
traces[tr.stats.station][ch] = tr
print ( traces[station]['Z'] )
print ( "XXXXXXXXXXXXXXXXXXXXXXXXXXX" )
elif button == 4: elif button == 4:
self.toggle_station_color(wfID, network, station, location) self.toggle_station_color(wfID, network, station, location)
@ -2919,7 +2897,9 @@ class MainWindow(QMainWindow):
self.log_deleted_picks([deleted_pick]) self.log_deleted_picks([deleted_pick])
def log_deleted_picks(self, deleted_picks, event_path=None): def log_deleted_picks(self, deleted_picks, event_path=None):
''' Log deleted picks to list self.deleted_picks ''' '''
Log deleted picks to list self.deleted_picks
'''
if not event_path: if not event_path:
event_path = self.get_current_event_path() event_path = self.get_current_event_path()
for deleted_pick in deleted_picks: for deleted_pick in deleted_picks:
@ -2933,7 +2913,9 @@ class MainWindow(QMainWindow):
self.deleted_picks[event_path].append(deleted_pick) self.deleted_picks[event_path].append(deleted_pick)
def dump_deleted_picks(self, event_path): def dump_deleted_picks(self, event_path):
''' Save deleted picks to json file for event in event_path. Load old file before and merge''' '''
Save deleted picks to json file for event in event_path. Load old file before and merge
'''
try: try:
deleted_picks_from_file = self.load_deleted_picks(event_path) deleted_picks_from_file = self.load_deleted_picks(event_path)
except Exception as e: except Exception as e:
@ -3843,7 +3825,7 @@ class MainWindow(QMainWindow):
def helpHelp(self): def helpHelp(self):
if checkurl(): if checkurl():
form = HelpForm(self, form = HelpForm(self,
'https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/wiki') 'https://github.com/seismology-RUB/PyLoT')
else: else:
form = HelpForm(self, ':/help.html') form = HelpForm(self, ':/help.html')
form.show() form.show()
@ -4023,13 +4005,13 @@ class Project(object):
return project return project
class getExistingDirectories(QFileDialog): class GetExistingDirectories(QFileDialog):
''' '''
File dialog with possibility to select multiple folders. File dialog with possibility to select multiple folders.
''' '''
def __init__(self, *args): def __init__(self, *args):
super(getExistingDirectories, self).__init__(*args) super(GetExistingDirectories, self).__init__(*args)
self.setOption(self.DontUseNativeDialog, True) self.setOption(self.DontUseNativeDialog, True)
self.setOption(self.ReadOnly, True) self.setOption(self.ReadOnly, True)
self.setFileMode(self.Directory) self.setFileMode(self.Directory)
@ -4055,16 +4037,7 @@ def create_window():
return app, app_created return app, app_created
def main(args=None): def main(project_filename=None, pylot_infile=None, reset_qsettings=False):
project_filename = None
# args.project_filename = 'C:/Shared/AlpArray/alparray_data/project_alparray_test.plp'
pylot_infile = None
if args:
if args.project_filename:
project_filename = args.project_filename
if args.input_filename:
pylot_infile = args.input_filename
reset_qsettings = args.reset_qsettings
# create the Qt application # create the Qt application
pylot_app, app_created = create_window() pylot_app, app_created = create_window()
@ -4113,4 +4086,5 @@ if __name__ == "__main__":
parser.add_argument('--reset_qsettings', default=False, action='store_true', parser.add_argument('--reset_qsettings', default=False, action='store_true',
help='reset qsettings (debug option)') help='reset qsettings (debug option)')
args = parser.parse_args() args = parser.parse_args()
sys.exit(main(args)) sys.exit(main(project_filename=args.project_filename, pylot_infile=args.input_filename,
reset_qsettings=args.reset_qsettings))

View File

@ -260,6 +260,10 @@ class Data(object):
can be a str or a list of strings of ['manual', 'auto', 'origin', 'magnitude'] can be a str or a list of strings of ['manual', 'auto', 'origin', 'magnitude']
""" """
from pylot.core.util.defaults import OUTPUTFORMATS from pylot.core.util.defaults import OUTPUTFORMATS
import sys
sys.stdout = sys.__stdout__
print ( fnext )
if not type(fcheck) == list: if not type(fcheck) == list:
fcheck = [fcheck] fcheck = [fcheck]
@ -327,20 +331,31 @@ class Data(object):
for j in range(len(picks)): for j in range(len(picks)):
for i in range(len(picks_copy)): for i in range(len(picks_copy)):
if picks_copy[i].phase_hint[0] == 'P': if picks_copy[i].phase_hint[0] == 'P':
if (picks_copy[i].time_errors['upper_uncertainty'] >= upperErrors[0]) or \ print(picks_copy[i].time_errors)
(picks_copy[i].time_errors['uncertainty'] is None):
# Testing if exporting works without upper_uncertatinty
if picks_copy[i].time_errors['upper_uncertainty'] is None:
break
if (picks_copy[i].time_errors['uncertainty'] is None) or \
(picks_copy[i].time_errors['upper_uncertainty'] >= upperErrors[0]):
print("Uncertainty exceeds or equal adjusted upper time error!") print("Uncertainty exceeds or equal adjusted upper time error!")
print("Adjusted uncertainty: {}".format(upperErrors[0])) print("Adjusted uncertainty: {}".format(upperErrors[0]))
print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty'])) print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty']))
print("{1} P-Pick of station {0} will not be saved in outputfile".format( print("{1} P-Pick of station {0} will not be saved in outputfile".format(
picks_copy[i].waveform_id.station_code, picks_copy[i].waveform_id.station_code,
picks_copy[i].method_id)) picks_copy[i].method_id))
print("#") print("#######")
del picks_copy[i] del picks_copy[i]
break break
if picks_copy[i].phase_hint[0] == 'S': if picks_copy[i].phase_hint[0] == 'S':
if (picks_copy[i].time_errors['upper_uncertainty'] >= upperErrors[1]) or \
(picks_copy[i].time_errors['uncertainty'] is None): # Testing if exporting works without upper_uncertatinty
if picks_copy[i].time_errors['upper_uncertainty'] is None:
break
if (picks_copy[i].time_errors['uncertainty'] is None) or \
(picks_copy[i].time_errors['upper_uncertainty'] >= upperErrors[1]):
print("Uncertainty exceeds or equal adjusted upper time error!") print("Uncertainty exceeds or equal adjusted upper time error!")
print("Adjusted uncertainty: {}".format(upperErrors[1])) print("Adjusted uncertainty: {}".format(upperErrors[1]))
print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty'])) print("Pick uncertainty: {}".format(picks_copy[i].time_errors['uncertainty']))
@ -773,9 +788,12 @@ class GenericDataStructure(object):
""" """
expandList = [] expandList = []
for item in self.getExpandFields(): for item in self.getExpandFields():
print ( item )
expandList.append(self.getFieldValue(item)) expandList.append(self.getFieldValue(item))
if self.hasSuffix(): if self.hasSuffix():
expandList.append('*%s' % self.getFieldValue('suffix')) expandList.append('*%s' % self.getFieldValue('suffix'))
print ( expandList )
print ( self.getFields() )
return os.path.join(*expandList) return os.path.join(*expandList)
def getCatalogName(self): def getCatalogName(self):

View File

@ -517,7 +517,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
arrivals = chooseArrivals(arrivals) # MP MP what is chooseArrivals? It is not defined anywhere arrivals = chooseArrivals(arrivals) # MP MP what is chooseArrivals? It is not defined anywhere
for key in arrivals: for key in arrivals:
# P onsets # P onsets
if arrivals[key].has_key('P'): if 'P' in arrivals[key]:
try: try:
fm = arrivals[key]['P']['fm'] fm = arrivals[key]['P']['fm']
except KeyError as e: except KeyError as e:
@ -551,7 +551,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
ss_ms, ss_ms,
pweight)) pweight))
# S onsets # S onsets
if arrivals[key].has_key('S') and arrivals[key]['S']['mpp'] is not None: if 'S' in arrivals[key] and arrivals[key]['S']['mpp'] is not None:
fm = '?' fm = '?'
onset = arrivals[key]['S']['mpp'] onset = arrivals[key]['S']['mpp']
year = onset.year year = onset.year
@ -670,7 +670,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
arrivals = chooseArrivals(arrivals) # MP MP what is chooseArrivals? It is not defined anywhere arrivals = chooseArrivals(arrivals) # MP MP what is chooseArrivals? It is not defined anywhere
for key in arrivals: for key in arrivals:
# P onsets # P onsets
if arrivals[key].has_key('P') and arrivals[key]['P']['mpp'] is not None: if 'P' in arrivals[key] and arrivals[key]['P']['mpp'] is not None:
if arrivals[key]['P']['weight'] < 4: if arrivals[key]['P']['weight'] < 4:
Ponset = arrivals[key]['P']['mpp'] Ponset = arrivals[key]['P']['mpp']
pyear = Ponset.year pyear = Ponset.year
@ -699,7 +699,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
fid.write('%-5s P1 %4.0f %02d %02d %02d %02d %05.02f %5.3f -999. 0.00 -999. 0.00\n' fid.write('%-5s P1 %4.0f %02d %02d %02d %02d %05.02f %5.3f -999. 0.00 -999. 0.00\n'
% (key, pyear, pmonth, pday, phh, pmm, Pss, pstd)) % (key, pyear, pmonth, pday, phh, pmm, Pss, pstd))
# S onsets # S onsets
if arrivals[key].has_key('S') and arrivals[key]['S']['mpp'] is not None: if 'S' in arrivals[key] and arrivals[key]['S']['mpp'] is not None:
if arrivals[key]['S']['weight'] < 4: if arrivals[key]['S']['weight'] < 4:
Sonset = arrivals[key]['S']['mpp'] Sonset = arrivals[key]['S']['mpp']
syear = Sonset.year syear = Sonset.year
@ -768,7 +768,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
usedarrivals = chooseArrivals(arrivals) usedarrivals = chooseArrivals(arrivals)
for key in usedarrivals: for key in usedarrivals:
# P onsets # P onsets
if usedarrivals[key].has_key('P'): if 'P' in usedarrivals[key]:
if usedarrivals[key]['P']['weight'] < 4: if usedarrivals[key]['P']['weight'] < 4:
n += 1 n += 1
stat = key stat = key
@ -782,7 +782,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
else: else:
fid.write('%-4sP%d%6.2f\n' % (stat, Pweight, Prt)) fid.write('%-4sP%d%6.2f\n' % (stat, Pweight, Prt))
# S onsets # S onsets
if usedarrivals[key].has_key('S'): if 'S' in usedarrivals[key]:
if usedarrivals[key]['S']['weight'] < 4: if usedarrivals[key]['S']['weight'] < 4:
n += 1 n += 1
stat = key stat = key
@ -828,13 +828,13 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
# prefer manual picks # prefer manual picks
usedarrivals = chooseArrivals(arrivals) usedarrivals = chooseArrivals(arrivals)
for key in usedarrivals: for key in usedarrivals:
if usedarrivals[key].has_key('P'): if 'P' in usedarrivals[key]:
# P onsets # P onsets
if usedarrivals[key]['P']['weight'] < 4: if usedarrivals[key]['P']['weight'] < 4:
Ponset = usedarrivals[key]['P']['mpp'] Ponset = usedarrivals[key]['P']['mpp']
Prt = Ponset - stime # onset time relative to source time Prt = Ponset - stime # onset time relative to source time
fid.write('%s %6.3f 1 P\n' % (key, Prt)) fid.write('%s %6.3f 1 P\n' % (key, Prt))
if usedarrivals[key].has_key('S'): if 'S' in usedarrivals[key]:
# S onsets # S onsets
if usedarrivals[key]['S']['weight'] < 4: if usedarrivals[key]['S']['weight'] < 4:
Sonset = usedarrivals[key]['S']['mpp'] Sonset = usedarrivals[key]['S']['mpp']
@ -879,7 +879,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
# prefer manual picks # prefer manual picks
usedarrivals = chooseArrivals(arrivals) usedarrivals = chooseArrivals(arrivals)
for key in usedarrivals: for key in usedarrivals:
if usedarrivals[key].has_key('P'): if 'P' in usedarrivals[key]:
if usedarrivals[key]['P']['weight'] < 4 and usedarrivals[key]['P']['fm'] is not None: if usedarrivals[key]['P']['weight'] < 4 and usedarrivals[key]['P']['fm'] is not None:
stat = key stat = key
for i in range(len(picks)): for i in range(len(picks)):
@ -961,7 +961,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
arrivals = chooseArrivals(arrivals) # MP MP what is chooseArrivals? It is not defined anywhere arrivals = chooseArrivals(arrivals) # MP MP what is chooseArrivals? It is not defined anywhere
# write phase lines # write phase lines
for key in arrivals: for key in arrivals:
if arrivals[key].has_key('P'): if 'P' in arrivals[key]:
if arrivals[key]['P']['weight'] < 4 and arrivals[key]['P']['fm'] is not None: if arrivals[key]['P']['weight'] < 4 and arrivals[key]['P']['fm'] is not None:
stat = key stat = key
ccode = arrivals[key]['P']['channel'] ccode = arrivals[key]['P']['channel']

View File

@ -26,9 +26,7 @@ elif system_name == "Windows":
# suffix for phase name if not phase identified by last letter (P, p, etc.) # suffix for phase name if not phase identified by last letter (P, p, etc.)
ALTSUFFIX = ['diff', 'n', 'g', '1', '2', '3'] ALTSUFFIX = ['diff', 'n', 'g', '1', '2', '3']
FILTERDEFAULTS = readDefaultFilterInformation(os.path.join(os.path.expanduser('~'), FILTERDEFAULTS = readDefaultFilterInformation()
'.pylot',
'pylot.in'))
TIMEERROR_DEFAULTS = os.path.join(os.path.expanduser('~'), TIMEERROR_DEFAULTS = os.path.join(os.path.expanduser('~'),
'.pylot', '.pylot',

View File

@ -37,15 +37,14 @@ def getAutoFilteroptions(phase, parameter):
return filteroptions return filteroptions
def readDefaultFilterInformation(fname): def readDefaultFilterInformation():
""" """
Read default filter information from pylot.in file Read default filter information from pylot.in file
:param fname: path to pylot.in file
:type fname: str
:return: dictionary containing the defailt filter information :return: dictionary containing the defailt filter information
:rtype: dict :rtype: dict
""" """
pparam = PylotParameter(fname) pparam = PylotParameter()
pparam.reset_defaults()
return readFilterInformation(pparam) return readFilterInformation(pparam)

View File

@ -5663,9 +5663,49 @@ class ChooseWaveFormWindow(QWidget):
def submit(self): def submit(self):
matplotlib.pyplot.close(self.currentSpectro) matplotlib.pyplot.close(self.currentSpectro)
t = self.chooseBoxTraces.currentText() + " " + self.chooseBoxComponent.currentText() t = self.chooseBoxTraces.currentText() + " " + self.chooseBoxComponent.currentText()
self.currentSpectro = self.traces[ #self.currentSpectro = self.traces[
self.chooseBoxTraces.currentText()[3:]][self.chooseBoxComponent.currentText()].spectrogram(show=False, title=t) # self.chooseBoxTraces.currentText()[3:]][self.chooseBoxComponent.currentText()].spectrogram(show=False, title=t)
self.currentSpectro.show() #self.currentSpectro.show()
applyFFT()
def applyFFT(self, trace):
sys.stdout = sys.__stdout__
tra = self.traces[self.chooseBoxTraces.currentText()[3:]]['Z']
transformed = abs(np.fft.rfft(tra.data))
print ( transformed )
matplotlib.pyplot.plot ( transformed )
matplotlib.pyplot.show()
def applyFFTs(self, tra):
sys.stdout = sys.__stdout__
transformed = abs(np.fft.rfft(tra.data))
print ( transformed )
matplotlib.pyplot.plot ( transformed )
matplotlib.pyplot.show()
def applyFFT2(self, trace):
sys.stdout = sys.__stdout__
tra = self.traces[self.chooseBoxTraces.currentText()[3:]]['Z']
from pylot.core.pick.utils import select_for_phase
zdat = select_for_phase(tra, "P")
freq = zdat[0].stats.sampling_rate
# fft
fny = freq / 2
# l = len(xdat) / freq
# number of fft bins after Bath
# n = freq * l
# find next power of 2 of data length
m = pow(2, np.ceil(np.log(len(zdat)) / np.log(2)))
N = min(int(np.power(m, 2)), 16384)
# N = int(np.power(m, 2))
y = dt * np.fft.fft(zdat, N)
Y = abs(y[: int(N / 2)])
#L = (N - 1) / freq
#f = np.arange(0, fny, 1 / L)
matplotlib.pyplot.plot (Y)
matplotlib.pyplot.show()
def submitN(self): def submitN(self):
matplotlib.pyplot.close(self.currentSpectro) matplotlib.pyplot.close(self.currentSpectro)
@ -5674,19 +5714,53 @@ class ChooseWaveFormWindow(QWidget):
self.chooseBoxTraces.currentText()[3:]]['N'].spectrogram(show=False, title=t) self.chooseBoxTraces.currentText()[3:]]['N'].spectrogram(show=False, title=t)
self.currentSpectro.show() self.currentSpectro.show()
def submitE(self): def submitE2(self):
matplotlib.pyplot.close(self.currentSpectro) matplotlib.pyplot.close(self.currentSpectro)
t = self.chooseBoxTraces.currentText() + " " + self.chooseBoxComponent.currentText() t = self.chooseBoxTraces.currentText() + " " + self.chooseBoxComponent.currentText()
self.currentSpectro = self.traces[ self.currentSpectro = self.traces[
self.chooseBoxTraces.currentText()[3:]]['E'].spectrogram(show=False, title=t) self.chooseBoxTraces.currentText()[3:]]['E'].spectrogram(show=False, title=t)
self.currentSpectro.show() self.currentSpectro.show()
def submitE(self):
sys.stdout = sys.__stdout__
matplotlib.pyplot.close(self.currentSpectro)
#t = self.chooseBoxTraces.currentText() + " " + self.chooseBoxComponent.currentText()
#self.currentSpectro = self.traces[
# self.chooseBoxTraces.currentText()[3:]]['Z'].spectrogram(show=False, title=t)
#self.currentSpectro.show()
#self.applyFFT('s')
i = 0
figure, axis = matplotlib.pyplot.subplots(len(self.traces), sharex=True)
for t in self.traces:
tra = self.traces[t]['Z']
transformed = abs(np.fft.rfft(tra.data))
axis[i].plot(transformed, label = t)
#axis[i].tick_params(labelbottom=False)
axis[i].spines['top'].set_visible(False)
axis[i].spines['right'].set_visible(False)
axis[i].spines['left'].set_visible(False)
if not (len(self.traces) == i - 1) :
axis[i].spines['bottom'].set_visible(False)
axis[i].set_yticks([])
axis[i].set_ylabel(t,loc='center', rotation='horizontal')
#axis[i].axis('off')
i += 1
#self.applyFFTs(t)
matplotlib.pyplot.margins(0)
return FigureCanvas(figure)
#return figure, axis
matplotlib.pyplot.show()
def submitZ(self): def submitZ(self):
matplotlib.pyplot.close(self.currentSpectro) matplotlib.pyplot.close(self.currentSpectro)
t = self.chooseBoxTraces.currentText() + " " + self.chooseBoxComponent.currentText() #t = self.chooseBoxTraces.currentText() + " " + self.chooseBoxComponent.currentText()
self.currentSpectro = self.traces[ #self.currentSpectro = self.traces[
self.chooseBoxTraces.currentText()[3:]]['Z'].spectrogram(show=False, title=t) # self.chooseBoxTraces.currentText()[3:]]['Z'].spectrogram(show=False, title=t)
self.currentSpectro.show() #self.currentSpectro.show()
self.applyFFT2('s')
# Creates a QComboBox and adds all traces provided # Creates a QComboBox and adds all traces provided
def createComboBoxTraces(self): def createComboBoxTraces(self):
@ -5717,4 +5791,4 @@ class ChooseWaveFormWindow(QWidget):
if __name__ == '__main__': if __name__ == '__main__':
import doctest import doctest
doctest.testmod() doctest.testmod()