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
"""Aesara/Theano functions for calculating the probability density of the Wiener | |
diffusion first-passage time (WFPT) distribution used in drift diffusion models (DDMs). | |
""" | |
import arviz as az | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pymc3 as pm | |
from pymc3.distributions import draw_values, generate_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
"""JAX functions for calculating the probability density of the Wiener diffusion first- | |
passage time (WFPT) distribution used in drift diffusion models (DDMs). | |
""" | |
import jax | |
import jax.numpy as jnp | |
def jax_wfpt_pdf_sv(x, v, sv, a, z, t): | |
"""Probability density function of the WFPT distribution with drift rates normally |
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
"""Attempts to implement DDM likelihoods in Python. | |
""" | |
from math import pi, sqrt, log, ceil, floor, exp, sin, fabs, inf | |
from numba import jit, vectorize | |
@jit(nopython=True) | |
def simpson_1d(x, v, sv, a, z, t, err, lb_z, ub_z, n_sz, lb_t, ub_t, n_st): |
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
"""Attempts to implement DDM likelihoods in Python. | |
""" | |
from math import pi, sqrt, log, ceil, floor, exp, sin, fabs, inf | |
def simpson_1d(x, v, sv, a, z, t, err, lb_z, ub_z, n_sz, lb_t, ub_t, n_st): | |
n = max(n_st, n_sz) |
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 math import pi, sin | |
import struct, sys | |
from PyQt5.QtCore import QBuffer, QByteArray, QIODevice, Qt | |
from PyQt5.QtWidgets import ( | |
QApplication, | |
QFormLayout, | |
QLineEdit, | |
QHBoxLayout, | |
QPushButton, |
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
"""Contains a function to generate pure tones. | |
""" | |
import numpy as np | |
import sounddevice as sd | |
a0 = 1e-5 # reference amplitude | |
sr = 44100 # sample rate | |
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
"""Simply generates a pure tone using numpy and plays it via sounddevice. | |
As always, make sure your volume settings are low before running this script, especially | |
if you are using headphones! | |
""" | |
import numpy as np | |
import sounddevice as sd | |
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 simpleaudio as sa | |
samplerate = 44100 | |
ref_amplitude = 1e-5 | |
level = 80 | |
ref_rms = ref_amplitude / np.sqrt(2) | |
rms = 10 ** (level / 20) * ref_rms | |
amplitude = rms * np.sqrt(2) | |
# or more simply ... |
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 hddm | |
import numpy as np | |
from scipy.stats import norm | |
import matplotlib.pyplot as plt | |
from matplotlib.gridspec import GridSpec | |
from tqdm import tqdm | |
def setupfig(): | |
"""Tweak for the target journal. |
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
# -*- coding: utf-8 -*- | |
from warnings import warn | |
import numpy as np | |
from scipy.signal import butter, lfilter | |
from scipy.stats import norm, uniform | |
import matplotlib.pyplot as plt | |
import brian | |
import brian.hears as hears |
NewerOlder