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 numpy.linalg as la | |
from matplotlib import pyplot as pp | |
from sympy import factorint | |
def P(f,x,u,ax): | |
b=np.linspace(0,6,61) | |
if f<2: | |
s=la.norm(u) | |
ax.add_patch(pp.Polygon(np.transpose(np.concatenate([[x[0][0]+np.sin(b)*s],[x[1][0]+np.cos(b)*s]])),color='k',linewidth=0)) | |
else: |
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 check_for_deeplinks(hypeDocument, element, event) { | |
/* | |
Allows "deep" linking from an external page into a specific scene in a Tumult Hype document. | |
To use, put this on the first frame of the first scene in the Hype document. | |
Then, set the link url to `my-hype-document.html#my-scene-name`, to go to the scene named | |
"my-scene-name". | |
*/ | |
// Look for a hash in the url | |
var hash = window.location.hash.substring(1); |
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
""" | |
Calculate the Bayes factor for (partial) correlation values using the JZS prior. | |
Ported from R code in Wetzels & Wagenmakers (2012) "A default Bayesian hypothesis test for correlations and partial | |
correlations". Psychon Bull Rev. 19:1057–1064 doi:10.3758/s13423-012-0295-x | |
""" | |
from math import sqrt, exp, gamma | |
from numpy import inf | |
from scipy import integrate |
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
""" | |
=========================== | |
Stacked bar graph using seaborn. | |
Forked from: https://gist.github.com/randyzwitch/b71d47e0d380a1a6bef9 | |
With extra inspiration from: https://gist.github.com/extrospective/0f4fe69304184d813f982035d9684452 | |
=========================== | |
""" | |
from matplotlib import pyplot | |
import seaborn |
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
// http://cai.zone/2014/02/a-javascript-hack-to-have-spry-collapsiblepanels-remember-their-state/ | |
// Assumes global object sessvars from sessvars.js | |
// http://www.thomasfrank.se/sessionvars.html | |
// You should include this right at the bottom of the html file containing the panels, like this: | |
// <!-- Wire panels --> | |
// <script type="text/javascript" src="spry-collapsiblepanels-remember-state.js"></script> | |
// And this should *replace* the javascript which Dreamweaver added to create the panels. | |
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
// http://cai.zone/2013/07/a-quick-javascript-hack-to-fake-adjustin-html5-audio-elements-timeupdate-event-frequency/ | |
var audio_clock; | |
$(audiohtml).bind("timeupdate", onAudioUpdate); | |
$(audiohtml).bind("play", function(){ | |
audio_clock = setInterval(function(){ | |
onAudioUpdate(); | |
}, 100); | |
}); |