reformatted the file to avoid usage of tabs and spaces and made a more pythonic splash message than multiple calls to print

This commit is contained in:
Sebastian Wehling-Benatelli 2015-11-04 13:11:48 +01:00
parent d8a59ac81d
commit 223902f2d4

View File

@ -32,19 +32,17 @@ def autoPyLoT(inputfile):
.. rubric:: Example
"""
print '************************************'
print '*********autoPyLoT starting*********'
print 'The Python picking and Location Tool'
print ' Version ', _getVersionString(), '2015'
print ' '
print 'Authors:'
print 'S. Wehling-Benatelli'
print ' Ruhr-Universität Bochum'
print 'L. Küperkoch'
print ' BESTEC GmbH, Landau (Pfalz)'
print 'K. Olbert'
print ' Christian-Albrechts Universität Kiel'
print '************************************'
splash = '''************************************\n
*********autoPyLoT starting*********\n
The Python picking and Location Tool\n
Version {version} 2015\n
\n
Authors:\n
S. Wehling-Benatelli (Ruhr-Universität Bochum)\n
L. Küperkoch (BESTEC GmbH, Landau i. d. Pfalz)\n
K. Olbert (Christian-Albrechts Universität zu Kiel)\n
***********************************'''.format(version=_getVersionString())
print(splash)
# reading parameter file
@ -77,7 +75,7 @@ def autoPyLoT(inputfile):
# get path to NLLoc executable
nllocbin = parameter.getParam('nllocbin')
nlloccall = '%s/NLLoc' % nllocbin
# get name of phase file
# get name of phase file
phasef = parameter.getParam('phasefile')
phasefile = '%s/obs/%s' % (nllocroot, phasef)
# get name of NLLoc-control file
@ -99,8 +97,8 @@ def autoPyLoT(inputfile):
if not parameter.hasParam('eventID'):
for event in [events for events in glob.glob(os.path.join(datapath, '*')) if os.path.isdir(events)]:
data.setWFData(glob.glob(os.path.join(datapath, event, '*')))
print 'Working on event %s' % event
print data
print('Working on event %s' % event)
print(data)
wfdat = data.getWFData() # all available streams
##########################################################
@ -148,7 +146,7 @@ def autoPyLoT(inputfile):
##########################################################
# !automated picking starts here!
picks = autopickevent(wfdat, parameter)
##########################################################
# locating
if locflag == 1:
@ -166,15 +164,15 @@ def autoPyLoT(inputfile):
filedata = nllfile.read()
if filedata.find(locfiles) < 0:
# replace old command
filedata = filedata.replace('LOCFILES', locfiles)
nllfile = open(locfile, 'w')
nllfile.write(filedata)
nllfile.close()
filedata = filedata.replace('LOCFILES', locfiles)
nllfile = open(locfile, 'w')
nllfile.write(filedata)
nllfile.close()
# locate the event
subprocess.call([nlloccall, locfile])
##########################################################
print '------------------------------------------'