This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// most recent update: 04/22/2014 | |
// one liner | |
javascript:function go(){var asdf = window.location.host.replace(/\./g, "-");window.location = window.location.protocol+'//'+asdf+'.ezp1.harvard.edu'+window.location.pathname+window.location.search;}go();void(0); | |
// expanded | |
function go() { | |
var asdf = window.location.host.replace(/\./g, "-"); // replace all the periods with dashes (uses regexp) | |
window.location = window.location.protocol+'//' + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.optimize import curve_fit | |
def linear(x, m, b): | |
return m*x + b | |
x = np.arange(0,400,1) | |
y = linear(x, -0.2, 3) | |
yn = y + np.random.normal(size=len(x))*2 | |
yn[50:350] *= np.random.normal(size=300) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makePulses(frameLengthsMS, orderedOdors) | |
global state | |
sample_rate = getGlobal(progmanager, 'sampleRate', 'ephys', 'ephys'); | |
trace_length_in_samples = round(sum(frameLengthsMS) * length(orderedOdors) * sample_rate/1000); | |
if trace_length_in_samples == 0 | |
return | |
end | |
stim_literal_pulse = zeros(1, trace_length_in_samples); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyproj | |
wgs84 = pyproj.Proj('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')##4326 | |
geocentric= pyproj.Proj('+proj=geocent +datum=WGS84 +units=m +no_defs') ##4978 | |
for x, y in coords: | |
x2, y2, z2 = pyproj.transform( wgs84, geocentric, x, y, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
df = pd.DataFrame.from_csv('temp.csv') | |
old_index = df.index | |
new_index = old_index.union(pd.DatetimeIndex([old_index[5] + np.timedelta64(1,'s')])) | |
df.reindex(new_index) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
(datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)).total_seconds() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import base64, zlib, struct | |
from IPython.display import HTML | |
def write_png(buf, width, height): | |
""" buf: must be bytes or a bytearray in py3, a regular string in py2. formatted RGBARGBA... """ | |
# reverse the vertical line order and add null bytes at the start | |
width_byte_4 = width * 4 | |
raw_data = b''.join(b'\x00' + buf[span:span + width_byte_4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* required styles */ | |
.leaflet-map-pane, | |
.leaflet-tile, | |
.leaflet-marker-icon, | |
.leaflet-marker-shadow, | |
.leaflet-tile-pane, | |
.leaflet-tile-container, | |
.leaflet-overlay-pane, | |
.leaflet-shadow-pane, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Leaflet 1.0.0-beta.2 (81e71fe), a JS library for interactive maps. http://leafletjs.com | |
(c) 2010-2015 Vladimir Agafonkin, (c) 2010-2011 CloudMade | |
*/ | |
!function(t,e,i){function n(){var e=t.L;o.noConflict=function(){return t.L=e,this},t.L=o}var o={version:"1.0.0-beta.2"};"object"==typeof module&&"object"==typeof module.exports?module.exports=o:"function"==typeof define&&define.amd&&define(o),"undefined"!=typeof t&&n(),o.Util={extend:function(t){var e,i,n,o;for(i=1,n=arguments.length;n>i;i++){o=arguments[i];for(e in o)t[e]=o[e]}return t},create:Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}(),bind:function(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}},stamp:function(t){return t._leaflet_id=t._leaflet_id||++o.Util.lastId,t._leaflet_id},lastId:0,throttle:function(t,e,i){var n,o,s,r;return r=function(){n=!1,o&&(s.apply(i,o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Macports | |
# We'll install a relatively high-level package first, with a lot of dependencies, | |
# so that we pick up everything along the way | |
# Chaco is an enthought plotting package that'll | |
sudo port install py26-chaco | |
sudo port select python python26 | |
sudo port install py26-ipython |
OlderNewer