[reformat] code reformatting with PyCharm
This commit is contained in:
parent
4107f0249d
commit
20b31a1c5c
13
QtPyLoT.py
13
QtPyLoT.py
@ -23,10 +23,11 @@ https://www.iconfinder.com/iconsets/flavour
|
|||||||
(http://www.gnu.org/copyleft/lesser.html)
|
(http://www.gnu.org/copyleft/lesser.html)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import platform
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
|
||||||
import matplotlib
|
import matplotlib
|
||||||
|
|
||||||
matplotlib.use('Qt4Agg')
|
matplotlib.use('Qt4Agg')
|
||||||
@ -66,10 +67,10 @@ from pylot.core.pick.compare import Comparison
|
|||||||
from pylot.core.pick.utils import symmetrize_error
|
from pylot.core.pick.utils import symmetrize_error
|
||||||
from pylot.core.io.phases import picksdict_from_picks
|
from pylot.core.io.phases import picksdict_from_picks
|
||||||
import pylot.core.loc.nll as nll
|
import pylot.core.loc.nll as nll
|
||||||
from pylot.core.util.defaults import FILTERDEFAULTS, OUTPUTFORMATS, SetChannelComponents, \
|
from pylot.core.util.defaults import FILTERDEFAULTS, SetChannelComponents, \
|
||||||
readFilterInformation
|
readFilterInformation
|
||||||
from pylot.core.util.errors import FormatError, DatastructureError, \
|
from pylot.core.util.errors import FormatError, DatastructureError, \
|
||||||
OverwriteError, ProcessingError
|
OverwriteError
|
||||||
from pylot.core.util.connection import checkurl
|
from pylot.core.util.connection import checkurl
|
||||||
from pylot.core.util.dataprocessing import read_metadata, restitute_data
|
from pylot.core.util.dataprocessing import read_metadata, restitute_data
|
||||||
from pylot.core.util.utils import fnConstructor, getLogin, \
|
from pylot.core.util.utils import fnConstructor, getLogin, \
|
||||||
@ -81,7 +82,7 @@ from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
|||||||
getDataType, ComparisonDialog, TuneAutopicker, PylotParaBox
|
getDataType, ComparisonDialog, TuneAutopicker, PylotParaBox
|
||||||
from pylot.core.util.map_projection import map_projection
|
from pylot.core.util.map_projection import map_projection
|
||||||
from pylot.core.util.structure import DATASTRUCTURE
|
from pylot.core.util.structure import DATASTRUCTURE
|
||||||
from pylot.core.util.thread import AutoPickThread, Thread, Worker
|
from pylot.core.util.thread import Thread, Worker
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
from pylot.core.util.version import get_git_version as _getVersionString
|
||||||
|
|
||||||
if sys.version_info.major == 3:
|
if sys.version_info.major == 3:
|
||||||
|
29
autoPyLoT.py
29
autoPyLoT.py
@ -4,18 +4,19 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import datetime
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import datetime
|
|
||||||
from obspy import read_events
|
|
||||||
from obspy.core.event import ResourceIdentifier
|
|
||||||
import pylot.core.loc.hyposat as hyposat
|
|
||||||
import pylot.core.loc.hypo71 as hypo71
|
|
||||||
import pylot.core.loc.velest as velest
|
|
||||||
import pylot.core.loc.hypodd as hypodd
|
|
||||||
import pylot.core.loc.focmec as focmec
|
import pylot.core.loc.focmec as focmec
|
||||||
import pylot.core.loc.hash as hash
|
import pylot.core.loc.hash as hash
|
||||||
|
import pylot.core.loc.hypo71 as hypo71
|
||||||
|
import pylot.core.loc.hypodd as hypodd
|
||||||
|
import pylot.core.loc.hyposat as hyposat
|
||||||
import pylot.core.loc.nll as nll
|
import pylot.core.loc.nll as nll
|
||||||
|
import pylot.core.loc.velest as velest
|
||||||
|
from obspy import read_events
|
||||||
|
from obspy.core.event import ResourceIdentifier
|
||||||
# from PySide.QtGui import QWidget, QInputDialog
|
# from PySide.QtGui import QWidget, QInputDialog
|
||||||
from pylot.core.analysis.magnitude import MomentMagnitude, LocalMagnitude
|
from pylot.core.analysis.magnitude import MomentMagnitude, LocalMagnitude
|
||||||
from pylot.core.io.data import Data
|
from pylot.core.io.data import Data
|
||||||
@ -23,16 +24,17 @@ from pylot.core.io.inputs import PylotParameter
|
|||||||
from pylot.core.pick.autopick import autopickevent, iteratepicker
|
from pylot.core.pick.autopick import autopickevent, iteratepicker
|
||||||
from pylot.core.util.dataprocessing import restitute_data, read_metadata, \
|
from pylot.core.util.dataprocessing import restitute_data, read_metadata, \
|
||||||
remove_underscores
|
remove_underscores
|
||||||
from pylot.core.util.structure import DATASTRUCTURE
|
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
|
||||||
from pylot.core.util.event import Event
|
|
||||||
from pylot.core.util.utils import real_None
|
|
||||||
from pylot.core.util.defaults import SEPARATOR
|
from pylot.core.util.defaults import SEPARATOR
|
||||||
|
from pylot.core.util.event import Event
|
||||||
|
from pylot.core.util.structure import DATASTRUCTURE
|
||||||
|
from pylot.core.util.utils import real_None
|
||||||
|
from pylot.core.util.version import get_git_version as _getVersionString
|
||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
|
|
||||||
|
|
||||||
def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, eventid=None, savepath=None, station='all', iplot=0):
|
def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, eventid=None, savepath=None, station='all',
|
||||||
|
iplot=0):
|
||||||
"""
|
"""
|
||||||
Determine phase onsets automatically utilizing the automatic picking
|
Determine phase onsets automatically utilizing the automatic picking
|
||||||
algorithms by Kueperkoch et al. 2010/2012.
|
algorithms by Kueperkoch et al. 2010/2012.
|
||||||
@ -310,7 +312,8 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
|||||||
if input_dict:
|
if input_dict:
|
||||||
if 'fig_dict' in input_dict:
|
if 'fig_dict' in input_dict:
|
||||||
fig_dict = input_dict['fig_dict']
|
fig_dict = input_dict['fig_dict']
|
||||||
picks = iteratepicker(wfdat, nllocfile, picks, badpicks, parameter, fig_dict=fig_dict)
|
picks = iteratepicker(wfdat, nllocfile, picks, badpicks, parameter,
|
||||||
|
fig_dict=fig_dict)
|
||||||
else:
|
else:
|
||||||
picks = iteratepicker(wfdat, nllocfile, picks, badpicks, parameter)
|
picks = iteratepicker(wfdat, nllocfile, picks, badpicks, parameter)
|
||||||
# write phases to NLLoc-phase file
|
# write phases to NLLoc-phase file
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<html><head><title>PyLoT - the Python picking and Localisation Tool</title></head>
|
<html>
|
||||||
|
<head><title>PyLoT - the Python picking and Localisation Tool</title></head>
|
||||||
<body>
|
<body>
|
||||||
<p><b>PyLoT</b> is a program which is capable of picking seismic phases,
|
<p><b>PyLoT</b> is a program which is capable of picking seismic phases,
|
||||||
exporting these as numerous standard phase format and localize the corresponding
|
exporting these as numerous standard phase format and localize the corresponding
|
||||||
@ -14,4 +15,5 @@ seismic event with external software as, e.g.:</p>
|
|||||||
<p>Bug reports are very much appreciated and can also be delivered on our
|
<p>Bug reports are very much appreciated and can also be delivered on our
|
||||||
<a href="https://ariadne.geophysik.rub.de/trac/PyLoT">PyLoT TracPage</a> after
|
<a href="https://ariadne.geophysik.rub.de/trac/PyLoT">PyLoT TracPage</a> after
|
||||||
successful registration.</p>
|
successful registration.</p>
|
||||||
</body></html>
|
</body>
|
||||||
|
</html>
|
||||||
|
@ -190,8 +190,6 @@ def installPyLoT(verbosity=None):
|
|||||||
os.symlink(destination, link_dest)
|
os.symlink(destination, link_dest)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def cleanUp(verbosity=None):
|
def cleanUp(verbosity=None):
|
||||||
if verbosity >= 1:
|
if verbosity >= 1:
|
||||||
print('cleaning up build files...')
|
print('cleaning up build files...')
|
||||||
|
@ -6,16 +6,16 @@ Revised/extended summer 2017.
|
|||||||
|
|
||||||
:author: Ludger Küperkoch / MAGS2 EP3 working group
|
:author: Ludger Küperkoch / MAGS2 EP3 working group
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import obspy.core.event as ope
|
import obspy.core.event as ope
|
||||||
from obspy.geodetics import degrees2kilometers
|
from obspy.geodetics import degrees2kilometers
|
||||||
from scipy import integrate, signal
|
|
||||||
from scipy.optimize import curve_fit
|
|
||||||
from pylot.core.pick.utils import getsignalwin, crossings_nonzero_all, \
|
from pylot.core.pick.utils import getsignalwin, crossings_nonzero_all, \
|
||||||
select_for_phase
|
select_for_phase
|
||||||
from pylot.core.util.utils import common_range, fit_curve
|
from pylot.core.util.utils import common_range, fit_curve
|
||||||
|
from scipy import integrate, signal
|
||||||
|
from scipy.optimize import curve_fit
|
||||||
|
|
||||||
|
|
||||||
def richter_magnitude_scaling(delta):
|
def richter_magnitude_scaling(delta):
|
||||||
distance = np.array([0, 10, 20, 25, 30, 35, 40, 45, 50, 60, 70, 75, 85, 90, 100, 110,
|
distance = np.array([0, 10, 20, 25, 30, 35, 40, 45, 50, 60, 70, 75, 85, 90, 100, 110,
|
||||||
@ -276,7 +276,8 @@ class LocalMagnitude(Magnitude):
|
|||||||
a0 = a0 * 1e03 # mm to nm (see Havskov & Ottemöller, 2010)
|
a0 = a0 * 1e03 # mm to nm (see Havskov & Ottemöller, 2010)
|
||||||
magnitude = ope.StationMagnitude(mag=np.log10(a0) \
|
magnitude = ope.StationMagnitude(mag=np.log10(a0) \
|
||||||
+ self.wascaling[0] * np.log10(delta) + self.wascaling[1]
|
+ self.wascaling[0] * np.log10(delta) + self.wascaling[1]
|
||||||
* delta + self.wascaling[2])
|
* delta + self.wascaling[
|
||||||
|
2])
|
||||||
magnitude.origin_id = self.origin_id
|
magnitude.origin_id = self.origin_id
|
||||||
magnitude.waveform_id = pick.waveform_id
|
magnitude.waveform_id = pick.waveform_id
|
||||||
magnitude.amplitude_id = amplitude.resource_id
|
magnitude.amplitude_id = amplitude.resource_id
|
||||||
|
@ -12,6 +12,7 @@ from obspy.core import Stream
|
|||||||
from pylot.core.pick.utils import getsignalwin
|
from pylot.core.pick.utils import getsignalwin
|
||||||
from scipy.optimize import curve_fit
|
from scipy.optimize import curve_fit
|
||||||
|
|
||||||
|
|
||||||
class Magnitude(object):
|
class Magnitude(object):
|
||||||
'''
|
'''
|
||||||
Superclass for calculating Wood-Anderson peak-to-peak
|
Superclass for calculating Wood-Anderson peak-to-peak
|
||||||
@ -45,7 +46,6 @@ class Magnitude(object):
|
|||||||
self.calcwapp()
|
self.calcwapp()
|
||||||
self.calcsourcespec()
|
self.calcsourcespec()
|
||||||
|
|
||||||
|
|
||||||
def getwfstream(self):
|
def getwfstream(self):
|
||||||
return self.wfstream
|
return self.wfstream
|
||||||
|
|
||||||
@ -85,6 +85,7 @@ class Magnitude(object):
|
|||||||
def calcsourcespec(self):
|
def calcsourcespec(self):
|
||||||
self.sourcespek = None
|
self.sourcespek = None
|
||||||
|
|
||||||
|
|
||||||
class WApp(Magnitude):
|
class WApp(Magnitude):
|
||||||
'''
|
'''
|
||||||
Method to derive peak-to-peak amplitude as seen on a Wood-Anderson-
|
Method to derive peak-to-peak amplitude as seen on a Wood-Anderson-
|
||||||
@ -188,14 +189,12 @@ class DCfc(Magnitude):
|
|||||||
print("DCfc: Determined DC-value: %e m/Hz, \n" \
|
print("DCfc: Determined DC-value: %e m/Hz, \n" \
|
||||||
"Determined corner frequency: %f Hz" % (self.w0, self.fc))
|
"Determined corner frequency: %f Hz" % (self.w0, self.fc))
|
||||||
|
|
||||||
|
|
||||||
# if self.getiplot() > 1:
|
# if self.getiplot() > 1:
|
||||||
iplot = 2
|
iplot = 2
|
||||||
if iplot > 1:
|
if iplot > 1:
|
||||||
print("DCfc: Determined DC-value: %e m/Hz, \n"
|
print("DCfc: Determined DC-value: %e m/Hz, \n"
|
||||||
"Determined corner frequency: %f Hz" % (self.w0, self.fc))
|
"Determined corner frequency: %f Hz" % (self.w0, self.fc))
|
||||||
|
|
||||||
|
|
||||||
if self.getiplot() > 1:
|
if self.getiplot() > 1:
|
||||||
f1 = plt.figure()
|
f1 = plt.figure()
|
||||||
plt.subplot(2, 1, 1)
|
plt.subplot(2, 1, 1)
|
||||||
@ -239,4 +238,3 @@ def synthsourcespec(f, omega0, fcorner):
|
|||||||
ssp = omega0 / (1 + pow(2, (f / fcorner)))
|
ssp = omega0 / (1 + pow(2, (f / fcorner)))
|
||||||
|
|
||||||
return ssp
|
return ssp
|
||||||
|
|
||||||
|
@ -3,15 +3,17 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from obspy import read_events
|
from obspy import read_events
|
||||||
from obspy.core import read, Stream, UTCDateTime
|
from obspy.core import read, Stream, UTCDateTime
|
||||||
from obspy.io.sac import SacIOError
|
|
||||||
from obspy.core.event import Event as ObsPyEvent
|
from obspy.core.event import Event as ObsPyEvent
|
||||||
|
from obspy.io.sac import SacIOError
|
||||||
from pylot.core.io.phases import readPILOTEvent, picks_from_picksdict, \
|
from pylot.core.io.phases import readPILOTEvent, picks_from_picksdict, \
|
||||||
picksdict_from_pilot, merge_picks
|
picksdict_from_pilot, merge_picks
|
||||||
from pylot.core.util.errors import FormatError, OverwriteError
|
from pylot.core.util.errors import FormatError, OverwriteError
|
||||||
from pylot.core.util.utils import fnConstructor, full_range
|
|
||||||
from pylot.core.util.event import Event
|
from pylot.core.util.event import Event
|
||||||
|
from pylot.core.util.utils import fnConstructor, full_range
|
||||||
|
|
||||||
|
|
||||||
class Data(object):
|
class Data(object):
|
||||||
"""
|
"""
|
||||||
@ -273,7 +275,6 @@ class Data(object):
|
|||||||
del evtdata_copy.picks[i]
|
del evtdata_copy.picks[i]
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
if fnext == '.obs':
|
if fnext == '.obs':
|
||||||
try:
|
try:
|
||||||
evtdata_copy.write(fnout + fnext, format=evtformat)
|
evtdata_copy.write(fnout + fnext, format=evtformat)
|
||||||
@ -297,7 +298,6 @@ class Data(object):
|
|||||||
raise KeyError('''{0} export format
|
raise KeyError('''{0} export format
|
||||||
not implemented: {1}'''.format(evtformat, e))
|
not implemented: {1}'''.format(evtformat, e))
|
||||||
|
|
||||||
|
|
||||||
def getComp(self):
|
def getComp(self):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -449,7 +449,6 @@ class Data(object):
|
|||||||
# ID.convertIDToQuakeMLURI(authority_id=authority_id)
|
# ID.convertIDToQuakeMLURI(authority_id=authority_id)
|
||||||
# self.get_evt_data().resource_id = ID
|
# self.get_evt_data().resource_id = ID
|
||||||
|
|
||||||
|
|
||||||
def applyEvent(event):
|
def applyEvent(event):
|
||||||
"""
|
"""
|
||||||
takes an `obspy.core.event.Event` object and applies all new
|
takes an `obspy.core.event.Event` object and applies all new
|
||||||
@ -478,7 +477,6 @@ class Data(object):
|
|||||||
self._new = False
|
self._new = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GenericDataStructure(object):
|
class GenericDataStructure(object):
|
||||||
"""
|
"""
|
||||||
GenericDataBase type holds all information about the current data-
|
GenericDataBase type holds all information about the current data-
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from pylot.core.util.errors import ParameterError
|
|
||||||
from pylot.core.io import default_parameters
|
from pylot.core.io import default_parameters
|
||||||
|
from pylot.core.util.errors import ParameterError
|
||||||
|
|
||||||
|
|
||||||
class PylotParameter(object):
|
class PylotParameter(object):
|
||||||
'''
|
'''
|
||||||
|
@ -2,22 +2,23 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import obspy.core.event as ope
|
|
||||||
from obspy.core.event import read_events
|
|
||||||
import os
|
import os
|
||||||
import scipy.io as sio
|
import warnings
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import warnings
|
import obspy.core.event as ope
|
||||||
|
import scipy.io as sio
|
||||||
from obspy.core import UTCDateTime
|
from obspy.core import UTCDateTime
|
||||||
|
from obspy.core.event import read_events
|
||||||
from obspy.core.util import AttribDict
|
from obspy.core.util import AttribDict
|
||||||
|
|
||||||
from pylot.core.io.inputs import PylotParameter
|
from pylot.core.io.inputs import PylotParameter
|
||||||
from pylot.core.io.location import create_arrival, create_event, \
|
from pylot.core.io.location import create_event, \
|
||||||
create_magnitude, create_origin, create_pick
|
create_magnitude
|
||||||
from pylot.core.pick.utils import select_for_phase
|
from pylot.core.pick.utils import select_for_phase
|
||||||
from pylot.core.util.utils import getOwner, full_range, four_digits
|
from pylot.core.util.utils import getOwner, full_range, four_digits
|
||||||
|
|
||||||
|
|
||||||
def add_amplitudes(event, amplitudes):
|
def add_amplitudes(event, amplitudes):
|
||||||
amplitude_list = []
|
amplitude_list = []
|
||||||
for pick in event.picks:
|
for pick in event.picks:
|
||||||
@ -36,6 +37,7 @@ def add_amplitudes(event, amplitudes):
|
|||||||
event.amplitudes = amplitude_list
|
event.amplitudes = amplitude_list
|
||||||
return event
|
return event
|
||||||
|
|
||||||
|
|
||||||
def readPILOTEvent(phasfn=None, locfn=None, authority_id='RUB', **kwargs):
|
def readPILOTEvent(phasfn=None, locfn=None, authority_id='RUB', **kwargs):
|
||||||
"""
|
"""
|
||||||
readPILOTEvent - function
|
readPILOTEvent - function
|
||||||
@ -233,6 +235,7 @@ def picksdict_from_picks(evt):
|
|||||||
picks[station] = onsets.copy()
|
picks[station] = onsets.copy()
|
||||||
return picks
|
return picks
|
||||||
|
|
||||||
|
|
||||||
def picks_from_picksdict(picks, creation_info=None):
|
def picks_from_picksdict(picks, creation_info=None):
|
||||||
picks_list = list()
|
picks_list = list()
|
||||||
for station, onsets in picks.items():
|
for station, onsets in picks.items():
|
||||||
@ -297,7 +300,6 @@ def reassess_pilot_db(root_dir, db_dir, out_dir=None, fn_param=None, verbosity=0
|
|||||||
reassess_pilot_event(root_dir, db_dir, evt, out_dir, fn_param, verbosity)
|
reassess_pilot_event(root_dir, db_dir, evt, out_dir, fn_param, verbosity)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def reassess_pilot_event(root_dir, db_dir, event_id, out_dir=None, fn_param=None, verbosity=0):
|
def reassess_pilot_event(root_dir, db_dir, event_id, out_dir=None, fn_param=None, verbosity=0):
|
||||||
from obspy import read
|
from obspy import read
|
||||||
|
|
||||||
@ -305,7 +307,6 @@ def reassess_pilot_event(root_dir, db_dir, event_id, out_dir=None, fn_param=None
|
|||||||
from pylot.core.pick.utils import earllatepicker
|
from pylot.core.pick.utils import earllatepicker
|
||||||
|
|
||||||
if fn_param is None:
|
if fn_param is None:
|
||||||
import pylot.core.util.defaults as defaults
|
|
||||||
fn_param = defaults.AUTOMATIC_DEFAULTS
|
fn_param = defaults.AUTOMATIC_DEFAULTS
|
||||||
|
|
||||||
default = PylotParameter(fn_param, verbosity)
|
default = PylotParameter(fn_param, verbosity)
|
||||||
@ -339,7 +340,8 @@ def reassess_pilot_event(root_dir, db_dir, event_id, out_dir=None, fn_param=None
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
if 'No file matching file pattern:' in e.message:
|
if 'No file matching file pattern:' in e.message:
|
||||||
if verbosity > 0:
|
if verbosity > 0:
|
||||||
warnings.warn('no waveform data found for station {station}'.format(station=station), RuntimeWarning)
|
warnings.warn('no waveform data found for station {station}'.format(station=station),
|
||||||
|
RuntimeWarning)
|
||||||
datacheck.append(fn_pattern + ' (no data)\n')
|
datacheck.append(fn_pattern + ' (no data)\n')
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
@ -707,8 +709,11 @@ def writephases(arrivals, fformat, filename, parameter, eventinfo=None):
|
|||||||
stime = eventsource['time']
|
stime = eventsource['time']
|
||||||
# write header line including event information
|
# write header line including event information
|
||||||
fid.write('%s %d%02d%02d%02d%02d%02.0f %7.4f %6.4f %3.1f %3.1f\n' % (parameter.get('eventID'),
|
fid.write('%s %d%02d%02d%02d%02d%02.0f %7.4f %6.4f %3.1f %3.1f\n' % (parameter.get('eventID'),
|
||||||
stime.year, stime.month, stime.day, stime.hour, stime.minute, stime.second,
|
stime.year, stime.month, stime.day,
|
||||||
eventsource['latitude'], eventsource['longitude'], eventsource['depth'] / 1000,
|
stime.hour, stime.minute, stime.second,
|
||||||
|
eventsource['latitude'],
|
||||||
|
eventsource['longitude'],
|
||||||
|
eventsource['depth'] / 1000,
|
||||||
eventinfo.magnitudes[0]['mag']))
|
eventinfo.magnitudes[0]['mag']))
|
||||||
picks = eventinfo.picks
|
picks = eventinfo.picks
|
||||||
for key in arrivals:
|
for key in arrivals:
|
||||||
@ -766,13 +771,19 @@ def writephases(arrivals, fformat, filename, parameter, eventinfo=None):
|
|||||||
# write header line including event information
|
# write header line including event information
|
||||||
# for HASH-driver 1
|
# for HASH-driver 1
|
||||||
fid1.write('%s%02d%02d%02d%02d%5.2f%2dN%5.2f%3dE%5.2f%6.3f%4.2f%5.2f%5.2f%s\n' % (syear,
|
fid1.write('%s%02d%02d%02d%02d%5.2f%2dN%5.2f%3dE%5.2f%6.3f%4.2f%5.2f%5.2f%s\n' % (syear,
|
||||||
stime.month, stime.day, stime.hour, stime.minute, stime.second,
|
stime.month, stime.day,
|
||||||
latdeg, latmin, londeg, lonmin, eventsource['depth'],
|
stime.hour, stime.minute,
|
||||||
eventinfo.magnitudes[0]['mag'], erh, erz,
|
stime.second,
|
||||||
|
latdeg, latmin, londeg,
|
||||||
|
lonmin, eventsource['depth'],
|
||||||
|
eventinfo.magnitudes[0][
|
||||||
|
'mag'], erh, erz,
|
||||||
hashID))
|
hashID))
|
||||||
# write header line including event information
|
# write header line including event information
|
||||||
# for HASH-driver 2
|
# for HASH-driver 2
|
||||||
fid2.write('%d%02d%02d%02d%02d%5.2f%dN%5.2f%3dE%6.2f%5.2f %d %5.2f %5.2f %4.2f %s \n' % (syear, stime.month, stime.day,
|
fid2.write(
|
||||||
|
'%d%02d%02d%02d%02d%5.2f%dN%5.2f%3dE%6.2f%5.2f %d %5.2f %5.2f %4.2f %s \n' % (
|
||||||
|
syear, stime.month, stime.day,
|
||||||
stime.hour, stime.minute, stime.second,
|
stime.hour, stime.minute, stime.second,
|
||||||
latdeg, latmin, londeg, lonmin,
|
latdeg, latmin, londeg, lonmin,
|
||||||
eventsource['depth'],
|
eventsource['depth'],
|
||||||
@ -809,7 +820,9 @@ def writephases(arrivals, fformat, filename, parameter, eventinfo=None):
|
|||||||
inz = eventinfo.origins[0].arrivals[j].get('takeoff_angle')
|
inz = eventinfo.origins[0].arrivals[j].get('takeoff_angle')
|
||||||
dist = eventinfo.origins[0].arrivals[j].get('distance')
|
dist = eventinfo.origins[0].arrivals[j].get('distance')
|
||||||
# write phase line for HASH-driver 1
|
# write phase line for HASH-driver 1
|
||||||
fid1.write('%-4s%sP%s%d 0 %3.1f %03d %03d 2 1 %s\n' % (stat, Pqual, arrivals[key]['P']['fm'], arrivals[key]['P']['weight'],
|
fid1.write(
|
||||||
|
'%-4s%sP%s%d 0 %3.1f %03d %03d 2 1 %s\n' % (
|
||||||
|
stat, Pqual, arrivals[key]['P']['fm'], arrivals[key]['P']['weight'],
|
||||||
dist, inz, az, ccode))
|
dist, inz, az, ccode))
|
||||||
# write phase line for HASH-driver 2
|
# write phase line for HASH-driver 2
|
||||||
fid2.write('%-4s %s %s %s %s \n' % (
|
fid2.write('%-4s %s %s %s %s \n' % (
|
||||||
@ -849,6 +862,7 @@ def merge_picks(event, picks):
|
|||||||
del time, err, phase, station, network, method
|
del time, err, phase, station, network, method
|
||||||
return event
|
return event
|
||||||
|
|
||||||
|
|
||||||
def getQualitiesfromxml(xmlnames, ErrorsP, ErrorsS, plotflag=1):
|
def getQualitiesfromxml(xmlnames, ErrorsP, ErrorsS, plotflag=1):
|
||||||
"""
|
"""
|
||||||
Script to get onset uncertainties from Quakeml.xml files created by PyLoT.
|
Script to get onset uncertainties from Quakeml.xml files created by PyLoT.
|
||||||
@ -994,4 +1008,3 @@ def getQualitiesfromxml(xmlnames, ErrorsP, ErrorsS, plotflag=1):
|
|||||||
plt.xlabel('Qualities')
|
plt.xlabel('Qualities')
|
||||||
plt.title('{0} P-Qualities, {1} S-Qualities'.format(numPweights, numSweights))
|
plt.title('{0} P-Qualities, {1} S-Qualities'.format(numPweights, numSweights))
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ from pylot.core.util.version import get_git_version as _getVersionString
|
|||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
|
|
||||||
|
|
||||||
def export(picks, fnout, parameter, eventinfo):
|
def export(picks, fnout, parameter, eventinfo):
|
||||||
'''
|
'''
|
||||||
Take <picks> dictionary and exports picking data to a focmec
|
Take <picks> dictionary and exports picking data to a focmec
|
||||||
|
@ -6,6 +6,7 @@ from pylot.core.util.version import get_git_version as _getVersionString
|
|||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
|
|
||||||
|
|
||||||
def export(picks, fnout, parameter, eventinfo):
|
def export(picks, fnout, parameter, eventinfo):
|
||||||
'''
|
'''
|
||||||
Take <picks> dictionary and exports picking data to a HASH
|
Take <picks> dictionary and exports picking data to a HASH
|
||||||
|
@ -6,6 +6,7 @@ from pylot.core.util.version import get_git_version as _getVersionString
|
|||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
|
|
||||||
|
|
||||||
def export(picks, fnout, parameter):
|
def export(picks, fnout, parameter):
|
||||||
'''
|
'''
|
||||||
Take <picks> dictionary and exports picking data to a HYPO71
|
Take <picks> dictionary and exports picking data to a HYPO71
|
||||||
|
@ -6,6 +6,7 @@ from pylot.core.util.version import get_git_version as _getVersionString
|
|||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
|
|
||||||
|
|
||||||
def export(picks, fnout, parameter, eventinfo):
|
def export(picks, fnout, parameter, eventinfo):
|
||||||
'''
|
'''
|
||||||
Take <picks> dictionary and exports picking data to a hypoDD
|
Take <picks> dictionary and exports picking data to a hypoDD
|
||||||
|
@ -6,6 +6,7 @@ from pylot.core.util.version import get_git_version as _getVersionString
|
|||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
|
|
||||||
|
|
||||||
def export(picks, fnout, parameter):
|
def export(picks, fnout, parameter):
|
||||||
'''
|
'''
|
||||||
Take <picks> dictionary and exports picking data to a HYPOSAT
|
Take <picks> dictionary and exports picking data to a HYPOSAT
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
import glob
|
import glob
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from obspy import read_events
|
from obspy import read_events
|
||||||
from pylot.core.io.phases import writephases
|
from pylot.core.io.phases import writephases
|
||||||
from pylot.core.util.utils import getPatternLine, runProgram, which
|
from pylot.core.util.utils import getPatternLine, runProgram, which
|
||||||
@ -11,9 +12,11 @@ from pylot.core.util.version import get_git_version as _getVersionString
|
|||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
|
|
||||||
|
|
||||||
class NLLocError(EnvironmentError):
|
class NLLocError(EnvironmentError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def export(picks, fnout, parameter):
|
def export(picks, fnout, parameter):
|
||||||
'''
|
'''
|
||||||
Take <picks> dictionary and exports picking data to a NLLOC-obs
|
Take <picks> dictionary and exports picking data to a NLLOC-obs
|
||||||
|
@ -6,6 +6,7 @@ from pylot.core.util.version import get_git_version as _getVersionString
|
|||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
|
|
||||||
|
|
||||||
def export(picks, fnout, parameter, eventinfo):
|
def export(picks, fnout, parameter, eventinfo):
|
||||||
'''
|
'''
|
||||||
Take <picks> dictionary and exports picking data to a VELEST-cnv
|
Take <picks> dictionary and exports picking data to a VELEST-cnv
|
||||||
|
@ -11,14 +11,14 @@ function conglomerate utils.
|
|||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from pylot.core.io.data import Data
|
||||||
from pylot.core.io.inputs import PylotParameter
|
from pylot.core.io.inputs import PylotParameter
|
||||||
from pylot.core.pick.picker import AICPicker, PragPicker
|
|
||||||
from pylot.core.pick.charfuns import CharacteristicFunction
|
from pylot.core.pick.charfuns import CharacteristicFunction
|
||||||
from pylot.core.pick.charfuns import HOScf, AICcf, ARZcf, ARHcf, AR3Ccf
|
from pylot.core.pick.charfuns import HOScf, AICcf, ARZcf, ARHcf, AR3Ccf
|
||||||
|
from pylot.core.pick.picker import AICPicker, PragPicker
|
||||||
from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \
|
from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \
|
||||||
getSNR, fmpicker, checkPonsets, wadaticheck
|
getSNR, fmpicker, checkPonsets, wadaticheck
|
||||||
from pylot.core.util.utils import getPatternLine, gen_Pool
|
from pylot.core.util.utils import getPatternLine, gen_Pool
|
||||||
from pylot.core.io.data import Data
|
|
||||||
|
|
||||||
|
|
||||||
def autopickevent(data, param, iplot=0, fig_dict=None):
|
def autopickevent(data, param, iplot=0, fig_dict=None):
|
||||||
|
@ -17,7 +17,6 @@ autoregressive prediction: application ot local and regional distances, Geophys.
|
|||||||
:author: MAGS2 EP3 working group
|
:author: MAGS2 EP3 working group
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from obspy.core import Stream
|
from obspy.core import Stream
|
||||||
|
|
||||||
|
@ -4,11 +4,10 @@
|
|||||||
import copy
|
import copy
|
||||||
import operator
|
import operator
|
||||||
import os
|
import os
|
||||||
import numpy as np
|
|
||||||
import glob
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
from obspy import read_events
|
|
||||||
|
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
from obspy import read_events
|
||||||
from pylot.core.io.phases import picksdict_from_picks
|
from pylot.core.io.phases import picksdict_from_picks
|
||||||
from pylot.core.util.pdf import ProbabilityDensityFunction
|
from pylot.core.util.pdf import ProbabilityDensityFunction
|
||||||
from pylot.core.util.utils import find_in_list
|
from pylot.core.util.utils import find_in_list
|
||||||
@ -352,7 +351,6 @@ class PDFstatistics(object):
|
|||||||
Takes a path as argument.
|
Takes a path as argument.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, directory):
|
def __init__(self, directory):
|
||||||
"""Initiates some values needed when dealing with pdfs later"""
|
"""Initiates some values needed when dealing with pdfs later"""
|
||||||
self._rootdir = directory
|
self._rootdir = directory
|
||||||
|
@ -19,12 +19,13 @@ calculated after Diehl & Kissling (2009).
|
|||||||
:author: MAGS2 EP3 working group / Ludger Kueperkoch
|
:author: MAGS2 EP3 working group / Ludger Kueperkoch
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
from pylot.core.pick.utils import getnoisewin, getsignalwin
|
|
||||||
from pylot.core.pick.charfuns import CharacteristicFunction
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
from pylot.core.pick.charfuns import CharacteristicFunction
|
||||||
|
from pylot.core.pick.utils import getnoisewin, getsignalwin
|
||||||
|
|
||||||
|
|
||||||
class AutoPicker(object):
|
class AutoPicker(object):
|
||||||
'''
|
'''
|
||||||
@ -288,12 +289,16 @@ class AICPicker(AutoPicker):
|
|||||||
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
|
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
|
||||||
ax2.plot(self.Tcf, x, 'k', label='Data')
|
ax2.plot(self.Tcf, x, 'k', label='Data')
|
||||||
ax1.axvspan(self.Tcf[inoise[0]], self.Tcf[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
|
ax1.axvspan(self.Tcf[inoise[0]], self.Tcf[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
|
||||||
ax1.axvspan(self.Tcf[isignal[0]],self.Tcf[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window')
|
ax1.axvspan(self.Tcf[isignal[0]], self.Tcf[isignal[-1]], color='b', alpha=0.2, lw=0,
|
||||||
ax1.axvspan(self.Tcf[iislope[0]],self.Tcf[iislope[-1]], color='g', alpha=0.2, lw=0, label='Slope Window')
|
label='Signal Window')
|
||||||
|
ax1.axvspan(self.Tcf[iislope[0]], self.Tcf[iislope[-1]], color='g', alpha=0.2, lw=0,
|
||||||
|
label='Slope Window')
|
||||||
|
|
||||||
ax2.axvspan(self.Tcf[inoise[0]], self.Tcf[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
|
ax2.axvspan(self.Tcf[inoise[0]], self.Tcf[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
|
||||||
ax2.axvspan(self.Tcf[isignal[0]],self.Tcf[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window')
|
ax2.axvspan(self.Tcf[isignal[0]], self.Tcf[isignal[-1]], color='b', alpha=0.2, lw=0,
|
||||||
ax2.axvspan(self.Tcf[iislope[0]],self.Tcf[iislope[-1]], color='g', alpha=0.2, lw=0, label='Slope Window')
|
label='Signal Window')
|
||||||
|
ax2.axvspan(self.Tcf[iislope[0]], self.Tcf[iislope[-1]], color='g', alpha=0.2, lw=0,
|
||||||
|
label='Slope Window')
|
||||||
ax2.plot(self.Tcf[iislope], datafit, 'g', linewidth=2, label='Slope')
|
ax2.plot(self.Tcf[iislope], datafit, 'g', linewidth=2, label='Slope')
|
||||||
|
|
||||||
ax1.set_title('Station %s, SNR=%7.2f, Slope= %12.2f counts/s' % (self.Data[0].stats.station,
|
ax1.set_title('Station %s, SNR=%7.2f, Slope= %12.2f counts/s' % (self.Data[0].stats.station,
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from obspy.core import Stream, UTCDateTime
|
from obspy.core import Stream, UTCDateTime
|
||||||
@ -645,12 +646,14 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
|
|
||||||
return checkedonsets
|
return checkedonsets
|
||||||
|
|
||||||
|
|
||||||
def RMS(X):
|
def RMS(X):
|
||||||
'''
|
'''
|
||||||
Function returns root mean square of a given array X
|
Function returns root mean square of a given array X
|
||||||
'''
|
'''
|
||||||
return np.sqrt(np.sum(np.power(X, 2)) / len(X))
|
return np.sqrt(np.sum(np.power(X, 2)) / len(X))
|
||||||
|
|
||||||
|
|
||||||
def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fig=None):
|
def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fig=None):
|
||||||
'''
|
'''
|
||||||
Function to detect spuriously picked noise peaks.
|
Function to detect spuriously picked noise peaks.
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
|
|
||||||
:author: Ludger Kueperkoch / MAGS2 EP3 working group
|
:author: Ludger Kueperkoch / MAGS2 EP3 working group
|
||||||
"""
|
"""
|
||||||
import pdb
|
|
||||||
import numpy as np
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
from obspy.core import Stream, UTCDateTime
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
from obspy.core import Stream, UTCDateTime
|
||||||
|
|
||||||
|
|
||||||
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, stealthMode=False):
|
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, stealthMode=False):
|
||||||
'''
|
'''
|
||||||
@ -45,7 +45,8 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, stealthMode = False):
|
|||||||
EPick = None
|
EPick = None
|
||||||
PickError = None
|
PickError = None
|
||||||
if stealthMode is False:
|
if stealthMode is False:
|
||||||
print 'earllatepicker: Get earliest and latest possible pick relative to most likely pick ...'
|
print
|
||||||
|
'earllatepicker: Get earliest and latest possible pick relative to most likely pick ...'
|
||||||
|
|
||||||
x = X[0].data
|
x = X[0].data
|
||||||
t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate,
|
t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate,
|
||||||
@ -70,7 +71,8 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, stealthMode = False):
|
|||||||
|
|
||||||
# get earliest possible pick
|
# get earliest possible pick
|
||||||
|
|
||||||
EPick = np.nan; count = 0
|
EPick = np.nan;
|
||||||
|
count = 0
|
||||||
pis = isignal
|
pis = isignal
|
||||||
|
|
||||||
# if EPick stays NaN the signal window size will be doubled
|
# if EPick stays NaN the signal window size will be doubled
|
||||||
@ -97,7 +99,6 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, stealthMode = False):
|
|||||||
# T0/4 is assumed as time difference between most likely and earliest possible pick!
|
# T0/4 is assumed as time difference between most likely and earliest possible pick!
|
||||||
EPick = Pick1 - T0 / 2
|
EPick = Pick1 - T0 / 2
|
||||||
|
|
||||||
|
|
||||||
# get symmetric pick error as mean from earliest and latest possible pick
|
# get symmetric pick error as mean from earliest and latest possible pick
|
||||||
# by weighting latest possible pick two times earliest possible pick
|
# by weighting latest possible pick two times earliest possible pick
|
||||||
diffti_tl = LPick - Pick1
|
diffti_tl = LPick - Pick1
|
||||||
@ -496,7 +497,6 @@ def wadaticheck(pickdic, dttolerance, iplot):
|
|||||||
Spicks.append(UTCSpick.timestamp)
|
Spicks.append(UTCSpick.timestamp)
|
||||||
SPtimes.append(spt)
|
SPtimes.append(spt)
|
||||||
|
|
||||||
|
|
||||||
if len(SPtimes) >= 3:
|
if len(SPtimes) >= 3:
|
||||||
# calculate slope
|
# calculate slope
|
||||||
p1 = np.polyfit(Ppicks, SPtimes, 1)
|
p1 = np.polyfit(Ppicks, SPtimes, 1)
|
||||||
@ -876,7 +876,6 @@ def checkZ4S(X, pick, zfac, checkwin, iplot):
|
|||||||
if len(ndat) == 0: # check for other components
|
if len(ndat) == 0: # check for other components
|
||||||
ndat = X.select(component="1")
|
ndat = X.select(component="1")
|
||||||
|
|
||||||
|
|
||||||
z = zdat[0].data
|
z = zdat[0].data
|
||||||
tz = np.arange(0, zdat[0].stats.npts / zdat[0].stats.sampling_rate,
|
tz = np.arange(0, zdat[0].stats.npts / zdat[0].stats.sampling_rate,
|
||||||
zdat[0].stats.delta)
|
zdat[0].stats.delta)
|
||||||
@ -955,7 +954,6 @@ def writephases(arrivals, fformat, filename):
|
|||||||
:type: string
|
:type: string
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
if fformat == 'NLLoc':
|
if fformat == 'NLLoc':
|
||||||
print("Writing phases to %s for NLLoc" % filename)
|
print("Writing phases to %s for NLLoc" % filename)
|
||||||
fid = open("%s" % filename, 'w')
|
fid = open("%s" % filename, 'w')
|
||||||
@ -994,9 +992,7 @@ def writephases(arrivals, fformat, filename):
|
|||||||
fid.close()
|
fid.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import doctest
|
import doctest
|
||||||
|
|
||||||
doctest.testmod()
|
doctest.testmod()
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
|
||||||
import glob
|
import glob
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from obspy import UTCDateTime, read_inventory, read
|
from obspy import UTCDateTime, read_inventory, read
|
||||||
from obspy.io.xseed import Parser
|
from obspy.io.xseed import Parser
|
||||||
from pylot.core.util.utils import key_for_set_value, find_in_list, \
|
from pylot.core.util.utils import key_for_set_value, find_in_list, \
|
||||||
|
@ -9,17 +9,19 @@ Created on Wed Feb 26 12:31:25 2014
|
|||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
from pylot.core.loc import nll
|
from pylot.core.io.inputs import PylotParameter
|
||||||
from pylot.core.loc import hyposat
|
|
||||||
from pylot.core.loc import hypo71
|
from pylot.core.loc import hypo71
|
||||||
from pylot.core.loc import hypodd
|
from pylot.core.loc import hypodd
|
||||||
|
from pylot.core.loc import hyposat
|
||||||
|
from pylot.core.loc import nll
|
||||||
from pylot.core.loc import velest
|
from pylot.core.loc import velest
|
||||||
from pylot.core.io.inputs import PylotParameter
|
|
||||||
|
|
||||||
def readDefaultFilterInformation(fname):
|
def readDefaultFilterInformation(fname):
|
||||||
pparam = PylotParameter(fname)
|
pparam = PylotParameter(fname)
|
||||||
return readFilterInformation(pparam)
|
return readFilterInformation(pparam)
|
||||||
|
|
||||||
|
|
||||||
def readFilterInformation(pylot_parameter):
|
def readFilterInformation(pylot_parameter):
|
||||||
p_filter = {'filtertype': pylot_parameter['filter_type'][0],
|
p_filter = {'filtertype': pylot_parameter['filter_type'][0],
|
||||||
'freq': [pylot_parameter['minfreq'][0], pylot_parameter['maxfreq'][0]],
|
'freq': [pylot_parameter['minfreq'][0], pylot_parameter['maxfreq'][0]],
|
||||||
@ -31,6 +33,7 @@ def readFilterInformation(pylot_parameter):
|
|||||||
'S': s_filter}
|
'S': s_filter}
|
||||||
return filter_information
|
return filter_information
|
||||||
|
|
||||||
|
|
||||||
# determine system dependent path separator
|
# determine system dependent path separator
|
||||||
system_name = platform.system()
|
system_name = platform.system()
|
||||||
if system_name in ["Linux", "Darwin"]:
|
if system_name in ["Linux", "Darwin"]:
|
||||||
@ -107,4 +110,3 @@ class SetChannelComponents(object):
|
|||||||
else:
|
else:
|
||||||
errMsg = 'getCompPosition: Unrecognized component {}. Expecting one of {} or {}.'
|
errMsg = 'getCompPosition: Unrecognized component {}. Expecting one of {} or {}.'
|
||||||
raise ValueError(errMsg.format(component, self.compPosition_Map.keys(), self.compName_Map.keys()))
|
raise ValueError(errMsg.format(component, self.compPosition_Map.keys(), self.compName_Map.keys()))
|
||||||
|
|
||||||
|
@ -25,5 +25,6 @@ class OverwriteError(IOError):
|
|||||||
class ParameterError(Exception):
|
class ParameterError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ProcessingError(RuntimeError):
|
class ProcessingError(RuntimeError):
|
||||||
pass
|
pass
|
||||||
|
@ -6,7 +6,6 @@ import os
|
|||||||
from obspy import UTCDateTime
|
from obspy import UTCDateTime
|
||||||
from obspy.core.event import Event as ObsPyEvent
|
from obspy.core.event import Event as ObsPyEvent
|
||||||
from obspy.core.event import Origin, ResourceIdentifier
|
from obspy.core.event import Origin, ResourceIdentifier
|
||||||
|
|
||||||
from pylot.core.io.phases import picks_from_picksdict
|
from pylot.core.io.phases import picks_from_picksdict
|
||||||
|
|
||||||
|
|
||||||
@ -14,6 +13,7 @@ class Event(ObsPyEvent):
|
|||||||
'''
|
'''
|
||||||
Pickable class derived from ~obspy.core.event.Event containing information on a single event.
|
Pickable class derived from ~obspy.core.event.Event containing information on a single event.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
self.pylot_id = path.split('/')[-1]
|
self.pylot_id = path.split('/')[-1]
|
||||||
# initialize super class
|
# initialize super class
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
from mpl_toolkits.basemap import Basemap
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import obspy
|
import obspy
|
||||||
from matplotlib import cm
|
from PySide import QtGui
|
||||||
from scipy.interpolate import griddata
|
|
||||||
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
|
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
|
||||||
from PySide import QtCore, QtGui
|
from mpl_toolkits.basemap import Basemap
|
||||||
|
|
||||||
from pylot.core.util.widgets import PickDlg
|
from pylot.core.util.widgets import PickDlg
|
||||||
|
from scipy.interpolate import griddata
|
||||||
|
|
||||||
plt.interactive(False)
|
plt.interactive(False)
|
||||||
|
|
||||||
|
|
||||||
class map_projection(QtGui.QWidget):
|
class map_projection(QtGui.QWidget):
|
||||||
def __init__(self, parent, figure=None):
|
def __init__(self, parent, figure=None):
|
||||||
'''
|
'''
|
||||||
@ -136,6 +135,7 @@ class map_projection(QtGui.QWidget):
|
|||||||
|
|
||||||
def init_picks(self):
|
def init_picks(self):
|
||||||
phase = self.comboBox_phase.currentText()
|
phase = self.comboBox_phase.currentText()
|
||||||
|
|
||||||
def get_picks(station_names):
|
def get_picks(station_names):
|
||||||
picks = []
|
picks = []
|
||||||
for station in station_names:
|
for station in station_names:
|
||||||
@ -235,7 +235,8 @@ class map_projection(QtGui.QWidget):
|
|||||||
|
|
||||||
def init_picksgrid(self):
|
def init_picksgrid(self):
|
||||||
self.picksgrid_no_nan = griddata((self.lat_no_nan, self.lon_no_nan),
|
self.picksgrid_no_nan = griddata((self.lat_no_nan, self.lon_no_nan),
|
||||||
self.picks_no_nan, (self.latgrid, self.longrid), method='linear') ##################
|
self.picks_no_nan, (self.latgrid, self.longrid),
|
||||||
|
method='linear') ##################
|
||||||
|
|
||||||
def draw_contour_filled(self, nlevel='50'):
|
def draw_contour_filled(self, nlevel='50'):
|
||||||
levels = np.linspace(min(self.picks_no_nan), max(self.picks_no_nan), nlevel)
|
levels = np.linspace(min(self.picks_no_nan), max(self.picks_no_nan), nlevel)
|
||||||
@ -369,5 +370,3 @@ class map_projection(QtGui.QWidget):
|
|||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Warning,
|
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Warning,
|
||||||
'Warning', message)
|
'Warning', message)
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,20 +2,23 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from obspy import UTCDateTime
|
from obspy import UTCDateTime
|
||||||
from pylot.core.util.utils import fit_curve, find_nearest, clims
|
from pylot.core.util.utils import fit_curve, clims
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
from pylot.core.util.version import get_git_version as _getVersionString
|
||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
__author__ = 'sebastianw'
|
__author__ = 'sebastianw'
|
||||||
|
|
||||||
|
|
||||||
def create_axis(x0, incr, npts):
|
def create_axis(x0, incr, npts):
|
||||||
ax = np.zeros(npts)
|
ax = np.zeros(npts)
|
||||||
for i in range(npts):
|
for i in range(npts):
|
||||||
ax[i] = x0 + incr * i
|
ax[i] = x0 + incr * i
|
||||||
return ax
|
return ax
|
||||||
|
|
||||||
|
|
||||||
def gauss_parameter(te, tm, tl, eta):
|
def gauss_parameter(te, tm, tl, eta):
|
||||||
'''
|
'''
|
||||||
takes three onset times and returns the parameters sig1, sig2, a1 and a2
|
takes three onset times and returns the parameters sig1, sig2, a1 and a2
|
||||||
@ -394,7 +397,6 @@ class ProbabilityDensityFunction(object):
|
|||||||
qu = self.quantile(1 - prob_value)
|
qu = self.quantile(1 - prob_value)
|
||||||
return qu - ql
|
return qu - ql
|
||||||
|
|
||||||
|
|
||||||
def quantile_dist_frac(self, x):
|
def quantile_dist_frac(self, x):
|
||||||
"""
|
"""
|
||||||
takes a probability value and returns the fraction of two
|
takes a probability value and returns the fraction of two
|
||||||
@ -413,7 +415,6 @@ class ProbabilityDensityFunction(object):
|
|||||||
raise ValueError('Value out of range.')
|
raise ValueError('Value out of range.')
|
||||||
return self.quantile_distance(0.5 - x) / self.quantile_distance(x)
|
return self.quantile_distance(0.5 - x) / self.quantile_distance(x)
|
||||||
|
|
||||||
|
|
||||||
def plot(self, label=None):
|
def plot(self, label=None):
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
@ -486,4 +487,3 @@ class ProbabilityDensityFunction(object):
|
|||||||
x0, npts = self.commonlimits(incr, other)
|
x0, npts = self.commonlimits(incr, other)
|
||||||
|
|
||||||
return x0, incr, npts
|
return x0, incr, npts
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
def create_bin_list(l_boundary, u_boundary, nbins=100):
|
def create_bin_list(l_boundary, u_boundary, nbins=100):
|
||||||
"""
|
"""
|
||||||
takes two boundaries and a number of bins and creates a list of bins for
|
takes two boundaries and a number of bins and creates a list of bins for
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import sys, os, traceback
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
from PySide.QtCore import QThread, Signal, Qt, Slot, QRunnable, QObject
|
from PySide.QtCore import QThread, Signal, Qt, Slot, QRunnable, QObject
|
||||||
from PySide.QtGui import QDialog, QProgressBar, QLabel, QHBoxLayout, QPushButton
|
from PySide.QtGui import QDialog, QProgressBar, QLabel, QHBoxLayout, QPushButton
|
||||||
|
|
||||||
@ -109,6 +112,7 @@ class Worker(QRunnable):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, fun, args,
|
def __init__(self, fun, args,
|
||||||
progressText=None,
|
progressText=None,
|
||||||
pb_widget=None,
|
pb_widget=None,
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import numpy as np
|
|
||||||
from scipy.interpolate import splrep, splev
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import warnings
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
from obspy import UTCDateTime, read
|
from obspy import UTCDateTime, read
|
||||||
from pylot.core.io.inputs import PylotParameter
|
from pylot.core.io.inputs import PylotParameter
|
||||||
|
from scipy.interpolate import splrep, splev
|
||||||
|
|
||||||
|
|
||||||
def _pickle_method(m):
|
def _pickle_method(m):
|
||||||
@ -19,9 +19,11 @@ def _pickle_method(m):
|
|||||||
else:
|
else:
|
||||||
return getattr, (m.im_self, m.im_func.func_name)
|
return getattr, (m.im_self, m.im_func.func_name)
|
||||||
|
|
||||||
|
|
||||||
def fit_curve(x, y):
|
def fit_curve(x, y):
|
||||||
return splev, splrep(x, y)
|
return splev, splrep(x, y)
|
||||||
|
|
||||||
|
|
||||||
def getindexbounds(f, eta):
|
def getindexbounds(f, eta):
|
||||||
mi = f.argmax()
|
mi = f.argmax()
|
||||||
m = max(f)
|
m = max(f)
|
||||||
@ -106,6 +108,7 @@ def findComboBoxIndex(combo_box, val):
|
|||||||
"""
|
"""
|
||||||
return combo_box.findText(val) if combo_box.findText(val) is not -1 else 0
|
return combo_box.findText(val) if combo_box.findText(val) is not -1 else 0
|
||||||
|
|
||||||
|
|
||||||
def find_in_list(list, str):
|
def find_in_list(list, str):
|
||||||
"""
|
"""
|
||||||
takes a list of strings and a string and returns the first list item
|
takes a list of strings and a string and returns the first list item
|
||||||
@ -135,6 +138,7 @@ def find_in_list(list, str):
|
|||||||
return rlist[0]
|
return rlist[0]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def find_nearest(array, value):
|
def find_nearest(array, value):
|
||||||
'''
|
'''
|
||||||
function find_nearest takes an array and a value and returns the
|
function find_nearest takes an array and a value and returns the
|
||||||
@ -181,12 +185,14 @@ def fnConstructor(s):
|
|||||||
fn = '_' + fn
|
fn = '_' + fn
|
||||||
return fn
|
return fn
|
||||||
|
|
||||||
|
|
||||||
def real_None(value):
|
def real_None(value):
|
||||||
if value == 'None':
|
if value == 'None':
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
def four_digits(year):
|
def four_digits(year):
|
||||||
"""
|
"""
|
||||||
takes a two digit year integer and returns the correct four digit equivalent
|
takes a two digit year integer and returns the correct four digit equivalent
|
||||||
@ -307,6 +313,7 @@ def getPatternLine(fn, pattern):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def is_executable(fn):
|
def is_executable(fn):
|
||||||
"""
|
"""
|
||||||
takes a filename and returns True if the file is executable on the system
|
takes a filename and returns True if the file is executable on the system
|
||||||
@ -492,6 +499,7 @@ def runProgram(cmd, parameter=None):
|
|||||||
|
|
||||||
subprocess.check_output('{} | tee /dev/stderr'.format(cmd), shell=True)
|
subprocess.check_output('{} | tee /dev/stderr'.format(cmd), shell=True)
|
||||||
|
|
||||||
|
|
||||||
def which(program, infile=None):
|
def which(program, infile=None):
|
||||||
"""
|
"""
|
||||||
takes a program name and returns the full path to the executable or None
|
takes a program name and returns the full path to the executable or None
|
||||||
@ -538,6 +546,7 @@ def which(program, infile=None):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import doctest
|
import doctest
|
||||||
|
|
||||||
|
@ -5,16 +5,15 @@ Created on Wed Mar 19 11:27:35 2014
|
|||||||
@author: sebastianw
|
@author: sebastianw
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import multiprocessing
|
|
||||||
import subprocess
|
|
||||||
import getpass
|
|
||||||
import warnings
|
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
|
import getpass
|
||||||
|
import multiprocessing
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
@ -33,7 +32,7 @@ from matplotlib.widgets import MultiCursor
|
|||||||
from PySide import QtCore, QtGui
|
from PySide import QtCore, QtGui
|
||||||
from PySide.QtGui import QAction, QApplication, QCheckBox, QComboBox, \
|
from PySide.QtGui import QAction, QApplication, QCheckBox, QComboBox, \
|
||||||
QDateTimeEdit, QDialog, QDialogButtonBox, QDoubleSpinBox, QGroupBox, \
|
QDateTimeEdit, QDialog, QDialogButtonBox, QDoubleSpinBox, QGroupBox, \
|
||||||
QGridLayout, QIcon, QKeySequence, QLabel, QLineEdit, QMessageBox, \
|
QGridLayout, QIcon, QLabel, QLineEdit, QMessageBox, \
|
||||||
QPixmap, QSpinBox, QTabWidget, QToolBar, QVBoxLayout, QHBoxLayout, QWidget, \
|
QPixmap, QSpinBox, QTabWidget, QToolBar, QVBoxLayout, QHBoxLayout, QWidget, \
|
||||||
QPushButton, QFileDialog, QInputDialog, QKeySequence
|
QPushButton, QFileDialog, QInputDialog, QKeySequence
|
||||||
from PySide.QtCore import QSettings, Qt, QUrl, Signal, Slot
|
from PySide.QtCore import QSettings, Qt, QUrl, Signal, Slot
|
||||||
@ -48,16 +47,16 @@ from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \
|
|||||||
getResolutionWindow
|
getResolutionWindow
|
||||||
from pylot.core.pick.compare import Comparison
|
from pylot.core.pick.compare import Comparison
|
||||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, ALTSUFFIX, \
|
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, ALTSUFFIX, \
|
||||||
LOCTOOLS, SetChannelComponents
|
SetChannelComponents
|
||||||
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
|
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
|
||||||
demeanTrace, isSorted, findComboBoxIndex, clims
|
demeanTrace, isSorted, findComboBoxIndex, clims
|
||||||
from autoPyLoT import autoPyLoT
|
from autoPyLoT import autoPyLoT
|
||||||
from pylot.core.util.thread import Thread
|
from pylot.core.util.thread import Thread
|
||||||
|
|
||||||
if sys.version_info.major == 3:
|
if sys.version_info.major == 3:
|
||||||
import icons_rc_3 as icons_rc
|
pass
|
||||||
elif sys.version_info.major == 2:
|
elif sys.version_info.major == 2:
|
||||||
import icons_rc_2 as icons_rc
|
pass
|
||||||
else:
|
else:
|
||||||
raise ImportError('Could not determine python version.')
|
raise ImportError('Could not determine python version.')
|
||||||
|
|
||||||
@ -118,6 +117,7 @@ def createAction(parent, text, slot=None, shortcut=None, icon=None,
|
|||||||
action.setCheckable(True)
|
action.setCheckable(True)
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
|
||||||
def loopIdentifyPhase(phase):
|
def loopIdentifyPhase(phase):
|
||||||
phase_copy = phase
|
phase_copy = phase
|
||||||
while not identifyPhase(phase_copy):
|
while not identifyPhase(phase_copy):
|
||||||
@ -133,6 +133,7 @@ def loopIdentifyPhase(phase):
|
|||||||
return
|
return
|
||||||
return phase_copy
|
return phase_copy
|
||||||
|
|
||||||
|
|
||||||
def identifyPhase(phase):
|
def identifyPhase(phase):
|
||||||
# common phase suffix for P and S
|
# common phase suffix for P and S
|
||||||
common_P = ['P', 'p']
|
common_P = ['P', 'p']
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys, time
|
import sys
|
||||||
|
|
||||||
from PySide.QtGui import QApplication
|
from PySide.QtGui import QApplication
|
||||||
from pylot.core.util.widgets import HelpForm
|
from pylot.core.util.widgets import HelpForm
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import matplotlib
|
import matplotlib
|
||||||
|
|
||||||
matplotlib.use('Qt4Agg')
|
matplotlib.use('Qt4Agg')
|
||||||
@ -10,7 +11,6 @@ matplotlib.rcParams['backend.qt4'] = 'PySide'
|
|||||||
from PySide.QtGui import QApplication
|
from PySide.QtGui import QApplication
|
||||||
from obspy.core import read
|
from obspy.core import read
|
||||||
from pylot.core.util.widgets import PickDlg
|
from pylot.core.util.widgets import PickDlg
|
||||||
import icons_rc
|
|
||||||
|
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys, time
|
import sys
|
||||||
|
|
||||||
from PySide.QtGui import QApplication
|
from PySide.QtGui import QApplication
|
||||||
from pylot.core.util.widgets import PropertiesDlg
|
from pylot.core.util.widgets import PropertiesDlg
|
||||||
|
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
import sys, time
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
from PySide.QtGui import QApplication
|
from PySide.QtGui import QApplication
|
||||||
from pylot.core.util.widgets import FilterOptionsDialog, PropertiesDlg, HelpForm
|
from pylot.core.util.widgets import FilterOptionsDialog, PropertiesDlg, HelpForm
|
||||||
|
|
||||||
|
@ -8,16 +8,12 @@ import unittest
|
|||||||
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def testName(self):
|
def testName(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@ import unittest
|
|||||||
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def testName(self):
|
def testName(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
Only for test purposes!
|
Only for test purposes!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import glob
|
||||||
|
|
||||||
from obspy.core import read
|
from obspy.core import read
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import numpy as np
|
|
||||||
from pylot.core.pick.charfuns import *
|
from pylot.core.pick.charfuns import *
|
||||||
from pylot.core.pick.picker import *
|
from pylot.core.pick.picker import *
|
||||||
import glob
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
def run_makeCF(project, database, event, iplot, station=None):
|
def run_makeCF(project, database, event, iplot, station=None):
|
||||||
# parameters for CF calculation
|
# parameters for CF calculation
|
||||||
@ -52,8 +52,10 @@ def run_makeCF(project, database, event, iplot, station=None):
|
|||||||
wfnfiles = glob.glob(dpn)
|
wfnfiles = glob.glob(dpn)
|
||||||
if wfzfiles:
|
if wfzfiles:
|
||||||
for i in range(len(wfzfiles)):
|
for i in range(len(wfzfiles)):
|
||||||
print 'Vertical component data found ...'
|
print
|
||||||
print wfzfiles[i]
|
'Vertical component data found ...'
|
||||||
|
print
|
||||||
|
wfzfiles[i]
|
||||||
st = read('%s' % wfzfiles[i])
|
st = read('%s' % wfzfiles[i])
|
||||||
st_copy = st.copy()
|
st_copy = st.copy()
|
||||||
# filter and taper data
|
# filter and taper data
|
||||||
@ -100,13 +102,17 @@ def run_makeCF(project, database, event, iplot, station=None):
|
|||||||
# get earliest and latest possible picks
|
# get earliest and latest possible picks
|
||||||
arzELpick = EarlLatePicker(arzcf, 1.5, TSNRarz, None, 10, None, None, arzpick.getpick())
|
arzELpick = EarlLatePicker(arzcf, 1.5, TSNRarz, None, 10, None, None, arzpick.getpick())
|
||||||
elif not wfzfiles:
|
elif not wfzfiles:
|
||||||
print 'No vertical component data found!'
|
print
|
||||||
|
'No vertical component data found!'
|
||||||
|
|
||||||
if wfefiles and wfnfiles:
|
if wfefiles and wfnfiles:
|
||||||
for i in range(len(wfefiles)):
|
for i in range(len(wfefiles)):
|
||||||
print 'Horizontal component data found ...'
|
print
|
||||||
print wfefiles[i]
|
'Horizontal component data found ...'
|
||||||
print wfnfiles[i]
|
print
|
||||||
|
wfefiles[i]
|
||||||
|
print
|
||||||
|
wfnfiles[i]
|
||||||
# merge streams
|
# merge streams
|
||||||
H = read('%s' % wfefiles[i])
|
H = read('%s' % wfefiles[i])
|
||||||
H += read('%s' % wfnfiles[i])
|
H += read('%s' % wfnfiles[i])
|
||||||
@ -195,7 +201,8 @@ def run_makeCF(project, database, event, iplot, station=None):
|
|||||||
plt.xlabel('Time [s]')
|
plt.xlabel('Time [s]')
|
||||||
plt.ylabel('Normalized Counts')
|
plt.ylabel('Normalized Counts')
|
||||||
plt.title('%s, %s, CF-SNR=%7.2f, CF-Slope=%12.2f' % (tr.stats.station, \
|
plt.title('%s, %s, CF-SNR=%7.2f, CF-Slope=%12.2f' % (tr.stats.station, \
|
||||||
tr.stats.channel, aicpick.getSNR(), aicpick.getSlope()))
|
tr.stats.channel, aicpick.getSNR(),
|
||||||
|
aicpick.getSlope()))
|
||||||
plt.suptitle(tr.stats.starttime)
|
plt.suptitle(tr.stats.starttime)
|
||||||
plt.legend([p1, p2, p3, p4, p5], ['Data', 'HOS-CF', 'HOSAIC-CF', 'ARZ-CF', 'ARZAIC-CF'])
|
plt.legend([p1, p2, p3, p4, p5], ['Data', 'HOS-CF', 'HOSAIC-CF', 'ARZ-CF', 'ARZAIC-CF'])
|
||||||
# plot horizontal traces
|
# plot horizontal traces
|
||||||
@ -291,6 +298,7 @@ def run_makeCF(project, database, event, iplot, station=None):
|
|||||||
raw_input()
|
raw_input()
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--project', type=str, help='project name (e.g. Insheim)')
|
parser.add_argument('--project', type=str, help='project name (e.g. Insheim)')
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from pylot.core.util.pdf import ProbabilityDensityFunction
|
from pylot.core.util.pdf import ProbabilityDensityFunction
|
||||||
|
|
||||||
pdf = ProbabilityDensityFunction.from_pick(0.34, 0.5, 0.54, type='exp')
|
pdf = ProbabilityDensityFunction.from_pick(0.34, 0.5, 0.54, type='exp')
|
||||||
pdf2 = ProbabilityDensityFunction.from_pick(0.34, 0.5, 0.54, type='exp')
|
pdf2 = ProbabilityDensityFunction.from_pick(0.34, 0.5, 0.54, type='exp')
|
||||||
diff = pdf - pdf2
|
diff = pdf - pdf2
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
from pylot.core.pick.utils import getnoisewin
|
from pylot.core.pick.utils import getnoisewin
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import obspy
|
import obspy
|
||||||
from pylot.core.pick.utils import earllatepicker
|
from pylot.core.pick.utils import earllatepicker
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import obspy
|
import obspy
|
||||||
from pylot.core.pick.utils import fmpicker
|
from pylot.core.pick.utils import fmpicker
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
|
||||||
from pylot.core.io.phases import reassess_pilot_db
|
from pylot.core.io.phases import reassess_pilot_db
|
||||||
|
from pylot.core.util.version import get_git_version as _getVersionString
|
||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
__author__ = 'S. Wehling-Benatelli'
|
__author__ = 'S. Wehling-Benatelli'
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
|
||||||
from pylot.core.io.phases import reassess_pilot_event
|
from pylot.core.io.phases import reassess_pilot_event
|
||||||
|
from pylot.core.util.version import get_git_version as _getVersionString
|
||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
__author__ = 'S. Wehling-Benatelli'
|
__author__ = 'S. Wehling-Benatelli'
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
from pylot.core.pick.utils import getsignalwin
|
from pylot.core.pick.utils import getsignalwin
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import obspy
|
import obspy
|
||||||
from pylot.core.pick.utils import getSNR
|
from pylot.core.pick.utils import getSNR
|
||||||
|
|
||||||
@ -27,4 +28,5 @@ if __name__ == "__main__":
|
|||||||
'are calculated',
|
'are calculated',
|
||||||
dest='time')
|
dest='time')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
print getSNR(args.data, args.tsnr, args.time)
|
print
|
||||||
|
getSNR(args.data, args.tsnr, args.time)
|
||||||
|
@ -6,14 +6,12 @@
|
|||||||
Only for test purposes!
|
Only for test purposes!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from obspy.core import read
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import numpy as np
|
|
||||||
from pylot.core.pick.charfuns import CharacteristicFunction
|
|
||||||
from pylot.core.pick.picker import AutoPicker
|
|
||||||
from pylot.core.pick.utils import *
|
|
||||||
import glob
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import glob
|
||||||
|
|
||||||
|
from obspy.core import read
|
||||||
|
from pylot.core.pick.utils import *
|
||||||
|
|
||||||
|
|
||||||
def run_makeCF(project, database, event, iplot, station=None):
|
def run_makeCF(project, database, event, iplot, station=None):
|
||||||
# parameters for CF calculation
|
# parameters for CF calculation
|
||||||
@ -50,8 +48,10 @@ def run_makeCF(project, database, event, iplot, station=None):
|
|||||||
wfnfiles = glob.glob(dpn)
|
wfnfiles = glob.glob(dpn)
|
||||||
if wfzfiles:
|
if wfzfiles:
|
||||||
for i in range(len(wfzfiles)):
|
for i in range(len(wfzfiles)):
|
||||||
print 'Vertical component data found ...'
|
print
|
||||||
print wfzfiles[i]
|
'Vertical component data found ...'
|
||||||
|
print
|
||||||
|
wfzfiles[i]
|
||||||
st = read('%s' % wfzfiles[i])
|
st = read('%s' % wfzfiles[i])
|
||||||
st_copy = st.copy()
|
st_copy = st.copy()
|
||||||
# filter and taper data
|
# filter and taper data
|
||||||
@ -82,7 +82,8 @@ def run_makeCF(project, database, event, iplot, station=None):
|
|||||||
#############################################################
|
#############################################################
|
||||||
# get SNR
|
# get SNR
|
||||||
[SNR, SNRdB] = getSNR(st_copy, TSNRhos, hospick.getpick())
|
[SNR, SNRdB] = getSNR(st_copy, TSNRhos, hospick.getpick())
|
||||||
print 'SNR:', SNR, 'SNR[dB]:', SNRdB
|
print
|
||||||
|
'SNR:', SNR, 'SNR[dB]:', SNRdB
|
||||||
##########################################################
|
##########################################################
|
||||||
# get first motion of onset
|
# get first motion of onset
|
||||||
hosfm = fmpicker(st, st_copy, 0.2, hospick.getpick(), 11)
|
hosfm = fmpicker(st, st_copy, 0.2, hospick.getpick(), 11)
|
||||||
@ -106,13 +107,17 @@ def run_makeCF(project, database, event, iplot, station=None):
|
|||||||
st_copy[0].data = tr_filt.data
|
st_copy[0].data = tr_filt.data
|
||||||
[lpickarz, epickarz, pickerrarz] = earllatepicker(st_copy, 1.5, TSNRarz, arzpick.getpick(), 10)
|
[lpickarz, epickarz, pickerrarz] = earllatepicker(st_copy, 1.5, TSNRarz, arzpick.getpick(), 10)
|
||||||
elif not wfzfiles:
|
elif not wfzfiles:
|
||||||
print 'No vertical component data found!'
|
print
|
||||||
|
'No vertical component data found!'
|
||||||
|
|
||||||
if wfefiles and wfnfiles:
|
if wfefiles and wfnfiles:
|
||||||
for i in range(len(wfefiles)):
|
for i in range(len(wfefiles)):
|
||||||
print 'Horizontal component data found ...'
|
print
|
||||||
print wfefiles[i]
|
'Horizontal component data found ...'
|
||||||
print wfnfiles[i]
|
print
|
||||||
|
wfefiles[i]
|
||||||
|
print
|
||||||
|
wfnfiles[i]
|
||||||
# merge streams
|
# merge streams
|
||||||
H = read('%s' % wfefiles[i])
|
H = read('%s' % wfefiles[i])
|
||||||
H += read('%s' % wfnfiles[i])
|
H += read('%s' % wfnfiles[i])
|
||||||
@ -210,7 +215,8 @@ def run_makeCF(project, database, event, iplot, station=None):
|
|||||||
plt.xlabel('Time [s]')
|
plt.xlabel('Time [s]')
|
||||||
plt.ylabel('Normalized Counts')
|
plt.ylabel('Normalized Counts')
|
||||||
plt.title('%s, %s, CF-SNR=%7.2f, CF-Slope=%12.2f' % (tr.stats.station,
|
plt.title('%s, %s, CF-SNR=%7.2f, CF-Slope=%12.2f' % (tr.stats.station,
|
||||||
tr.stats.channel, aicpick.getSNR(), aicpick.getSlope()))
|
tr.stats.channel, aicpick.getSNR(),
|
||||||
|
aicpick.getSlope()))
|
||||||
plt.suptitle(tr.stats.starttime)
|
plt.suptitle(tr.stats.starttime)
|
||||||
plt.legend([p1, p2, p3, p4, p5], ['Data', 'HOS-CF', 'HOSAIC-CF', 'ARZ-CF', 'ARZAIC-CF'])
|
plt.legend([p1, p2, p3, p4, p5], ['Data', 'HOS-CF', 'HOSAIC-CF', 'ARZ-CF', 'ARZAIC-CF'])
|
||||||
# plot horizontal traces
|
# plot horizontal traces
|
||||||
@ -296,6 +302,7 @@ def run_makeCF(project, database, event, iplot, station=None):
|
|||||||
raw_input()
|
raw_input()
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--project', type=str, help='project name (e.g. Insheim)')
|
parser.add_argument('--project', type=str, help='project name (e.g. Insheim)')
|
||||||
parser.add_argument('--database', type=str, help='event data base (e.g. 2014.09_Insheim)')
|
parser.add_argument('--database', type=str, help='event data base (e.g. 2014.09_Insheim)')
|
||||||
|
Loading…
Reference in New Issue
Block a user