Skip to content

Instantly share code, notes, and snippets.

View SherazKhan's full-sized avatar

Sheraz Khan SherazKhan

  • Massachusetts General Hospital (MGH), Harvard Medical School and Massachusetts Institute of Technology (MIT)
  • Boston
  • X @dr_sheraz
View GitHub Profile
@SherazKhan
SherazKhan / Audio Feature Extraction.py
Created April 25, 2022 15:42 — forked from gvyshnya/Audio Feature Extraction.py
Audio Feature Extraction from Audio Files using Librosa
def extract_feature_means(audio_file_path: str) -> pd.DataFrame:
# config settings
number_of_mfcc = c.NUMBER_OF_MFCC
# 1. Importing 1 file
y, sr = librosa.load(audio_file_path)
# Trim leading and trailing silence from an audio signal (silence before and after the actual audio)
signal, _ = librosa.effects.trim(y)
@SherazKhan
SherazKhan / plot_brainstorm_data.m
Created June 14, 2018 14:18 — forked from ftadel/plot_brainstorm_data.m
Calling MNE-Python in Matlab scripts
function plot_brainstorm_data()
% ============================
% Brainstorm tutorial datasets
% ============================
%
% Here we compute the evoked from raw for the Brainstorm
% tutorial dataset. For comparison, see [1]_ and:
%
% http://neuroimage.usc.edu/brainstorm/Tutorials/MedianNerveCtf
%
@SherazKhan
SherazKhan / distcorr.py
Created June 20, 2017 23:43 — forked from wladston/distcorr.py
Distance correlation with p-value
from scipy.spatial.distance import pdist, squareform
import numpy as np
import random
import copy
def distcorr(Xval, Yval, pval=True, nruns=500):
""" Compute the distance correlation function, returning the p-value.
Based on Satra/distcorr.py (gist aa3d19a12b74e9ab7941)
@SherazKhan
SherazKhan / dcor.py
Created June 20, 2017 23:42 — forked from kailashbuki/dcor.py
Computes the distance correlation between two matrices in Python.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Computes the distance correlation between two matrices.
https://en.wikipedia.org/wiki/Distance_correlation
"""
import numpy as np
from scipy.spatial.distance import pdist, squareform