Skip to content

Instantly share code, notes, and snippets.

View jmxpearson's full-sized avatar

John Pearson jmxpearson

View GitHub Profile
@jmxpearson
jmxpearson / covariance eigenvalues.ipynb
Created February 25, 2019 02:29
Eigenvalues and vectors of covariance matrix of natural scenes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmxpearson
jmxpearson / lfads_out_2_hdf5.py
Last active November 16, 2017 21:25
lfads processing scripts
# take session-by-session output from lfads run in posterior sample and average
# mode, reassemble train and test trials, trim back to correct length (they
# were padded for batching), and bundle up in a single hdf5 file like
# the one used for behavior
import numpy as np
import h5py
import os
lfads_out_fpath = os.path.expanduser('~/data/penaltykick/model_data/lfads/fitted/')
lfads_in_fpath = os.path.expanduser('~/data/penaltykick/model_data/lfads/')
@jmxpearson
jmxpearson / .tmux.conf
Created March 19, 2017 12:19
tmux configuration
# set prefix to backtick
set -g prefix `
unbind C-b
bind ` send-prefix
# set delay between prefix and command (copied from tmux book)
set -s escape-time 1
# set r to reload
bind r source-file ~/.tmux.conf \; display 'Reloaded!'
@jmxpearson
jmxpearson / tf_edward_example.ipynb
Created February 20, 2017 18:07
Example of Poisson GLM in TensorFlow/Edward
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmxpearson
jmxpearson / reading_plx_spike_data.ipynb
Last active February 7, 2023 09:28
Reading Plexon data with Neo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmxpearson
jmxpearson / spiking_power.ipynb
Last active January 24, 2017 16:29
Sample power analysis for firing rate task
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from psychopy import core, visual
from psychopy.visual.circle import Circle
class Flicker(Circle):
"""
Creates a flickering circle in the upper right corner of the screen.
This is to be used as a timing marker by a photodiode.
The presence or absence of the circle marks out an 8-bit binary pattern,
flanked at the beginning and end by a 1 (e.g., 5 is 1000001011).
"""
@jmxpearson
jmxpearson / Outline.md
Last active March 17, 2017 15:07
Git Workshop Notes

#Outline:

Why are we doing this? (software in teams)

Shell

What is the shell?

  • a program
  • for talking to the os
  • a scripting language
srand(12345)
function makeLtri(x)
l = length(x)
p = round(Int, (sqrt(1 + 8l) - 1) / 2)
L = zeros(eltype(x), (p, p))
k = 1
for j in 1:p
for i in j:p
L[i, j] = x[k]
@jmxpearson
jmxpearson / gist:b5535198e09ab528bd47
Last active August 29, 2015 14:24
Coursera scala setup

Getting Eclipse/Scala-IDE set up for the Coursera Scala class was a pain. This is because the course materials were created for Scala 2.10, but the editor and IDE are set up with 2.11. Plus lots of other versions, dependencies, etc. have changed.

So here's what I needed to do for the example assignment:

  • Do this:
    • However, I did not comment out the Eclipse plugin line in project/buildSettings.sbt. Instead, I changed it to version 2.2.0, which worked. (I think 2.1.0 is deprecated and no longer hosted.)
  • After this, sbt built (command sbt eclipse) and the package imported in Eclipse, but I had errors, and my Scala tests wouldn't run.
  • Finally, I needed to right click the project and do Properties -> Scala Compiler -> Scala Installation and choose 2.10. I got this tip from here