def stalta_pick(stream, stalen, ltalen, trig_on, trig_off, freqmin=False,<EOL>freqmax=False, debug=<NUM_LIT:0>, show=False):
event = Event()<EOL>event.origins.append(Origin())<EOL>event.creation_info = CreationInfo(author='<STR_LIT>',<EOL>creation_time=UTCDateTime())<EOL>event.comments.append(Comment(text='<STR_LIT>'))<EOL>picks = []<EOL>for tr in stream:<EOL><INDENT>if tr.stats.channel[-<NUM_LIT:1>] == '<STR_LIT>':<EOL><INDENT>phase = '<STR_LIT:P>'<EOL><DEDENT>else:<EOL><INDENT>phase = '<STR_LIT:S>'<EOL><DEDENT>if freqmin and freqmax:<EOL><INDENT>tr.detrend('<STR_LIT>')<EOL>tr.filter('<STR_LIT>', freqmin=freqmin, freqmax=freqmax,<EOL>corners=<NUM_LIT:3>, zerophase=True)<EOL><DEDENT>df = tr.stats.sampling_rate<EOL>cft = classic_sta_lta(tr.data, int(stalen * df), int(ltalen * df))<EOL>if debug > <NUM_LIT:3>:<EOL><INDENT>plot_trigger(tr, cft, trig_on, trig_off)<EOL><DEDENT>triggers = trigger_onset(cft, trig_on, trig_off)<EOL>for trigger in triggers:<EOL><INDENT>on = tr.stats.starttime + (trigger[<NUM_LIT:0>] / df)<EOL>wav_id = WaveformStreamID(station_code=tr.stats.station,<EOL>channel_code=tr.stats.channel,<EOL>network_code=tr.stats.network)<EOL>p = Pick(waveform_id=wav_id, phase_hint=phase, time=on)<EOL>if debug > <NUM_LIT:2>:<EOL><INDENT>print('<STR_LIT>')<EOL>print(p)<EOL><DEDENT>picks.append(p)<EOL><DEDENT><DEDENT>pick_stations = list(set([pick.waveform_id.station_code<EOL>for pick in picks]))<EOL>for pick_station in pick_stations:<EOL><INDENT>station_picks = [pick for pick in picks if<EOL>pick.waveform_id.station_code == pick_station]<EOL>p_time = [pick.time for pick in station_picks<EOL>if pick.phase_hint == '<STR_LIT:P>']<EOL>s_time = [pick.time for pick in station_picks<EOL>if pick.phase_hint == '<STR_LIT:S>']<EOL>if p_time > s_time:<EOL><INDENT>p_pick = [pick for pick in station_picks if pick.phase_hint == '<STR_LIT:P>']<EOL>for pick in p_pick:<EOL><INDENT>print('<STR_LIT>')<EOL>picks.remove(pick)<EOL><DEDENT><DEDENT><DEDENT>if show:<EOL><INDENT>plotting.pretty_template_plot(stream, picks=picks, title='<STR_LIT>',<EOL>size=(<NUM_LIT:8>, <NUM_LIT:9>))<EOL><DEDENT>event.picks = picks<EOL>if len(event.picks) > <NUM_LIT:0>:<EOL><INDENT>event.origins[<NUM_LIT:0>].time = min([pick.time for pick in event.picks]) - <NUM_LIT:1><EOL><DEDENT>return event<EOL>
Basic sta/lta picker, suggest using alternative in obspy.

Simple sta/lta (short-term average/long-term average) picker, using
obspy's :func:`obspy.signal.trigger.classic_sta_lta` routine to generate
the characteristic function.

Currently very basic quick wrapper, there are many other (better) options
in obspy in the :mod:`obspy.signal.trigger` module.

:type stream: obspy.core.stream.Stream
:param stream: The stream to pick on, can be any number of channels.
:type stalen: float
:param stalen: Length of the short-term average window in seconds.
:type ltalen: float
:param ltalen: Length of the long-term average window in seconds.
:type trig_on: float
:param trig_on: sta/lta ratio to trigger a detection/pick
:type trig_off: float
:param trig_off: sta/lta ratio to turn the trigger off - no further picks\
    will be made between exceeding trig_on until trig_off is reached.
:type freqmin: float
:param freqmin: Low-cut frequency in Hz for bandpass filter
:type freqmax: float
:param freqmax: High-cut frequency in Hz for bandpass filter
:type debug: int
:param debug: Debug output level from 0-5.
:type show: bool
:param show: Show picks on waveform.

:returns: :class:`obspy.core.event.event.Event`

.. rubric:: Example

>>> from obspy import read
>>> from eqcorrscan.utils.picker import stalta_pick
>>> st = read()
>>> event = stalta_pick(st, stalen=0.2, ltalen=4, trig_on=10,
...             trig_off=1, freqmin=3.0, freqmax=20.0)
>>> print(event.creation_info.author)
EQcorrscan

.. warning::
    This function is not designed for accurate picking, rather it can give
    a first idea of whether picks may be possible.  Proceed with caution.