[revision] cleaned up unclean code: tabs -> spaces

This commit is contained in:
Marcel Paffrath 2021-03-30 16:39:44 +02:00
parent f11ffc67ff
commit 07e7ef3efa
4 changed files with 19 additions and 19 deletions

View File

@ -1501,11 +1501,11 @@ class MainWindow(QMainWindow):
:param outformats: str/list of output formats :param outformats: str/list of output formats
:return: :return:
''' '''
if not event: if not event:
event = self.get_current_event() event = self.get_current_event()
if not type(outformats) == list: if not type(outformats) == list:
outformats = [outformats] outformats = [outformats]
def getSavePath(event, directory, outformats): def getSavePath(event, directory, outformats):
if not directory: if not directory:
title = 'Save event data as {} to directory ...'.format(outformats) title = 'Save event data as {} to directory ...'.format(outformats)
directory = QFileDialog.getExistingDirectory(self, directory = QFileDialog.getExistingDirectory(self,
@ -1523,8 +1523,8 @@ class MainWindow(QMainWindow):
uppererrorP = self._inputs['timeerrorsP'] uppererrorP = self._inputs['timeerrorsP']
uppererrorS = self._inputs['timeerrorsS'] uppererrorS = self._inputs['timeerrorsS']
# Inserted to prevent Bug in Eventlist # Inserted to prevent Bug in Eventlist
self.get_data().setEvtData(event) self.get_data().setEvtData(event)
try: try:
self.get_data().applyEVTData(event, typ='event') # getPicks()) self.get_data().applyEVTData(event, typ='event') # getPicks())
except OverwriteError: except OverwriteError:
@ -3023,7 +3023,7 @@ class MainWindow(QMainWindow):
outfile = parameter['outpatter'] outfile = parameter['outpatter']
eventname = self.get_current_event_name() eventname = self.get_current_event_name()
obsdir = os.path.join(self._inputs['rootpath'], self._inputs['datapath'], self._inputs['database'], eventname) obsdir = os.path.join(self._inputs['rootpath'], self._inputs['datapath'], self._inputs['database'], eventname)
self.saveData(event=self.get_current_event(), directory=obsdir, outformats='.obs') self.saveData(event=self.get_current_event(), directory=obsdir, outformats='.obs')
filename = 'PyLoT_' + eventname filename = 'PyLoT_' + eventname
locpath = os.path.join(locroot, 'loc', filename) locpath = os.path.join(locroot, 'loc', filename)
phasefile = os.path.join(obsdir, filename + '.obs') phasefile = os.path.join(obsdir, filename + '.obs')
@ -3756,7 +3756,7 @@ class Project(object):
self.search_eventfile_info() self.search_eventfile_info()
def remove_event(self, event): def remove_event(self, event):
self.eventlist.remove(event) self.eventlist.remove(event)
def remove_event_by_id(self, eventID): def remove_event_by_id(self, eventID):
for event in self.eventlist: for event in self.eventlist:
@ -3765,7 +3765,7 @@ class Project(object):
break break
def read_eventfile_info(self, filename, separator=','): def read_eventfile_info(self, filename, separator=','):
''' '''
Try to read event information from file (:param:filename) comparing specific event datetimes. Try to read event information from file (:param:filename) comparing specific event datetimes.
File structure (each row): event, date, time, magnitude, latitude, longitude, depth File structure (each row): event, date, time, magnitude, latitude, longitude, depth
separated by :param:separator each. separated by :param:separator each.

View File

@ -221,15 +221,15 @@ class LocalMagnitude(Magnitude):
power = [np.power(tr.data, 2) for tr in st if tr.stats.channel[-1] not power = [np.power(tr.data, 2) for tr in st if tr.stats.channel[-1] not
in 'Z3'] in 'Z3']
# checking horizontal count and calculating power_sum accordingly # checking horizontal count and calculating power_sum accordingly
if len(power) == 1: if len(power) == 1:
print ('WARNING: Only one horizontal found for station {0}.'.format(st[0].stats.station)) print ('WARNING: Only one horizontal found for station {0}.'.format(st[0].stats.station))
power_sum = power[0] power_sum = power[0]
elif len(power) == 2: elif len(power) == 2:
power_sum = power[0] + power[1] power_sum = power[0] + power[1]
else: else:
raise ValueError('Wood-Anderson aomplitude defintion only valid for' raise ValueError('Wood-Anderson aomplitude defintion only valid for'
' up to two horizontals: {0} given'.format(len(power))) ' up to two horizontals: {0} given'.format(len(power)))
sqH = np.sqrt(power_sum) sqH = np.sqrt(power_sum)

View File

@ -275,7 +275,7 @@ class Data(object):
# check for already existing xml-file # check for already existing xml-file
if fnext == '.xml': if fnext == '.xml':
if os.path.isfile(fnout + fnext): if os.path.isfile(fnout + fnext):
print("xml-file already exists! Check content ...") print("xml-file already exists! Check content ...")
cat = read_events(fnout + fnext) cat = read_events(fnout + fnext)
if len(cat) > 1: if len(cat) > 1:
raise IOError('Ambigious event information in file {}'.format(fnout + fnext)) raise IOError('Ambigious event information in file {}'.format(fnout + fnext))
@ -287,7 +287,7 @@ class Data(object):
return return
self.checkEvent(event, fcheck) self.checkEvent(event, fcheck)
self.setEvtData(event) self.setEvtData(event)
self.get_evt_data().write(fnout + fnext, format=evtformat) self.get_evt_data().write(fnout + fnext, format=evtformat)
# try exporting event # try exporting event

View File

@ -805,7 +805,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
return return
stime = eventsource['time'] stime = eventsource['time']
event = parameter.get('eventID') event = parameter.get('eventID')
hddID = event.split('.')[0][1:5] hddID = event.split('.')[0][1:5]
# write header # write header
fid.write('# %d %d %d %d %d %5.2f %7.4f +%6.4f %7.4f %4.2f 0.1 0.5 %4.2f %s\n' % ( fid.write('# %d %d %d %d %d %5.2f %7.4f +%6.4f %7.4f %4.2f 0.1 0.5 %4.2f %s\n' % (
stime.year, stime.month, stime.day, stime.hour, stime.minute, stime.second, stime.year, stime.month, stime.day, stime.hour, stime.minute, stime.second,