Skip to content

Instantly share code, notes, and snippets.

View jdmonaco's full-sized avatar
🤖

Joseph Monaco jdmonaco

🤖
View GitHub Profile
@jdmonaco
jdmonaco / kempter.py
Last active February 19, 2022 20:12
Circular-linear correlation for regressing onto circular phase variables based on the method established by: Kempter R, Leibold C, Buzsáki G, Diba K, Schmidt R. Quantifying circular-linear associations: hippocampal phase precession. J Neurosci Methods. 2012;207(1):113–24. doi:10.1016/j.jneumeth.2012.03.007.
"""
Circular-linear correlation for regressing onto circular phase variables
based on the method established by:
Kempter R, Leibold C, Buzsáki G, Diba K, Schmidt R. Quantifying
circular-linear associations: hippocampal phase precession.
J Neurosci Methods. 2012;207(1):113–24.
doi:10.1016/j.jneumeth.2012.03.007.
Implemented By: @jdmonaco (github) / @j_d_monaco (twitter)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Spike train cross-correlogram methods.
"""
import time
import numpy as np
import matplotlib.pyplot as plt
from scipy import real
from scipy.fftpack import fft, ifft
@jdmonaco
jdmonaco / xcorr_maxlag.py
Created June 6, 2015 21:55
An example of a lag-limited correlation function for spike train data.
"""
Limited-lag numpy implementation of spike train cross-correlation.
"""
import numpy as np
def xcorr(a, b, maxlag=1.0, bins=128):
"""
Compute the cross-correlogram of two spike train arrays.
@jdmonaco
jdmonaco / user-link-system-wallpapers.sh
Created August 27, 2014 22:32
A quick script to link OS X Mavericks system desktop wallpapers into your user '~/Library/Desktop Pictures' folder. This way you can delete links to wallpapers you don't want.
@jdmonaco
jdmonaco / skim-mate-relay.scpt
Created June 11, 2014 20:24
To fix backward-search synchronization (SyncTeX) between Skim and TextMate set Skim > Preferences > Sync > Preset to "Custom" with the command pointing to this script file and Arguments set to '%line "%file"' (without the single quotes). The problem is that (for as yet unknown reasons) the Shift-Cmd-click in Skim started opening a new editor win…
#!/usr/bin/osascript
on run argv
set mateScript to "mate -l " & item 1 of argv & " " & item 2 of argv
tell application "Terminal"
set thisTab to do script mateScript
set visible of window 1 to false
delay 0.5
@jdmonaco
jdmonaco / organize-photos.py
Last active October 29, 2021 20:35 — forked from cliss/organize-photos.py
Update of @cliss's update of Dr. Drang's photo management scripts. Replaced shutil calls with subprocess calls. Added a log file that gets written to the destination directory. Source can now be a directory tree (using os.walk). Replaced comments/docstrings with slightly better code organization and function names. Replaced path string concatena…
#!/usr/bin/env python
"""
organize-photos.py - Organize an unstructured folder tree of photos and movie
files into a month-and-year folder structure.
Note: This is a minor rewrite of @cliss's extension [1,2] of @drdrang's
photo management scripts [3], and includes a tweak from @jamiepinkham [4,5].
The lists of raw [6] and video [7] file extensions were found elsewhere.
@jdmonaco
jdmonaco / chrome_navigate.scpt
Created August 25, 2013 17:20
For browser-based presentations and other uses, it is useful to control browser navigation from outside the browser. This Applescript can be run from the command line or even other scripts (e.g., a python daemon that receives remote events) to send arrow key events to the currently active Chrome window. Optionally specify "command" to send a com…
#!/usr/bin/osascript
on run argv
set browser to "Chrome"
set leftKey to 123
set upKey to 126
set downKey to 125
set rightKey to 124
@jdmonaco
jdmonaco / makegif
Created August 18, 2013 20:45
TextExpander snippet for creating an animated gif on the command-line using the ImageMagick convert utility.
convert -delay %filltext:name=delay x0.01s:default=10:width=2% -resize %filltext:name=width:default=256:width=3% %filltext:name=glob:default=IMG*.JPG% %filltext:name=output:default=output.gif%
@jdmonaco
jdmonaco / t_welch.py
Last active February 2, 2021 10:00
Welch's t-test for two samples, not assuming equal sample size or variance. Requires Python, NumPy, and SciPy.
from collections import namedtuple
import numpy as np
import scipy.stats as st
TtestResults = namedtuple("Ttest", "T p")
def t_welch(x, y, tails=2):
"""
Welch's t-test for two unequal-size samples, not assuming equal variances