Skip to content

Instantly share code, notes, and snippets.

Avatar

Wiktor Phillips wsphillips

View GitHub Profile
@wsphillips
wsphillips / implotstyle.jl
Last active Mar 24, 2021
Rough method to modify C struct fields
View implotstyle.jl
# in libcimplot_api.jl
function GetStyle()
ccall((:ImPlot_GetStyle, libcimplot), Ptr{ImPlotStyle}, ())
end
# elsewhere...
# This could have mistakes, and will need tweaking but gets the idea across
@wsphillips
wsphillips / twoneurons.jl
Last active Oct 24, 2020
HH two neurons coupled using MTK
View twoneurons.jl
using DifferentialEquations, ModelingToolkit, Plots, OrdinaryDiffEq
# Channel gating functions
αn(V) = (0.01*(V + 55))/(1 - exp(-(V + 55)/10))
βn(V) = 0.125 * exp(-(V + 65)/80)
αm(V) = (0.1*(V + 40))/(1 - exp(-(V + 40)/10))
βm(V) = 4*exp(-(V + 65)/18)
αh(V) = 0.07*exp(-(V+65)/20)
βh(V) = 1/(1 + exp(-(V + 35)/10))
@wsphillips
wsphillips / hh_mtk.jl
Last active Oct 22, 2020
Hodgkin-Huxley single compartment with ModelingToolkit.jl
View hh_mtk.jl
using DifferentialEquations, ModelingToolkit, Plots
# Channel gating functions
αn(V) = (0.01*(V + 55))/(1 - exp(-(V + 55)/10))
βn(V) = 0.125 * exp(-(V + 65)/80)
αm(V) = (0.1*(V + 40))/(1 - exp(-(V + 40)/10))
βm(V) = 4*exp(-(V + 65)/18)
αh(V) = 0.07*exp(-(V+65)/20)
βh(V) = 1/(1 + exp(-(V + 35)/10))
@wsphillips
wsphillips / imgui_imagedisplay.jl
Last active Jul 7, 2020
CImGui.jl : Attempt to load and display a random array of numbers as an image
View imgui_imagedisplay.jl
using CImGui
using CImGui.CSyntax
using CImGui.CSyntax.CStatic
using CImGui.GLFWBackend
using CImGui.OpenGLBackend
using CImGui.GLFWBackend.GLFW
using CImGui.OpenGLBackend.ModernGL
using Printf
import CImGui.OpenGLBackend.ModernGL: glGenTextures
@wsphillips
wsphillips / implot_demo.jl
Last active May 22, 2020
Demo of CImPlot working with CImGui.jl
View implot_demo.jl
using CImGui
using CImGui.CSyntax
using CImGui.CSyntax.CStatic
using CImGui.GLFWBackend
using CImGui.OpenGLBackend
using CImGui.GLFWBackend.GLFW
using CImGui.OpenGLBackend.ModernGL
using Printf
using CEnum
using CImPlot_jll
View First segfault type (during precompilation)
# This caused the first breaking change. Precompilation fails after commit 99d2406c98a720e9f9e555109297b577232a01a4
# Result is identical to that reported in CUDAnative.jl at https://github.com/JuliaLang/julia/issues/32074
signal (11): Segmentation fault
in expression starting at none:0
jl_is_submodule at /home/wikphi/julia-src/src/module.c:706
module_in_worklist at /home/wikphi/julia-src/src/dump.c:227 [inlined]
type_in_worklist at /home/wikphi/julia-src/src/dump.c:238 [inlined]
jl_serialize_value_ at /home/wikphi/julia-src/src/dump.c:982
@wsphillips
wsphillips / pyto.jl
Created Dec 12, 2019
Pytographic ordering algorithm
View pyto.jl
using Test
# Reference pattern for N = 13; should be able to generalize pattern to any int N
index1=[
1,1,1,1,1,1,1,1,1,1,1,1,1,2,3,4,5,6,7,8,9,10,11,12,13,13,13,13,13,13,13,13,13,
13,13,13,13,12,11,10,9,8,7,6,5,4,3,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5,6,7,8,9,10,11,
12,12,12,12,12,12,12,12,12,12,12,11,10,9,8,7,6,5,4,3,3,3,3,3,3,3,3,3,3,4,5,6,7,
8,9,10,11,11,11,11,11,11,11,11,11,10,9,8,7,6,5,4,4,4,4,4,4,4,4,5,6,7,8,9,10,10,
10,10,10,10,10,9,8,7,6,5,5,5,5,5,5,6,7,8,9,9,9,9,9,8,7,6,6,6,6,7,8,8,8,7,7]