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
#!/usr/bin/env python | |
import numpy as np | |
ship = '🚀' | |
chars = [' ', '·', '.', '*', '✵', '✫', '+', '⋆', '✺', '.', '✧', '✦', '˚'] | |
probs = [ 0.58247423+0.23969072, 0.05927835, 0.04896907, 0.02061856, | |
0.0128866 , 0.01030928, 0.00515464, 0.00515464, 0.00515464, | |
0.00257732, 0.00257732, 0.00257732, 0.00257732] | |
num_lines = 5 |
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
Sequential( | |
(0): Linear(in_features=10800, out_features=1000, bias=True) | |
(1): ReLU() | |
(2): Linear(in_features=1000, out_features=100, bias=True) | |
(3): ReLU() | |
(4): Linear(in_features=100, out_features=20, bias=True) | |
(5): Softmax() | |
) | |
Inside Sequential backward | |
Inside class:Sequential |
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
;; mouse stuff | |
(xterm-mouse-mode) | |
(defvar alternating-scroll-down-next t) | |
(defvar alternating-scroll-up-next t) | |
(defun alternating-scroll-down-line () | |
(interactive "@") | |
(when alternating-scroll-down-next | |
; (run-hook-with-args 'window-scroll-functions ) | |
(scroll-down-line 5)) |
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
/* 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
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
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 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 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
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); |
NewerOlder