<commit_before>import os
import logging
import datetime

from yass import read_config
from yass.templates.util import get_templates, align_templates, merge_templates
from yass.templates.clean import clean_up_templates
from yass.util import file_loader  # check_for_files, LoadFile, file_loader


# @check_for_files(filenames=[LoadFile('templates.npy')],
#                  mode='values', relative_to='output_directory',
#                  auto_save=True, prepend_root_folder=True)
def run(spike_train, tmp_loc, output_directory='tmp/',
        recordings_filename='standarized.bin',
        if_file_exists='skip', save_results=False):
    """Compute templates


    Parameters
    ----------
    spike_train: numpy.ndarray, str or pathlib.Path
        Spike train from cluster step or path to npy file

    tmp_loc: np.array(n_templates)
        At which channel the clustering is done.

    output_directory: str, optional
        Output directory (relative to CONFIG.data.root_folder) used to load
        the recordings to generate templates, defaults to tmp/

    recordings_filename: str, optional
        Recordings filename (relative to CONFIG.data.root_folder/
        output_directory) used to generate the templates, defaults to
        standarized.bin

    if_file_exists: str, optional
      One of 'overwrite', 'abort', 'skip'. Control de behavior for the
      templates.npy. file If 'overwrite' it replaces the files if exists,<commit_msg>enables check for files in templates<commit_after>import os
import logging
import datetime

from yass import read_config
from yass.templates.util import get_templates, align_templates, merge_templates
from yass.templates.clean import clean_up_templates
from yass.util import file_loader, check_for_files, LoadFile, file_loader


@check_for_files(filenames=[LoadFile('templates.npy'),
                            LoadFile('spike_train.npy'),
                            LoadFile('groups.pickle'),
                            LoadFile('idx_good_templates.npy')],
                 mode='values', relative_to='output_directory',
                 auto_save=True, prepend_root_folder=True)
def run(spike_train, tmp_loc, output_directory='tmp/',
        recordings_filename='standarized.bin',
        if_file_exists='skip', save_results=False):
    """Compute templates

    Parameters
    ----------
    spike_train: numpy.ndarray, str or pathlib.Path
        Spike train from cluster step or path to npy file

    tmp_loc: np.array(n_templates)
        At which channel the clustering is done.

    output_directory: str, optional
        Output directory (relative to CONFIG.data.root_folder) used to load
        the recordings to generate templates, defaults to tmp/

    recordings_filename: str, optional
        Recordings filename (relative to CONFIG.data.root_folder/
        output_directory) used to generate the templates, defaults to
        standarized.bin

    if_file_exists: str, optional
      One of 'overwrite', 'abort', 'skip'. Control de behavior for the
      templates.npy. file If 'overwrite' it replaces the files if exists,
{'fraction_non_alphanumeric': 0.07843770174306004, 'fraction_numerical': 0.0, 'mean_word_length': 3.2336065573770494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2101543', 'n_tokens_mistral': 848, 'n_tokens_neox': 828, 'n_words': 257}