<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def detect_Concordia(dat_orig, s_freq, time, opts):
 """Spindle detection, experimental Concordia method. Similar to Moelle 2011 and Nir2011. Parameters dat_orig : ndarray (dtype='float') vector with the data for one channel s_freq : float sampling frequency opts : instance of 'DetectSpindle' 'det_butter' : dict parameters for 'butter', 'moving_rms' : dict parameters for 'moving_rms' 'smooth' : dict parameters for 'smooth' 'det_thresh' : float low detection threshold 'det_thresh_hi' : float high detection threshold 'sel_thresh' : float selection threshold 'duration' : tuple of float min and max duration of spindles Returns ------- list of dict list of detected spindles dict 'det_value_lo', 'det_value_hi' with detection values, 'sel_value' with selection value float spindle density, per 30-s epoch """

    dat_det = transform_signal(dat_orig, s_freq, 'butter', opts.det_butter)
    dat_det = transform_signal(dat_det, s_freq, 'moving_rms', opts.moving_rms)
    dat_det = transform_signal(dat_det, s_freq, 'smooth', opts.smooth)

    det_value_lo = define_threshold(dat_det, s_freq, 'mean+std',
                                    opts.det_thresh)
    det_value_hi = define_threshold(dat_det, s_freq, 'mean+std',
                                    opts.det_thresh_hi)
    sel_value = define_threshold(dat_det, s_freq, 'mean+std', opts.sel_thresh)

    events = detect_events(dat_det, 'between_thresh',
                           value=(det_value_lo, det_value_hi))

    if events is not None:
        events = _merge_close(dat_det, events, time, opts.tolerance)

        events = select_events(dat_det, events, 'above_thresh', sel_value)

        events = within_duration(events, time, opts.duration)
        events = _merge_close(dat_det, events, time, opts.min_interval)
        events = remove_straddlers(events, time, s_freq)

        power_peaks = peak_in_power(events, dat_orig, s_freq, opts.power_peaks)
        powers = power_in_band(events, dat_orig, s_freq, opts.frequency)
        sp_in_chan = make_spindles(events, power_peaks, powers, dat_det,
                                   dat_orig, time, s_freq)

    else:
        lg.info('No spindle found')
        sp_in_chan = []

    values = {'det_value_lo': det_value_lo, 'sel_value': sel_value}

    density = len(sp_in_chan) * s_freq * 30 / len(dat_orig)

    return sp_in_chan, values, density