def subspace_detect(detectors, stream, threshold, trig_int, moveout=<NUM_LIT:0>,<EOL>min_trig=<NUM_LIT:1>, parallel=True, num_cores=None):
from multiprocessing import Pool, cpu_count<EOL>parameters = []<EOL>detections = []<EOL>for detector in detectors:<EOL><INDENT>parameter = (detector.lowcut, detector.highcut,<EOL>detector.filt_order, detector.sampling_rate,<EOL>detector.multiplex, detector.stachans)<EOL>if parameter not in parameters:<EOL><INDENT>parameters.append(parameter)<EOL><DEDENT><DEDENT>for parameter_set in parameters:<EOL><INDENT>parameter_detectors = []<EOL>for detector in detectors:<EOL><INDENT>det_par = (detector.lowcut, detector.highcut, detector.filt_order,<EOL>detector.sampling_rate, detector.multiplex,<EOL>detector.stachans)<EOL>if det_par == parameter_set:<EOL><INDENT>parameter_detectors.append(detector)<EOL><DEDENT><DEDENT>stream, stachans =_subspace_process(<EOL>streams=[stream.copy()], lowcut=parameter_set[<NUM_LIT:0>],<EOL>highcut=parameter_set[<NUM_LIT:1>], filt_order=parameter_set[<NUM_LIT:2>],<EOL>sampling_rate=parameter_set[<NUM_LIT:3>], multiplex=parameter_set[<NUM_LIT:4>],<EOL>stachans=parameter_set[<NUM_LIT:5>], parallel=True, align=False,<EOL>shift_len=None, reject=False)<EOL>if not parallel:<EOL><INDENT>for detector in parameter_detectors:<EOL><INDENT>detections += _detect(<EOL>detector=detector, st=stream[<NUM_LIT:0>], threshold=threshold,<EOL>trig_int=trig_int, moveout=moveout, min_trig=min_trig,<EOL>process=False, extract_detections=False, debug=<NUM_LIT:0>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if num_cores:<EOL><INDENT>ncores = num_cores<EOL><DEDENT>else:<EOL><INDENT>ncores = cpu_count()<EOL><DEDENT>pool = Pool(processes=ncores)<EOL>results = [pool.apply_async(<EOL>_detect, args=(detector, stream[<NUM_LIT:0>], threshold, trig_int,<EOL>moveout, min_trig, False, False, <NUM_LIT:0>))<EOL>for detector in parameter_detectors]<EOL>pool.close()<EOL>try:<EOL><INDENT>_detections = [p.get() for p in results]<EOL><DEDENT>except KeyboardInterrupt as e:  <EOL><INDENT>pool.terminate()<EOL>raise e<EOL><DEDENT>pool.join()<EOL>for d in _detections:<EOL><INDENT>if isinstance(d, list):<EOL><INDENT>detections += d<EOL><DEDENT>else:<EOL><INDENT>detections.append(d)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return detections<EOL>
Conduct subspace detection with chosen detectors.

:type detectors: list
:param detectors:
    list of :class:`eqcorrscan.core.subspace.Detector` to be used
    for detection.
:type stream: obspy.core.stream.Stream
:param stream: Stream to detect within.
:type threshold: float
:param threshold:
    Threshold between 0 and 1 for detection, see :func:`Detector.detect`
:type trig_int: float
:param trig_int: Minimum trigger interval in seconds.
:type moveout: float
:param moveout:
    Maximum allowable moveout window for non-multiplexed, network
    detection.  See note.
:type min_trig: int
:param min_trig:
    Minimum number of stations exceeding threshold for non-multiplexed,
    network detection. See note in :func:`Detector.detect`.
:type parallel: bool
:param parallel: Whether to run detectors in parallel in groups.
:type num_cores: int
:param num_cores:
    How many cpu cores to use if parallel==True. If set to None (default),
    will use all available cores.

:rtype: list
:return:
    List of :class:`eqcorrscan.core.match_filter.Detection` detections.

.. Note::
    This will loop through your detectors using their detect method.
    If the detectors are multiplexed it will run groups of detectors with
    the same channels at the same time.