def shortproc(st, lowcut, highcut, filt_order, samp_rate, debug=<NUM_LIT:0>,<EOL>parallel=False, num_cores=False, starttime=None, endtime=None,<EOL>seisan_chan_names=False, fill_gaps=True):
if isinstance(st, Trace):<EOL><INDENT>tracein = True<EOL>st = Stream(st)<EOL><DEDENT>else:<EOL><INDENT>tracein = False<EOL><DEDENT>if highcut and highcut >= <NUM_LIT:0.5> * samp_rate:<EOL><INDENT>raise IOError('<STR_LIT>')<EOL><DEDENT>if debug > <NUM_LIT:4>:<EOL><INDENT>parallel = False<EOL><DEDENT>length = None<EOL>clip = False<EOL>if starttime is not None and endtime is not None:<EOL><INDENT>for tr in st:<EOL><INDENT>tr.trim(starttime, endtime)<EOL>if len(tr.data) == ((endtime - starttime) *<EOL>tr.stats.sampling_rate) + <NUM_LIT:1>:<EOL><INDENT>tr.data = tr.data[<NUM_LIT:1>:len(tr.data)]<EOL><DEDENT><DEDENT>length = endtime - starttime<EOL>clip = True<EOL><DEDENT>elif starttime:<EOL><INDENT>for tr in st:<EOL><INDENT>tr.trim(starttime=starttime)<EOL><DEDENT><DEDENT>elif endtime:<EOL><INDENT>for tr in st:<EOL><INDENT>tr.trim(endtime=endtime)<EOL><DEDENT><DEDENT>for tr in st:<EOL><INDENT>if len(tr.data) == <NUM_LIT:0>:<EOL><INDENT>st.remove(tr)<EOL>debug_print('<STR_LIT>' %<EOL>(tr.stats.station, tr.stats.channel), <NUM_LIT:1>, debug)<EOL><DEDENT><DEDENT>if parallel:<EOL><INDENT>if not num_cores:<EOL><INDENT>num_cores = cpu_count()<EOL><DEDENT>if num_cores > len(st):<EOL><INDENT>num_cores = len(st)<EOL><DEDENT>pool = Pool(processes=num_cores)<EOL>results = [pool.apply_async(process, (tr,), {<EOL>'<STR_LIT>': lowcut, '<STR_LIT>': highcut, '<STR_LIT>': filt_order,<EOL>'<STR_LIT>': samp_rate, '<STR_LIT>': debug, '<STR_LIT>': starttime,<EOL>'<STR_LIT>': clip, '<STR_LIT>': seisan_chan_names,<EOL>'<STR_LIT>': fill_gaps, '<STR_LIT>': length})<EOL>for tr in st]<EOL>pool.close()<EOL>try:<EOL><INDENT>stream_list = [p.get() for p in results]<EOL><DEDENT>except KeyboardInterrupt as e:  <EOL><INDENT>pool.terminate()<EOL>raise e<EOL><DEDENT>pool.join()<EOL>st = Stream(stream_list)<EOL><DEDENT>else:<EOL><INDENT>for i, tr in enumerate(st):<EOL><INDENT>st[i] = process(<EOL>tr=tr, lowcut=lowcut, highcut=highcut, filt_order=filt_order,<EOL>samp_rate=samp_rate, debug=debug, starttime=starttime,<EOL>clip=clip, seisan_chan_names=seisan_chan_names,<EOL>fill_gaps=fill_gaps, length=length)<EOL><DEDENT><DEDENT>if tracein:<EOL><INDENT>st.merge()<EOL>return st[<NUM_LIT:0>]<EOL><DEDENT>return st<EOL>
Basic function to bandpass and downsample.

    Works in place on data.  This is employed to ensure all parts of the
    data are processed in the same way.

    :type st: obspy.core.stream.Stream
    :param st: Stream to process
    :type lowcut: float
    :param lowcut: Low cut for bandpass in Hz
    :type highcut: float
    :param highcut: High cut for bandpass in Hz
    :type filt_order: int
    :param filt_order: Number of corners for bandpass filter
    :type samp_rate: float
    :param samp_rate: Sampling rate desired in Hz
    :type debug: int
    :param debug: Debug flag from 0-5, higher numbers = more output
    :type parallel: bool
    :param parallel:
        Set to True to process traces in parallel, for small numbers of traces
        this is often slower than serial processing, defaults to False
    :type num_cores: int
    :param num_cores:
        Control the number of cores for parallel processing, if set to False
        then this will use all the cores available.
    :type starttime: obspy.core.utcdatetime.UTCDateTime
    :param starttime:
        Desired data start time, will trim to this before processing
    :type endtime: obspy.core.utcdatetime.UTCDateTime
    :param endtime:
        Desired data end time, will trim to this before processing
    :type seisan_chan_names: bool
    :param seisan_chan_names:
        Whether channels are named like seisan channels (which are two letters
        rather than SEED convention of three) - defaults to True.
    :type fill_gaps: bool
    :param fill_gaps: Whether to pad any gaps found with zeros or not.

    :return: Processed stream
    :rtype: :class:`obspy.core.stream.Stream`

    .. note::
        If your data contain gaps you should *NOT* fill those gaps before
        using the pre-process functions. The pre-process functions will fill
        the gaps internally prior to processing, process the data, then re-fill
        the gaps with zeros to ensure correlations are not incorrectly
        calculated within gaps. If your data have gaps you should pass a merged
        stream without the `fill_value` argument (e.g.: `st = st.merge()`).

    .. warning::
        If you intend to use this for processing templates you should consider
        how resampling will impact your cross-correlations. Minor differences
        in resampling between day-long files (which you are likely to use for
        continuous detection) and shorter files will reduce your
        cross-correlations!

    .. rubric:: Example, bandpass

    >>> from obspy import read
    >>> from eqcorrscan.utils.pre_processing import shortproc
    >>> # Get the path to the test data
    >>> import eqcorrscan
    >>> import os
    >>> TEST_PATH = os.path.dirname(eqcorrscan.__file__) + '/tests/test_data'
    >>> st = read(TEST_PATH + '/WAV/TEST_/2013-09-01-0410-35.DFDPC_024_00')
    >>> st = shortproc(st=st, lowcut=2, highcut=9, filt_order=3, samp_rate=20,
    ...                debug=0, parallel=True, num_cores=2)
    >>> print(st[0])
    AF.LABE..SHZ | 2013-09-01T04:10:35.700000Z - 2013-09-01T04:12:05.650000Z \
| 20.0 Hz, 1800 samples

    .. rubric:: Example, low-pass

    >>> from obspy import read
    >>> from eqcorrscan.utils.pre_processing import shortproc
    >>> # Get the path to the test data
    >>> import eqcorrscan
    >>> import os
    >>> TEST_PATH = os.path.dirname(eqcorrscan.__file__) + '/tests/test_data'
    >>> st = read(TEST_PATH + '/WAV/TEST_/2013-09-01-0410-35.DFDPC_024_00')
    >>> st = shortproc(st=st, lowcut=None, highcut=9, filt_order=3,
    ...                samp_rate=20, debug=0)
    >>> print(st[0])
    AF.LABE..SHZ | 2013-09-01T04:10:35.700000Z - 2013-09-01T04:12:05.650000Z \
| 20.0 Hz, 1800 samples

    .. rubric:: Example, high-pass

    >>> from obspy import read
    >>> from eqcorrscan.utils.pre_processing import shortproc
    >>> # Get the path to the test data
    >>> import eqcorrscan
    >>> import os
    >>> TEST_PATH = os.path.dirname(eqcorrscan.__file__) + '/tests/test_data'
    >>> st = read(TEST_PATH + '/WAV/TEST_/2013-09-01-0410-35.DFDPC_024_00')
    >>> st = shortproc(st=st, lowcut=2, highcut=None, filt_order=3,
    ...                samp_rate=20, debug=0)
    >>> print(st[0])
    AF.LABE..SHZ | 2013-09-01T04:10:35.700000Z - 2013-09-01T04:12:05.650000Z \
| 20.0 Hz, 1800 samples