SpikeAnalysisResult#
- class neurodent.visualization.SpikeAnalysisResult(result_sas: list[SortingAnalyzer], result_mne: RawArray | None = None, animal_id: str | None = None, genotype: str | None = None, animal_day: str | None = None, bin_folder_name: str | None = None, metadata: DDFBinaryMetadata | None = None, channel_names: list[str] | None = None, assume_from_number=False) None[source]#
Bases:
AnimalFeatureParser- Parameters:
result_sas (list[SortingAnalyzer])
result_mne (RawArray)
animal_id (str)
genotype (str)
animal_day (str)
bin_folder_name (str)
metadata (DDFBinaryMetadata)
channel_names (list[str])
- __init__(result_sas: list[SortingAnalyzer], result_mne: RawArray | None = None, animal_id: str | None = None, genotype: str | None = None, animal_day: str | None = None, bin_folder_name: str | None = None, metadata: DDFBinaryMetadata | None = None, channel_names: list[str] | None = None, assume_from_number=False) None[source]#
- Parameters:
result (
list[si.SortingAnalyzer]) – Result comes from AnimalOrganizer.compute_spike_analysis(). Each SortingAnalyzer is a single channel.animal_id (
str, optional) – Identifier for the animal where result was computed from. Defaults to None.genotype (
str, optional) – Genotype of animal. Defaults to None.channel_names (
list[str], optional) – List of channel names. Defaults to None.assume_channels (
bool, optional) – If true, assumes channel names according to AnimalFeatureParser.DEFAULT_CHNUM_TO_NAME. Defaults to False.result_sas (list[SortingAnalyzer])
result_mne (RawArray | None)
animal_day (str | None)
bin_folder_name (str | None)
metadata (DDFBinaryMetadata | None)
- Return type:
None
- convert_to_mne(chunk_len: float = 60, save_raw=True) RawArray[source]#
- Return type:
RawArray- Parameters:
chunk_len (float)
- save_fif_and_json(folder: str | Path, convert_to_mne=True, make_folder=True, slugify_filebase=True, save_abbrevs_as_chnames=False, overwrite=False)[source]#
Archive spike analysis result into the folder specified, as a fif and json file.
- Parameters:
folder (
str | Path) – Destination folder to save results toconvert_to_mne (
bool, optional) – If True, convert the SortingAnalyzers to a MNE RawArray if self.result_mne is None. Defaults to True.make_folder (
bool, optional) – If True, create the folder if it doesn’t exist. Defaults to True.slugify_filebase (
bool, optional) – If True, slugify the filebase (replace special characters). Defaults to True.save_abbrevs_as_chnames (
bool, optional) – If True, save the channel abbreviations as the channel names in the json file. Defaults to False.overwrite (
bool, optional) – If True, overwrite the existing files. Defaults to False.
- static convert_sas_to_mne(sas: list[SortingAnalyzer], chunk_len: float = 60) RawArray[source]#
Convert a list of SortingAnalyzers to a MNE RawArray.
- Parameters:
sas (
list[si.SortingAnalyzer]) – The list of SortingAnalyzers to convertchunk_len (
float, optional) – The length of the chunks to use for the conversion. Defaults to 60.
- Returns:
The converted RawArray, with spikes labeled as annotations
- Return type:
mne.io.RawArray
- static convert_sa_to_np(sa: SortingAnalyzer, chunk_len: float = 60) ndarray[source]#
Convert a SortingAnalyzer to an MNE RawArray.
- Parameters:
sa (
si.SortingAnalyzer) – The SortingAnalyzer to convert. Must have only 1 channel.chunk_len (
float, optional) – The length of the chunks to use for the conversion. Defaults to 60.
- Returns:
The converted traces
- Return type:
np.ndarray