# 4.6.2.2.1. eqcorrscan.core.lag_calc._channel_loop

`eqcorrscan.core.lag_calc.``_channel_loop`(detection, template, min_cc, detection_id, interpolate, i, pre_lag_ccsum=None, detect_chans=0, horizontal_chans=['E', 'N', '1', '2'], vertical_chans=['Z'], debug=0)

  Inner loop for correlating and assigning picks.

  Utility function to take a stream of data for the detected event and write maximum correlation to absolute time as picks in an obspy.core.event.Event object. Only outputs picks for picks above min_cc.

  Parameters: | detection (obspy.core.stream.Stream) Stream of data for the slave event detected using template. template (obspy.core.stream.Stream) Stream of data as the template for the detection. min_cc (float) Minimum cross-correlation value to allow a pick to be made. detection_id (str) Detection ID to associate the event with. interpolate (bool) Interpolate the correlation function to achieve sub-sample precision. i (int) Used to track which process has occurred when running in parallel. pre_lag_ccsum (float) Cross-correlation sum before lag-calc, will check that the cross-correlation sum is increased by lag-calc (using all channels, ignoring min_cc) detect_chans (int) Number of channels originally used in detections, must match the number used here to allow for cccsum checking. horizontal_chans (list) List of channel endings for horizontal-channels, on which S-picks will be made. vertical_chans (list) List of channel endings for vertical-channels, on which P-picks will be made. debug (int) Debug output level 0-5.
  Returns: | Event object containing network, station, channel and pick information.
  Return type: | `obspy.core.event.Event`