def construct(self, method, name, lowcut, highcut, samp_rate, filt_order,<EOL>prepick, **kwargs):
if method in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>']:<EOL><INDENT>raise NotImplementedError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>streams, events, process_lengths = template_gen.template_gen(<EOL>method=method, lowcut=lowcut, highcut=highcut,<EOL>filt_order=filt_order, samp_rate=samp_rate, prepick=prepick,<EOL>return_event=True, **kwargs)<EOL>self.name = name<EOL>st = streams[<NUM_LIT:0>]<EOL>event = events[<NUM_LIT:0>]<EOL>process_length = process_lengths[<NUM_LIT:0>]<EOL>for tr in st:<EOL><INDENT>if not np.any(tr.data.astype(np.float16)):<EOL><INDENT>warnings.warn('<STR_LIT>'<EOL>'<STR_LIT>' % tr.id)<EOL>st.remove(tr)<EOL><DEDENT><DEDENT>self.st = st<EOL>self.lowcut = lowcut<EOL>self.highcut = highcut<EOL>self.filt_order = filt_order<EOL>self.samp_rate = samp_rate<EOL>self.process_length = process_length<EOL>self.prepick = prepick<EOL>self.event = event<EOL>return self<EOL>
Construct a template using a given method.

:param method:
    Method to make the template,
    see :mod:`eqcorrscan.core.template_gen` for possible methods.
:type method: str
:type name: str
:param name: Name for the template
:type lowcut: float
:param lowcut:
    Low cut (Hz), if set to None will not apply a lowcut
:type highcut: float
:param highcut:
    High cut (Hz), if set to None will not apply a highcut.
:type samp_rate: float
:param samp_rate:
    New sampling rate in Hz.
:type filt_order: int
:param filt_order:
    Filter level (number of corners).
:type prepick: float
:param prepick: Pre-pick time in seconds

.. Note::
    methods `from_meta_file`, `from_seishub`, `from_client` and
    `multi_template_gen` are not accommodated in this function and must
    be called from Tribe.construct as these generate multiple
    templates.

.. Note::
    Calls functions from `eqcorrscan.core.template_gen`, see these
    functions for details on what further arguments are required.

.. rubric:: Example

>>> # Get the path to the test data
>>> import eqcorrscan
>>> import os
>>> TEST_PATH = (
...     os.path.dirname(eqcorrscan.__file__) + '/tests/test_data')
>>> sac_files = glob.glob(TEST_PATH + '/SAC/2014p611252/*')
>>> template = Template().construct(
...     method='from_sac', name='test', lowcut=2.0, highcut=8.0,
...     samp_rate=20.0, filt_order=4, prepick=0.1, swin='all',
...     length=2.0, sac_files=sac_files)
>>> print(template) # doctest: +NORMALIZE_WHITESPACE
Template test:
 12 channels;
 lowcut: 2.0 Hz;
 highcut: 8.0 Hz;
 sampling rate 20.0 Hz;
 filter order: 4;
 process length: 300.0 s


This will raise an error if the method is unsupported:

>>> template = Template().construct(
...     method='from_meta_file', name='test', lowcut=2.0, highcut=8.0,
...     samp_rate=20.0, filt_order=4, prepick=0.1, swin='all',
...     length=2.0) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
NotImplementedError: Method is not supported, use \
Tribe.construct instead.