[change] docstrings in picker.py

This commit is contained in:
Darius Arnold 2017-11-13 09:49:44 +01:00
parent 55101c9e9e
commit b2f211516a

View File

@ -29,38 +29,36 @@ from pylot.core.pick.utils import getnoisewin, getsignalwin
class AutoPicker(object): class AutoPicker(object):
''' """
Superclass of different, automated picking algorithms applied on a CF determined Superclass of different, automated picking algorithms applied on a CF determined
using AIC, HOS, or AR prediction. using AIC, HOS, or AR prediction.
''' """
warnings.simplefilter('ignore') warnings.simplefilter('ignore')
def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None, linecolor='k'): def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None, linecolor='k'):
''' """
:param: cf, characteristic function, on which the picking algorithm is applied Create AutoPicker object
:type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object :param cf: characteristic function, on which the picking algorithm is applied
:type cf: `~pylot.core.pick.CharFuns.CharacteristicFunction`
:param: TSNR, length of time windows around pick used to determine SNR [s] :param TSNR: length of time windows around pick used to determine SNR [s], tuple (T_noise, T_gap, T_signal)
:type: tuple (T_noise, T_gap, T_signal) :type TSNR: (float, float, float)
:param PickWindow: length of pick window [s]
:param: PickWindow, length of pick window [s] :type PickWindow: float
:type: float :param iplot: flag used for plotting, if > 1, results will be plotted. Use iplot = 0 to disable plotting
:type iplot: int
:param: iplot, no. of figure window for plotting interims results :param aus: ("artificial uplift of samples"), find local minimum at i if aic(i-1)*(1+aus) >= aic(i)
:type: integer :type aus: float
:param Tsmooth: length of moving smoothing window to calculate smoothed CF [s]
:param: aus ("artificial uplift of samples"), find local minimum at i if aic(i-1)*(1+aus) >= aic(i) :type Tsmooth: float
:type: float :param Pick1: initial (preliminary) onset time, starting point for PragPicker and EarlLatePicker
:type Pick1: float
:param: Tsmooth, length of moving smoothing window to calculate smoothed CF [s] :param fig: matplotlib figure used for plotting. If not given and plotting is enabled, a new figure will
:type: float be created
:type fig: `~matplotlib.figure.Figure`
:param: Pick1, initial (prelimenary) onset time, starting point for PragPicker and :param linecolor: matplotlib line color string
EarlLatePicker :type linecolor: str
:type: float """
'''
assert isinstance(cf, CharacteristicFunction), "%s is not a CharacteristicFunction object" % str(cf) assert isinstance(cf, CharacteristicFunction), "%s is not a CharacteristicFunction object" % str(cf)
self._linecolor = linecolor self._linecolor = linecolor
@ -79,6 +77,11 @@ class AutoPicker(object):
self.calcPick() self.calcPick()
def __str__(self): def __str__(self):
"""
String representation of AutoPicker object
:return:
:rtype: str
"""
return '''\n\t{name} object:\n return '''\n\t{name} object:\n
TSNR:\t\t\t{TSNR}\n TSNR:\t\t\t{TSNR}\n
PickWindow:\t{PickWindow}\n PickWindow:\t{PickWindow}\n
@ -142,12 +145,12 @@ class AutoPicker(object):
class AICPicker(AutoPicker): class AICPicker(AutoPicker):
''' """
Method to derive the onset time of an arriving phase based on CF Method to derive the onset time of an arriving phase based on CF
derived from AIC. In order to get an impression of the quality of this inital pick, derived from AIC. In order to get an impression of the quality of this initial pick,
a quality assessment is applied based on SNR and slope determination derived from the CF, a quality assessment is applied based on SNR and slope determination derived from the CF,
from which the AIC has been calculated. from which the AIC has been calculated.
''' """
def calcPick(self): def calcPick(self):
@ -214,6 +217,12 @@ class AICPicker(AutoPicker):
self.Pick = self.Tcf[i] self.Pick = self.Tcf[i]
break break
def calcPick(self):
"""
Calculate pick using cf derived from AIC
:return:
:rtype: None
"""
# quality assessment using SNR and slope from CF # quality assessment using SNR and slope from CF
if self.Pick is not None: if self.Pick is not None:
# get noise window # get noise window
@ -364,9 +373,9 @@ class AICPicker(AutoPicker):
class PragPicker(AutoPicker): class PragPicker(AutoPicker):
''' """
Method of pragmatic picking exploiting information given by CF. Method of pragmatic picking exploiting information given by CF.
''' """
def calcPick(self): def calcPick(self):