"""
Preprocess pipeline
"""
import datetime
import logging
import os.path

import numpy as np

from .. import read_config
from ..batch import BatchProcessorFactory

from .detect import threshold_detection
from .filter import whitening_matrix, whitening, localized_whitening_matrix, whitening_score, butterworth
from .score import get_score_pca, get_pca_suff_stat, get_pca_projection
from .standarize import standarize, sd
from ..neuralnetwork import NeuralNetDetector, NeuralNetTriage, nn_detection

# remove this
Q = None
Q_score = None


def run():
    """Execute preprocessing pipeline

    Returns
    -------
    score: list
        List of size n_channels, each list contains a (clear spikes x
        number of features x number of channels) multidimensional array
        score for every clear spike

    clear_index: list
        List of size n_channels, each list contains the indexes in
        spike_times (first column) where the spike was clear

    spike_times: list
        List with n_channels elements, each element contains spike times
        in the first column and [SECOND COLUMN?]

    Examples
    --------

    .. literalinclude:: ../examples/preprocess.py
    """
    logger = logging.getLogger(__name__)

    start_time = datetime.datetime.now()
    time = {'f': 0, 's': 0, 'd': 0, 'w': 0, 'b': 0, 'e': 0}