Skip to content

Instantly share code, notes, and snippets.

View smestern's full-sized avatar

smestern smestern

View GitHub Profile
@smestern
smestern / testSW.py
Last active November 9, 2023 10:57 — forked from ctralie/testOt.py
2D Histogram Sliced Wasserstein Distance via Scipy.stats
"""
Original Docstring -
Programmer: Chris Tralie
Purpose: To use the POT library (https://github.com/rflamary/POT)
to compute the Entropic regularized Wasserstein distance
between points on a 2D grid
Modified by Sam Mestern
Shows the usage of the sliced wasserstein distance to measure the distance between two
@smestern
smestern / neuropixels_dl.py
Last active October 24, 2019 20:06
Downloads all of the currently available neuropixels-NWBs from allen insitute
import os
import numpy as np
import pandas as pd
from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache ##Requires allensdk 1.0.2 or higher
manifest_path = os.path.join("C:\\cell_types\\", "manifest.json") ##Need to use double slashes in python for paths. Data will be saved to this folder
cache = EcephysProjectCache.from_warehouse(manifest=manifest_path) ##Declares the cache object to be called later.
#sessions = cache._get_sessions()
cell_ids_df = cache.get_session_table() ## Returns a session table csv, Its huge and takes ~10min to download the first time.
@smestern
smestern / abf_unchained.py
Last active September 2, 2020 17:47
Create an 'unknown pleasures'-style artwork out of a real neuron's action potentials (Or really any other signal recorded in abf format) [Utilizes matplotlib's unchained.py and pyabf]
"""
========================
MATPLOTLIB **UNCHAINED**
========================
Orignal Author: Nicolas P. Rougier
This is a modified version.