def network_trigger(st, parameters, thr_coincidence_sum, moveout,<EOL>max_trigger_length=<NUM_LIT>, despike=True, debug=<NUM_LIT:0>):
triggers = []<EOL>trace_ids = [tr.id for tr in st]<EOL>trace_ids = dict.fromkeys(trace_ids, <NUM_LIT:1>)<EOL>if debug > <NUM_LIT:3>:<EOL><INDENT>print('<STR_LIT>')<EOL>for tr in st:<EOL><INDENT>triggers += _channel_loop(tr=tr, parameters=parameters,<EOL>max_trigger_length=max_trigger_length,<EOL>despike=despike, debug=debug)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>parameters = [par.__dict__ for par in parameters]<EOL>pool = Pool(processes=cpu_count())<EOL>results = [pool.apply_async(_channel_loop,<EOL>args=(tr, parameters, max_trigger_length,<EOL>despike, debug))<EOL>for tr in st]<EOL>pool.close()<EOL>triggers = [p.get() for p in results]<EOL>pool.join()<EOL>triggers = [item for sublist in triggers for item in sublist]<EOL><DEDENT>triggers.sort()<EOL>if debug > <NUM_LIT:0>:<EOL><INDENT>details = True<EOL><DEDENT>else:<EOL><INDENT>details = False<EOL><DEDENT>print('<STR_LIT>')<EOL>coincidence_triggers = []<EOL>last_off_time = <NUM_LIT:0.0><EOL>while triggers:<EOL><INDENT>on, off, tr_id, cft_peak, cft_std = triggers.pop(<NUM_LIT:0>)<EOL>event = {}<EOL>event['<STR_LIT:time>'] = UTCDateTime(on)<EOL>event['<STR_LIT>'] = [tr_id.split("<STR_LIT:.>")[<NUM_LIT:1>]]<EOL>event['<STR_LIT>'] = [tr_id]<EOL>event['<STR_LIT>'] = trace_ids[tr_id]<EOL>if details:<EOL><INDENT>event['<STR_LIT>'] = [cft_peak]<EOL>event['<STR_LIT>'] = [cft_std]<EOL><DEDENT>for trigger in triggers:<EOL><INDENT>tmp_on, tmp_off, tmp_tr_id, tmp_cft_peak, tmp_cft_std = trigger<EOL>if tmp_tr_id in event['<STR_LIT>']:<EOL><INDENT>continue<EOL><DEDENT>if tmp_on <= off + moveout:<EOL><INDENT>event['<STR_LIT>'].append(tmp_tr_id.split("<STR_LIT:.>")[<NUM_LIT:1>])<EOL>event['<STR_LIT>'].append(tmp_tr_id)<EOL>event['<STR_LIT>'] += trace_ids[tmp_tr_id]<EOL>if details:<EOL><INDENT>event['<STR_LIT>'].append(tmp_cft_peak)<EOL>event['<STR_LIT>'].append(tmp_cft_std)<EOL><DEDENT>off = max(off, tmp_off)<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>if event['<STR_LIT>'] < thr_coincidence_sum:<EOL><INDENT>continue<EOL><DEDENT>if off == last_off_time:<EOL><INDENT>continue<EOL><DEDENT>event['<STR_LIT>'] = off - on<EOL>if details:<EOL><INDENT>weights = np.array([trace_ids[i] for i in event['<STR_LIT>']])<EOL>weighted_values = np.array(event['<STR_LIT>']) * weights<EOL>event['<STR_LIT>'] = weighted_values.sum() / weights.sum()<EOL>weighted_values = np.array(event['<STR_LIT>']) * weights<EOL>event['<STR_LIT>'] =(np.array(event['<STR_LIT>']) * weights).sum() / weights.sum()<EOL><DEDENT>coincidence_triggers.append(event)<EOL>last_off_time = off<EOL><DEDENT>if debug > <NUM_LIT:1>:<EOL><INDENT>print('<STR_LIT>')<EOL>pprint(coincidence_triggers)<EOL><DEDENT>print('<STR_LIT>' % len(coincidence_triggers))<EOL>return coincidence_triggers<EOL>
Main function to compute triggers for a network of stations.
Computes single-channel characteristic functions using given parameters,
then combines these to find network triggers on a number of stations
within a set moveout window.

:type st: obspy.core.stream.Stream
:param st: Stream to compute detections within
:type parameters: list
:param parameters: List of parameter class
:type thr_coincidence_sum: int
:param thr_coincidence_sum:
    Minimum number of stations required to raise a network trigger.
:type moveout: float
:param moveout: Window to find triggers within in the network detection \
    stage.
:type max_trigger_length: float
:param max_trigger_length: Maximum trigger length in seconds, used to \
    remove long triggers - can set to False to not use.
:type despike: bool
:param despike: Whether to apply simple despiking routine or not
:type debug: int
:param debug: Debug output level, higher is more output.

:returns: List of triggers
:rtype: list

.. rubric:: Example

>>> from obspy import read
>>> from eqcorrscan.utils.trigger import TriggerParameters, network_trigger
>>> st = read("https://examples.obspy.org/" +
...           "example_local_earthquake_3stations.mseed")
>>> parameters = []
>>> for tr in st:
...    parameters.append(TriggerParameters({'station': tr.stats.station,
...                                          'channel': tr.stats.channel,
...                                          'sta_len': 0.5,
...                                          'lta_len': 10.0,
...                                          'thr_on': 10.0,
...                                          'thr_off': 3.0,
...                                          'lowcut': 2.0,
...                                          'highcut': 15.0}))
>>> triggers = network_trigger(st=st, parameters=parameters,
...                            thr_coincidence_sum=5, moveout=30,
...                            max_trigger_length=60, despike=False)
Looking for coincidence triggers ...
Found 1 Coincidence triggers