# 4.6.5.1.3. eqcorrscan.core.template_gen.from_client

`eqcorrscan.core.template_gen.``from_client`(catalog, client_id, lowcut, highcut, samp_rate, filt_order, length, prepick, swin, process_len=86400, data_pad=90, all_horiz=False, delayed=True, plot=False, debug=0, return_event=False, min_snr=None)

  Generate multiplexed template from FDSN client.

  Function to generate templates from an FDSN client. Must be given an obspy.Catalog class and the client_id as input. The function returns a list of obspy.Stream classes containing steams for each desired template.

  Parameters: | catalog (obspy.core.event.Catalog) Catalog class containing desired template events client_id (str) Name of the client, either url, or Obspy mappable (see the `obspy.clients.fdsn` documentation). lowcut (float) Low cut (Hz), if set to None will not apply a lowcut. highcut (float) High cut (Hz), if set to None will not apply a highcut. samp_rate (float) New sampling rate in Hz. filt_order (int) Filter level (number of corners). length (float) Extract length in seconds. prepick (float) Pre-pick time in seconds swin (str) Either ‘all’, ‘P’ or ‘S’, to select which phases to output. process_len (int) Length of data in seconds to download and process. data_pad (int) Length of data (in seconds) required before and after any event for processing, use to reduce edge-effects of filtering on the templates. all_horiz (bool) To use both horizontal channels even if there is only a pick on one of them. Defaults to False. delayed (bool) If True, each channel will begin relative to it’s own pick-time, if set to False, each channel will begin at the same time. plot (bool) Plot templates or not. debug (int) Level of debugging output, higher=more return_event (bool) Whether to return the event and process length or not. min_snr (float) Minimum signal-to-noise ratio for a channel to be included in the template, where signal-to-noise ratio is calculated as the ratio of the maximum amplitude in the template window to the rms amplitude in the whole window given.
  Returns: | List of `obspy.core.stream.Stream` Templates
  Return type: | list

  Note

  process_len should be set to the same length as used when computing detections using match_filter.match_filter, e.g. if you read in day-long data for match_filter, process_len should be 86400.

  Example

      >>> from obspy.clients.fdsn import Client
      >>> from eqcorrscan.core.template_gen import from_client
      >>> client = Client('NCEDC')
      >>> catalog = client.get_events(eventid='72572665', includearrivals=True)
      >>> # We are only taking two picks for this example to speed up the
      >>> # example, note that you don't have to!
      >>> catalog[0].picks = catalog[0].picks[0:2]
      >>> templates = from_client(catalog=catalog, client_id='NCEDC',
      ...                         lowcut=2.0, highcut=9.0, samp_rate=20.0,
      ...                         filt_order=4, length=3.0, prepick=0.15,
      ...                         swin='all', process_len=300,
      ...                         all_horiz=True)
      Pre-processing data
      >>> templates[0].plot(equal_scale=False, size=(800,600))