[pycharm] optimized imports
This commit is contained in:
parent
c23bbfae8a
commit
739a6e89f4
22
PyLoT.py
22
PyLoT.py
@ -24,12 +24,11 @@ https://www.iconfinder.com/iconsets/flavour
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import matplotlib
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
import matplotlib
|
||||
|
||||
matplotlib.use('Qt4Agg')
|
||||
matplotlib.rcParams['backend.qt4'] = 'PySide'
|
||||
matplotlib.rcParams['savefig.dpi'] = 300
|
||||
@ -40,8 +39,8 @@ from PySide.QtCore import QCoreApplication, QSettings, Signal, QFile, \
|
||||
QFileInfo, Qt, QSize
|
||||
from PySide.QtGui import QMainWindow, QInputDialog, QIcon, QFileDialog, \
|
||||
QWidget, QHBoxLayout, QVBoxLayout, QStyle, QKeySequence, QLabel, QFrame, QAction, \
|
||||
QDialog, QErrorMessage, QApplication, QPixmap, QMessageBox, QSplashScreen, \
|
||||
QActionGroup, QListWidget, QLineEdit, QListView, QAbstractItemView, \
|
||||
QDialog, QApplication, QPixmap, QMessageBox, QSplashScreen, \
|
||||
QActionGroup, QListWidget, QListView, QAbstractItemView, \
|
||||
QTreeView, QComboBox, QTabWidget, QPushButton, QGridLayout
|
||||
import numpy as np
|
||||
from obspy import UTCDateTime
|
||||
@ -56,7 +55,6 @@ try:
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvas
|
||||
except ImportError:
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
||||
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
|
||||
from matplotlib.figure import Figure
|
||||
|
||||
from pylot.core.analysis.magnitude import LocalMagnitude, MomentMagnitude
|
||||
@ -64,24 +62,23 @@ from pylot.core.io.data import Data
|
||||
from pylot.core.io.inputs import FilterOptions, PylotParameter
|
||||
from autoPyLoT import autoPyLoT
|
||||
from pylot.core.pick.compare import Comparison
|
||||
from pylot.core.pick.utils import symmetrize_error, getQualityFromUncertainty, getPickQuality
|
||||
from pylot.core.pick.utils import getQualityFromUncertainty
|
||||
from pylot.core.io.phases import picksdict_from_picks
|
||||
import pylot.core.loc.nll as nll
|
||||
from pylot.core.util.defaults import FILTERDEFAULTS
|
||||
from pylot.core.util.errors import DatastructureError, \
|
||||
OverwriteError
|
||||
from pylot.core.util.connection import checkurl
|
||||
from pylot.core.util.dataprocessing import Metadata, restitute_data
|
||||
from pylot.core.util.utils import fnConstructor, getLogin, \
|
||||
full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \
|
||||
pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, \
|
||||
check4rotated, transform_colors_mpl, transform_colors_mpl_str, getAutoFilteroptions, check_all_obspy, \
|
||||
full_range, readFilterInformation, make_pen, pick_color_plt, \
|
||||
pick_linestyle_plt, identifyPhaseID, excludeQualityClasses, \
|
||||
transform_colors_mpl, transform_colors_mpl_str, getAutoFilteroptions, check_all_obspy, \
|
||||
check_all_pylot, real_Bool, SetChannelComponents
|
||||
from pylot.core.util.event import Event
|
||||
from pylot.core.io.location import create_creation_info, create_event
|
||||
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
||||
PylotCanvas, WaveformWidgetPG, PropertiesDlg, HelpForm, createAction, PickDlg, \
|
||||
getDataType, ComparisonWidget, TuneAutopicker, PylotParaBox, AutoPickDlg, CanvasWidget, AutoPickWidget, \
|
||||
ComparisonWidget, TuneAutopicker, PylotParaBox, AutoPickDlg, CanvasWidget, AutoPickWidget, \
|
||||
CompareEventsWidget, ProgressBarWidget, AddMetadataWidget
|
||||
from pylot.core.util.array_map import Array_map
|
||||
from pylot.core.util.structure import DATASTRUCTURE
|
||||
@ -97,6 +94,9 @@ elif sys.version_info.major == 2:
|
||||
else:
|
||||
raise ImportError('Could not determine python version.')
|
||||
|
||||
# workaround to prevent PyCharm from deleting icons_rc import when optimizing imports
|
||||
icons_rc = icons_rc
|
||||
|
||||
locateTool = dict(nll=nll)
|
||||
|
||||
|
||||
|
@ -8,6 +8,8 @@ import datetime
|
||||
import glob
|
||||
import os
|
||||
import traceback
|
||||
from obspy import read_events
|
||||
from obspy.core.event import ResourceIdentifier
|
||||
|
||||
import pylot.core.loc.focmec as focmec
|
||||
import pylot.core.loc.hash as hash
|
||||
@ -16,18 +18,16 @@ 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.velest as velest
|
||||
from obspy import read_events
|
||||
from obspy.core.event import ResourceIdentifier
|
||||
# from PySide.QtGui import QWidget, QInputDialog
|
||||
from pylot.core.analysis.magnitude import MomentMagnitude, LocalMagnitude
|
||||
from pylot.core.io.data import Data
|
||||
from pylot.core.io.inputs import PylotParameter
|
||||
from pylot.core.pick.autopick import autopickevent, iteratepicker
|
||||
from pylot.core.util.dataprocessing import restitute_data, read_metadata, Metadata
|
||||
from pylot.core.util.dataprocessing import restitute_data, Metadata
|
||||
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, remove_underscores, trim_station_components, check4gaps, check4doubled, \
|
||||
from pylot.core.util.utils import real_None, trim_station_components, check4gaps, check4doubled, \
|
||||
check4rotated
|
||||
from pylot.core.util.version import get_git_version as _getVersionString
|
||||
|
||||
|
@ -11,11 +11,12 @@ import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import obspy.core.event as ope
|
||||
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, \
|
||||
select_for_phase
|
||||
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):
|
||||
|
@ -3,19 +3,18 @@
|
||||
|
||||
import copy
|
||||
import os
|
||||
|
||||
from obspy import read_events
|
||||
from obspy.core import read, Stream, UTCDateTime
|
||||
from obspy.core.event import Event as ObsPyEvent
|
||||
from obspy.io.sac import SacIOError
|
||||
|
||||
import pylot.core.loc.velest as velest
|
||||
from pylot.core.io.phases import readPILOTEvent, picks_from_picksdict, \
|
||||
picksdict_from_pilot, merge_picks
|
||||
from pylot.core.util.errors import FormatError, OverwriteError
|
||||
from pylot.core.util.event import Event
|
||||
from pylot.core.util.utils import fnConstructor, full_range, remove_underscores, check4gaps, check4doubled, \
|
||||
check4rotated, trim_station_components
|
||||
import pylot.core.loc.velest as velest
|
||||
from pylot.core.util.obspyDMT_interface import qml_from_obspyDMT
|
||||
from pylot.core.util.utils import fnConstructor, full_range, check4rotated, trim_station_components
|
||||
|
||||
|
||||
class Data(object):
|
||||
@ -405,7 +404,7 @@ class Data(object):
|
||||
|
||||
# various pre-processing steps:
|
||||
# remove possible underscores in station names
|
||||
#self.wfdata = remove_underscores(self.wfdata)
|
||||
# self.wfdata = remove_underscores(self.wfdata)
|
||||
# check for stations with rotated components
|
||||
if checkRotated and metadata is not None:
|
||||
self.wfdata = check4rotated(self.wfdata, metadata, verbosity=0)
|
||||
|
@ -2,22 +2,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import glob
|
||||
import os
|
||||
import warnings
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import obspy.core.event as ope
|
||||
import os
|
||||
import scipy.io as sio
|
||||
import warnings
|
||||
from obspy.core import UTCDateTime
|
||||
from obspy.core.event import read_events
|
||||
from obspy.core.util import AttribDict
|
||||
|
||||
from pylot.core.io.inputs import PylotParameter
|
||||
from pylot.core.io.location import create_event, \
|
||||
create_magnitude
|
||||
from pylot.core.pick.utils import select_for_phase
|
||||
from pylot.core.util.utils import getOwner, full_range, four_digits, transformFilteroptions2String, \
|
||||
transformFilterString4Export, backtransformFilterString
|
||||
from pylot.core.util.utils import getOwner, full_range, four_digits, transformFilterString4Export, \
|
||||
backtransformFilterString
|
||||
|
||||
|
||||
def add_amplitudes(event, amplitudes):
|
||||
|
@ -4,8 +4,8 @@
|
||||
import glob
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from obspy import read_events
|
||||
|
||||
from pylot.core.io.phases import writephases
|
||||
from pylot.core.util.utils import getPatternLine, runProgram, which
|
||||
from pylot.core.util.version import get_git_version as _getVersionString
|
||||
|
@ -8,10 +8,11 @@ function conglomerate utils.
|
||||
|
||||
:author: MAGS2 EP3 working group / Ludger Kueperkoch
|
||||
"""
|
||||
import traceback
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import traceback
|
||||
from obspy.taup import TauPyModel
|
||||
|
||||
from pylot.core.pick.charfuns import CharacteristicFunction
|
||||
from pylot.core.pick.charfuns import HOScf, AICcf, ARZcf, ARHcf, AR3Ccf
|
||||
from pylot.core.pick.picker import AICPicker, PragPicker
|
||||
@ -20,8 +21,6 @@ from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \
|
||||
from pylot.core.util.utils import getPatternLine, gen_Pool, \
|
||||
real_Bool, identifyPhaseID
|
||||
|
||||
from obspy.taup import TauPyModel
|
||||
|
||||
|
||||
def autopickevent(data, param, iplot=0, fig_dict=None, fig_dict_wadatijack=None, ncores=0, metadata=None, origin=None):
|
||||
"""
|
||||
|
@ -2,14 +2,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import copy
|
||||
import operator
|
||||
import os
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from obspy import read_events
|
||||
import operator
|
||||
import os
|
||||
from obspy.core import AttribDict
|
||||
from pylot.core.io.phases import picksdict_from_picks
|
||||
|
||||
from pylot.core.util.pdf import ProbabilityDensityFunction
|
||||
from pylot.core.util.utils import find_in_list
|
||||
from pylot.core.util.version import get_git_version as _getVersionString
|
||||
|
@ -19,11 +19,11 @@ calculated after Diehl & Kissling (2009).
|
||||
:author: MAGS2 EP3 working group / Ludger Kueperkoch
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import warnings
|
||||
from scipy.signal import argrelmax, argrelmin
|
||||
|
||||
from pylot.core.pick.charfuns import CharacteristicFunction
|
||||
from pylot.core.pick.utils import getnoisewin, getsignalwin
|
||||
|
||||
@ -265,7 +265,7 @@ class AICPicker(AutoPicker):
|
||||
else:
|
||||
islope = np.where((self.Tcf <= min([self.Pick + tslope, self.Tcf[-1]])) \
|
||||
& (
|
||||
self.Tcf >= self.Pick + tsafety)) # TODO: put this in a seperate function like getsignalwin
|
||||
self.Tcf >= self.Pick + tsafety)) # TODO: put this in a seperate function like getsignalwin
|
||||
# find maximum within slope determination window
|
||||
# 'cause slope should be calculated up to first local minimum only!
|
||||
try:
|
||||
|
@ -8,11 +8,11 @@
|
||||
:author: Ludger Kueperkoch, BESTEC GmbH
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import warnings
|
||||
from obspy.core import Stream, UTCDateTime
|
||||
|
||||
from pylot.core.util.utils import real_Bool, real_None, SetChannelComponents
|
||||
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import traceback
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import obspy
|
||||
import traceback
|
||||
from PySide import QtGui
|
||||
from mpl_toolkits.basemap import Basemap
|
||||
from matplotlib.figure import Figure
|
||||
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
||||
from pylot.core.util.widgets import PickDlg, PylotCanvas
|
||||
from mpl_toolkits.basemap import Basemap
|
||||
from scipy.interpolate import griddata
|
||||
|
||||
from pylot.core.util.widgets import PickDlg, PylotCanvas
|
||||
|
||||
plt.interactive(False)
|
||||
|
||||
|
||||
@ -47,7 +48,6 @@ class Array_map(QtGui.QWidget):
|
||||
hybrids_dict[station] = pick
|
||||
return hybrids_dict
|
||||
|
||||
|
||||
def init_map(self):
|
||||
self.init_lat_lon_dimensions()
|
||||
self.init_lat_lon_grid()
|
||||
@ -81,9 +81,9 @@ class Array_map(QtGui.QWidget):
|
||||
message = message.format(picker, phase, network, station,
|
||||
pick['mpp'])
|
||||
if picker == 'auto':
|
||||
del(self.autopicks_dict[station])
|
||||
del (self.autopicks_dict[station])
|
||||
elif picker == 'manual':
|
||||
del(self.picks_dict[station])
|
||||
del (self.picks_dict[station])
|
||||
else:
|
||||
raise TypeError('Unknown "picker" {}'.format(picker))
|
||||
print(message)
|
||||
@ -347,7 +347,7 @@ class Array_map(QtGui.QWidget):
|
||||
return picks, latitudes, longitudes
|
||||
|
||||
def draw_contour_filled(self, nlevel='50'):
|
||||
#self.test_gradient()
|
||||
# self.test_gradient()
|
||||
|
||||
levels = np.linspace(self.get_min_from_picks(), self.get_max_from_picks(), nlevel)
|
||||
self.contourf = self.basemap.contourf(self.longrid, self.latgrid, self.picksgrid_active,
|
||||
@ -363,7 +363,7 @@ class Array_map(QtGui.QWidget):
|
||||
pick_item = self.picks_rel.pop(st_id)
|
||||
self.init_picksgrid()
|
||||
x, y = np.gradient(self.picksgrid_active)
|
||||
gradient_modulus = np.sqrt(x**2 + y**2)
|
||||
gradient_modulus = np.sqrt(x ** 2 + y ** 2)
|
||||
mean_gradient = np.nanmean(gradient_modulus)
|
||||
dgradient = global_mean_gradient - mean_gradient
|
||||
# print('station: {}, mean gradient: {}'.format(st_id, dgradient))
|
||||
@ -391,7 +391,6 @@ class Array_map(QtGui.QWidget):
|
||||
# plt.xticks(x, st_ids)
|
||||
# plt.show()
|
||||
|
||||
|
||||
def scatter_all_stations(self):
|
||||
stations, lats, lons = self.get_st_lat_lon_for_plot()
|
||||
self.sc = self.basemap.scatter(lons, lats, s=50, facecolor='none', latlon=True,
|
||||
|
@ -2,14 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import glob
|
||||
import numpy as np
|
||||
import os
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
from obspy import UTCDateTime, read_inventory, read
|
||||
from obspy.io.xseed import Parser
|
||||
|
||||
from pylot.core.util.utils import key_for_set_value, find_in_list, \
|
||||
remove_underscores, gen_Pool
|
||||
gen_Pool
|
||||
|
||||
|
||||
class Metadata(object):
|
||||
@ -616,7 +616,7 @@ def restitute_data(data, metadata, unit='VEL', force=False, ncores=0):
|
||||
|
||||
restflag = list()
|
||||
|
||||
#data = remove_underscores(data)
|
||||
# data = remove_underscores(data)
|
||||
|
||||
# loop over traces
|
||||
input_tuples = []
|
||||
|
@ -9,12 +9,12 @@ Created on Wed Feb 26 12:31:25 2014
|
||||
import os
|
||||
import platform
|
||||
|
||||
from pylot.core.util.utils import readDefaultFilterInformation
|
||||
from pylot.core.loc import hypo71
|
||||
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.util.utils import readDefaultFilterInformation
|
||||
|
||||
# determine system dependent path separator
|
||||
system_name = platform.system()
|
||||
@ -39,5 +39,3 @@ OUTPUTFORMATS = {'.xml': 'QUAKEML',
|
||||
'.obs': 'NLLOC_OBS'}
|
||||
|
||||
LOCTOOLS = dict(nll=nll, hyposat=hyposat, velest=velest, hypo71=hypo71, hypodd=hypodd)
|
||||
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
|
||||
from obspy import UTCDateTime
|
||||
from obspy.core.event import Event as ObsPyEvent
|
||||
from obspy.core.event import Origin, ResourceIdentifier
|
||||
|
||||
from pylot.core.io.phases import picks_from_picksdict
|
||||
from pylot.core.util.obspyDMT_interface import qml_from_obspyDMT
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
import warnings
|
||||
from obspy import UTCDateTime
|
||||
|
||||
from pylot.core.util.utils import fit_curve, clims
|
||||
from pylot.core.util.version import get_git_version as _getVersionString
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys, os, traceback
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
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
|
||||
|
||||
|
||||
class Thread(QThread):
|
||||
@ -40,7 +43,6 @@ class Thread(QThread):
|
||||
|
||||
def showProgressbar(self):
|
||||
if self.progressText:
|
||||
|
||||
# # generate widget if not given in init
|
||||
# if not self.pb_widget:
|
||||
# self.pb_widget = ProgressBarWidget(self.parent())
|
||||
|
@ -2,27 +2,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import hashlib
|
||||
import numpy as np
|
||||
import os
|
||||
import platform
|
||||
import pyqtgraph as pg
|
||||
import re
|
||||
import subprocess
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
from PySide import QtCore
|
||||
from obspy import UTCDateTime, read
|
||||
from obspy.core import AttribDict
|
||||
from obspy.signal.rotate import rotate2zne
|
||||
from obspy.io.xseed.utils import SEEDParserException
|
||||
|
||||
from pylot.core.util.obspyDMT_interface import check_obspydmt_eventfolder
|
||||
from scipy.interpolate import splrep, splev
|
||||
|
||||
from pylot.core.io.inputs import PylotParameter, FilterOptions
|
||||
from pylot.core.util.obspyDMT_interface import check_obspydmt_eventfolder
|
||||
from pylot.styles import style_settings
|
||||
|
||||
from scipy.interpolate import splrep, splev
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
import pyqtgraph as pg
|
||||
|
||||
def _pickle_method(m):
|
||||
if m.im_self is None:
|
||||
@ -835,7 +831,7 @@ def remove_underscores(data):
|
||||
:return: data stream
|
||||
:rtype: `~obspy.core.stream.Stream`
|
||||
"""
|
||||
#for tr in data:
|
||||
# for tr in data:
|
||||
# # remove underscores
|
||||
# tr.stats.station = tr.stats.station.strip('_')
|
||||
return data
|
||||
@ -1279,4 +1275,4 @@ class SetChannelComponents(object):
|
||||
return self.compPosition_Map[self.compName_Map[component]]
|
||||
else:
|
||||
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()))
|
||||
|
@ -8,16 +8,14 @@ Created on Wed Mar 19 11:27:35 2014
|
||||
import copy
|
||||
import datetime
|
||||
import getpass
|
||||
import matplotlib
|
||||
import multiprocessing
|
||||
import numpy as np
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
|
||||
import matplotlib
|
||||
|
||||
matplotlib.use('QT4Agg')
|
||||
|
||||
from matplotlib.figure import Figure
|
||||
@ -28,8 +26,6 @@ except ImportError:
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
||||
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT
|
||||
from matplotlib.widgets import MultiCursor
|
||||
from matplotlib.tight_layout import get_renderer, get_subplotspec_list, get_tight_layout_figure
|
||||
from scipy.signal import argrelmin, argrelmax
|
||||
from obspy import read
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
@ -38,7 +34,7 @@ from PySide.QtGui import QAction, QApplication, QCheckBox, QComboBox, \
|
||||
QGridLayout, QIcon, QLabel, QLineEdit, QMessageBox, \
|
||||
QPixmap, QSpinBox, QTabWidget, QToolBar, QVBoxLayout, QHBoxLayout, QWidget, \
|
||||
QPushButton, QFileDialog, QInputDialog, QKeySequence
|
||||
from PySide.QtCore import QSettings, Qt, QUrl, Signal, Slot
|
||||
from PySide.QtCore import QSettings, Qt, QUrl, Signal
|
||||
from PySide.QtWebKit import QWebView
|
||||
from obspy import Stream, Trace, UTCDateTime
|
||||
from obspy.core.util import AttribDict
|
||||
@ -50,9 +46,9 @@ from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \
|
||||
getResolutionWindow, getQualityFromUncertainty
|
||||
from pylot.core.pick.compare import Comparison
|
||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS
|
||||
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
|
||||
demeanTrace, isSorted, findComboBoxIndex, clims, pick_linestyle_plt, pick_color_plt, \
|
||||
check4rotated, check4doubled, check4gaps, merge_stream, remove_underscores, find_horizontals, identifyPhase, \
|
||||
from pylot.core.util.utils import prepTimeAxis, full_range, demeanTrace, isSorted, findComboBoxIndex, clims, \
|
||||
pick_linestyle_plt, pick_color_plt, \
|
||||
check4rotated, check4doubled, merge_stream, identifyPhase, \
|
||||
loopIdentifyPhase, trim_station_components, transformFilteroptions2String, \
|
||||
identifyPhaseID, real_Bool, pick_color, getAutoFilteroptions, SetChannelComponents
|
||||
from autoPyLoT import autoPyLoT
|
||||
@ -66,6 +62,9 @@ elif sys.version_info.major == 2:
|
||||
else:
|
||||
raise ImportError('Could not determine python version.')
|
||||
|
||||
# workaround to prevent PyCharm from deleting icons_rc import when optimizing imports
|
||||
icons_rc = icons_rc
|
||||
|
||||
|
||||
def getDataType(parent):
|
||||
type = QInputDialog().getItem(parent, "Select phases type", "Type:",
|
||||
@ -148,7 +147,7 @@ class AddMetadataWidget(QWidget):
|
||||
|
||||
self.center()
|
||||
self.show()
|
||||
#self.__test__()
|
||||
# self.__test__()
|
||||
|
||||
def __test__(self):
|
||||
self.add_item(r'/rscratch/minos14/marcel/git/pylot/tests')
|
||||
@ -739,7 +738,8 @@ class WaveformWidgetPG(QtGui.QWidget):
|
||||
# list containing tuples of network, station, channel (for sorting)
|
||||
nslc = []
|
||||
for trace in st_select:
|
||||
nslc.append(trace.get_id())#(trace.stats.network, trace.stats.station, trace.stats.location trace.stats.channel))
|
||||
nslc.append(
|
||||
trace.get_id()) # (trace.stats.network, trace.stats.station, trace.stats.location trace.stats.channel))
|
||||
nslc.sort()
|
||||
nslc.reverse()
|
||||
plots = []
|
||||
@ -2390,7 +2390,6 @@ class PickDlg(QDialog):
|
||||
additional_channel=additional_channel,
|
||||
snr=mean_snr)
|
||||
|
||||
|
||||
def setPick(self, gui_event):
|
||||
|
||||
parameter = self.parameter
|
||||
@ -2539,25 +2538,25 @@ class PickDlg(QDialog):
|
||||
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
||||
vl = ax.axvline(mpp, ylims[0], ylims[1], color=color, linestyle=linestyle_mpp, linewidth=width_mpp,
|
||||
label='{}-{}-Pick (quality: {})'.format(phase, picktype, quality), picker=5,
|
||||
zorder=baseorder+9)
|
||||
zorder=baseorder + 9)
|
||||
phaseLineKey = '{}-{}'.format(phase, picktype)
|
||||
self.phaseLines[phaseLineKey] = vl
|
||||
if spe:
|
||||
ax.fill_between([mpp - spe, mpp + spe], ylims[0], ylims[1],
|
||||
alpha=.25, color=color, label='{}-{}-SPE'.format(phase, picktype), zorder=baseorder+1)
|
||||
alpha=.25, color=color, label='{}-{}-SPE'.format(phase, picktype), zorder=baseorder + 1)
|
||||
if picks['epp']:
|
||||
linestyle_epp, width_epp = pick_linestyle_plt(picktype, 'epp')
|
||||
ax.axvline(epp, ylims[0], ylims[1], color=color, linestyle=linestyle_epp,
|
||||
linewidth=width_epp, label='{}-{}-EPP'.format(phase, picktype), zorder=baseorder+2)
|
||||
linewidth=width_epp, label='{}-{}-EPP'.format(phase, picktype), zorder=baseorder + 2)
|
||||
if picks['lpp']:
|
||||
linestyle_lpp, width_lpp = pick_linestyle_plt(picktype, 'lpp')
|
||||
ax.axvline(lpp, ylims[0], ylims[1], color=color, linestyle=linestyle_lpp,
|
||||
linewidth=width_lpp, label='{}-{}-LPP'.format(phase, picktype), zorder=baseorder+2)
|
||||
linewidth=width_lpp, label='{}-{}-LPP'.format(phase, picktype), zorder=baseorder + 2)
|
||||
if picktype == 'auto':
|
||||
ax.plot(mpp, ylims[1], color=color, marker='v', zorder=baseorder+3)
|
||||
ax.plot(mpp, ylims[0], color=color, marker='^', zorder=baseorder+3)
|
||||
ax.plot(mpp, ylims[1], color=color, marker='v', zorder=baseorder + 3)
|
||||
ax.plot(mpp, ylims[0], color=color, marker='^', zorder=baseorder + 3)
|
||||
# append phase text (if textOnly: draw with current ylims)
|
||||
self.phaseText.append(ax.text(mpp, ylims[1], phase, color=color, zorder=baseorder+10))
|
||||
self.phaseText.append(ax.text(mpp, ylims[1], phase, color=color, zorder=baseorder + 10))
|
||||
ax.legend(loc=1)
|
||||
|
||||
def connect_mouse_motion(self):
|
||||
@ -3345,11 +3344,11 @@ class TuneAutopicker(QWidget):
|
||||
self.data.setWFData(fnames)
|
||||
wfdat = self.data.getWFData() # all available streams
|
||||
# remove possible underscores in station names
|
||||
#wfdat = remove_underscores(wfdat)
|
||||
# wfdat = remove_underscores(wfdat)
|
||||
# rotate misaligned stations to ZNE
|
||||
# check for gaps and doubled channels
|
||||
wfdat, gaps = merge_stream(wfdat)
|
||||
#check4gaps(wfdat)
|
||||
# check4gaps(wfdat)
|
||||
check4doubled(wfdat)
|
||||
wfdat = check4rotated(wfdat, self.parent().metadata, verbosity=0)
|
||||
# trim station components to same start value
|
||||
@ -4606,7 +4605,7 @@ class GraphicsTab(PropTab):
|
||||
super(GraphicsTab, self).__init__(parent)
|
||||
self.pylot_mainwindow = parent._pylot_mainwindow
|
||||
self.init_layout()
|
||||
#self.add_pg_cb()
|
||||
# self.add_pg_cb()
|
||||
self.add_nth_sample()
|
||||
self.add_style_settings()
|
||||
self.setLayout(self.main_layout)
|
||||
|
@ -1,9 +1,9 @@
|
||||
import unittest
|
||||
import os
|
||||
|
||||
import unittest
|
||||
from obspy import UTCDateTime
|
||||
from obspy.io.xseed.utils import SEEDParserException
|
||||
from obspy.io.xseed import Parser
|
||||
from obspy.io.xseed.utils import SEEDParserException
|
||||
|
||||
from pylot.core.util.dataprocessing import Metadata
|
||||
from tests.utils import HidePrints
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
"""Utilities/helpers for testing"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
class HidePrints:
|
||||
|
Loading…
Reference in New Issue
Block a user