spikeAnalysis_utils module

spikeAnalysis_utils.construct_artefact_free_edf_signal(sig_dirpath, interest_csv_filepath, sep=';', out_dirpath=[])

From a csv file containing the periods of interest (free of artefacts), construct an EDF file without the artefact periods. The output files are then synchronized with the SpykingCircus spike times.

Parameters:
sig_dirpath : str

Path of the directory containing the EDF signals

interest_csv_filepath : str

Path of the file containing the periofs of interest (no artefact). This file must be a 3 column csv files. 1st column contain the input EDF filename (in sig_dirpath), the 2nd column contain the starting time (s) of the artefact, the 3rd colum contain the ending time of the artefact. Each row represents 1 artefact. 1-line header.

sep : str (default: ‘;’)

Csv file delimiter

out_dirpath : str | none (default)

Path of the directory where the output files are saved

spikeAnalysis_utils.createuniquedir(dirpath)

Create a unique directory from a path. If …/…/dir_name already exists, …/…/dir_name_2 is returned.

Parameters:
dirpath : str

Directory path

Returns:
unique_dir_path : str

Unique directory path

spikeAnalysis_utils.find_original_time(x_target, filename, keep_start, keep_end)

From the Spyking-Circus spike time, get the original time in the original EEG file. This EEG file was first cut to remove artefacts. Start end end time of artefact-free periods are stored in arguments keep_start and keep_end. Multiples files may have been used to do the spike-sorting, thus filename contains the filename for each artefact-free period.

Parameters:
x_target : float

Time of the Spyking-Circus spike

filename : array

Filename for each artefact-free period

keep_start : array

Start time (s) of each artefact-free period

keep_end : array

End time (s) of each artefact-free period

Returns:
y_ori : float

Time of the spike in the original EEG file

filename_i : str

Name of the file containing the spike