Reference for the pySAB API
Class representing a SAB dataset
__init__ (matlab_dataset_dirpath, subject_id) |
Initialize self. |
downsample (decimate_order) |
Downsample the data along the time axis. |
plot_erp (channel_desc[, plot_ci, plot_hits, …]) |
Plot the evoked response averaged over trials |
plot_electrode_erps (elec_desc[, plot_ci, …]) |
Plot on the same figure the ERPs for each channel of the selected electrode |
plot_itpc (channel_desc[, trial_pos, …]) |
Plot the ITPC, Inter-Trial Phase Coherence |
create_features ([chan_sel, electrode_sel, …]) |
Create a TimeFeatures instance from the current dataset |
save ([dir_path, filename]) |
Save the SabDataset instance to a pickle file using the pickle module. |
save_sig_to_file (chanpos[, trialpos, output_dir]) |
Save the signal to a file |
Class for the visualization of features across time from the raw amplitude data. Interface between the other classes
Extract feature, order them, access to data :
extract_feature ([feature_type]) |
Compute features from the original data data_ori and add them to the feature array data |
get_data (**kwargs) |
Select the data corresponding to selected feature and/or labels and/or time points. |
sort_features ([sorting_variable]) |
Sort the features according to sorting_variable |
sort_trials ([sorting_variable, direction]) |
Sort the data trial order given the sorting variable. |
feature_name2pos (feature_sel_names) |
Return the feature names from the feature positions |
feature_pos2name (feature_pos) |
Return the feature position from the feature names |
get_feature_pos ([feature_pos, feature_type, …]) |
Get the feature position from feature type or/and feature channel name |
get_label_key_from_value (dict_value) |
Return the label key from the value of the dictionnary attribute label_dict |
sample2time (sample) |
Return the time in seconds from the sample index |
time2sample (t_sec) |
Return the sample index from the time in seconds |
Correlation analysis, feature importance, clustering
compute_feature_importance (label_keys[, …]) |
Compute feature importance using forest of decitions trees. |
compute_correlation_hits_reaction_times ([…]) |
Compute and plot the correlation (Pearson or Spearman) between selected features and reaction times (if defined). |
compute_correlation_feature_target (**kwargs) |
Compute and plot the correlation between the selected features for 2 specified conditions. |
interactive_feature_rt_correlation ([…]) |
Interactive plot of the correlation between feature and reaction times (for hits trials) |
cluster_data (cluster_algo[, do_plot, ax, cb_ax]) |
Cluster the data selected by **kwargs - see timefeatures.get_data() - Return the cross-tabulation of the predicted versus true labels |
Visualization
plot_feature_erp ([plot_traces, ax]) |
Plot the feature evolution across time. |
plot_feature_erpimage ([ax, cax]) |
Plot the erp-image of the selected features |
plot_feature_distribution ([ax]) |
Plot the distribution of features at a certain time point for selected labels. |
Clustering internal functions
cluster_data_2d |
|
get_clustering_algo |
Interactive visualization of features
sab_tkinterwindow.TimeFeatureWindow
: Tkinter GUI for visualizing features evolution and analysis
Class for computing features from the raw amplitude
featureextracter.FeatureExtracter
__init__ (data_ori, srate, n_chan, n_pnts, …) |
Initialize self. | ||
stft_on_data ([win_name, win_dur, overlap, …]) |
|
||
dwt_on_data (wav_name[, scale_type, …]) |
Apply the Discrete Wavelet Transform on the data | ||
cwt_on_data ([wav_name, pfreqs, scale_type, …]) |
Apply the Continous Wavelet Transform to the data data_ori , return both power and phase average over the frequency bands. |
||
filter_hilbert_on_data (center_freq, bandwidth) |
Estimate the phase of the data data_ori using band-pass filtering and the Hilbert transform. |
||
bandpower_on_data ([filt_type, filt_order, …]) |
|
stft_1d (x, srate, freq_bands[, win_name, …]) |
Compute the short-time Fourier transform |
dwt_1d (x, srate, wav_name[, do_plot, …]) |
Discrete wavelet transform for input 1D array. |
cwt_1d (x, srate, freq_bands[, freqs, …]) |
Compute the Continuous Wavelet Transform for a 1 dimension input array x |
bandpower_1d (x, srate, freq_bands[, …]) |
Compute the power of input signal x in the different frequency bands defined by freq_bands . |
tf_scaling (tf_power_mat, base_ind_start, …) |
Scale / Normalize the time-frequency map given the baseline time. |
compute_band_mean (data, freqs, freq_bands[, …]) |
Compute the mean of data over the frequency bands defined by freq_bands . |
Class for running decoding/MVPA/Classification analyses from the time features
time_decoder.TimeDecoder
__init__ |
|
decode |
|
decode_mpver |
|
single_feature_decoding |
|
temporal_generalization |
|
plot_scores |
decode_time_step (X_i, y, y_dict, clf, scaler) |
Run a classification of data X_i with labels y using a Stratified K-Folds cross-validation where n_splits is the number of folds. |
temporal_generalization_step (X, i_time, y, …) |
Temporal generalization step. |
Various functions for extracting and analyzing the phase of iEEG signals
itpc (x_trials, fs, filt_cf, filt_bw[, …]) |
Compute and plot the Inter-Trial Phase Clustering |
compute_robust_estimation (x_raw, fs, fmin, …) |
Compute the robust estimation of the phase using the method described in [R4316a3c55ff1-1]. |
compute_analytical_signal (x_filtered, fs[, …]) |
Compute the analytical signal of the band-pass filter x_filtered and return the analytical amplitude, phase (wrap and unwrap) and frequency. |
bp_filter_1d (x, fs, ftype, wn[, order, …]) |
Band Pass Filtering for 1D input data |
plot_analytical_signal (x, fs) |
Compute the analytical signal from the signal x and plot the instantaneous enveloppe, phase and frequency |
plot_complex_tracjectory |