Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼
I am a panda.

George Datseris Datseris

🐼
I am a panda.
View GitHub Profile
@Datseris
Datseris / makie_tutorial.jl
Created Aug 25, 2021
Making animated and interactive scientific visualizations in Makie.jl
View makie_tutorial.jl
# # Making animated and interactive scientific
# # visualizations in Makie.jl
# Alrighty, in this short tutorial I'll teach you how to make
# animated scientific such as this video, or this application.
# Prerequisitives:
# * Basic familiarity with Julia (obviously)
# * Basic familiarity with Makie.jl
@Datseris
Datseris / phase_interactive.jl
Created Feb 9, 2021
interactive r toggling for phase dependent induced transition
View phase_interactive.jl
using GLMakie, InteractiveDynamics, DynamicalSystems, OrdinaryDiffEq, LinearAlgebra
diffeq = (alg = Tsit5(), dtmax = 0.02, abstol = 1e-6, reltol = 1e-6)
function hassan_alkhayuon(u, p, t) # From talk of Hassan Alkhayuon
r, c, μ, ν, α, β, χ, δ = p
N, P = u
common = α*N*P/+N)
dN = r*N*(1 - (c/r)*N)*((N-μ)/(N+ν)) - common
dP = χ*common - δ*P
return SVector(dN, dP)
@Datseris
Datseris / hassan_alkhayuon_statespace.jl
Last active Feb 9, 2021
Attempts at reproducing phase-tipping plots of https://arxiv.org/abs/2101.12107
View hassan_alkhayuon_statespace.jl
using DynamicalSystems, PyPlot, LinearAlgebra, OrdinaryDiffEq
# ODE solver options:
diffeq = (alg = Vern9(), reltol = 1e-10, abstol = 1e-10)
# non-dimensionalized Rozenweig-MacArthur model
function rozenweig_macarthur(u, p, t)
k, m, c = p
x, y = u
common = m*x*y/(1+x)
xdot = x*(1-x/k) - common
@Datseris
Datseris / mutualinfo.jl
Created Dec 5, 2020
mutual information pure
View mutualinfo.jl
function naivehist(x::AbstractVector, ε::Real)
mi, ma = extrema(x)
hs = zeros(Int((ma-mi)÷ε) + 1)
is = zeros(Int, length(x))
for (j, e) in enumerate(x)
xi = Int((e-mi)÷ε + 1)
hs[xi] += 1
is[j] = xi
end
return hs ./ length(x), is
View xarray_to_climarray.jl
using ClimateBase, Dates
# This needs to numpy, xarray and dask installed from Conda
using PyCall
xr = pyimport("xarray")
np = pyimport("numpy")
"""
climarray_from_xarray(xa, fieldname, name = Symbol(fieldname))
Load underlying field with given `fieldname` from the given xarray instance `xa`,
optionally providing a name for it. This `xa` can be loaded with commands like
@Datseris
Datseris / man.txt
Last active Feb 13, 2020
project manifest
View man.txt
############### in Juno version ####################################
(AlbedoProperties) pkg> st -m
Project AlbedoProperties v0.0.0
Status `C:\Users\m300808\ownCloud\Projects\AlbedoProperties\Manifest.toml`
[621f4979] AbstractFFTs v0.5.0
[85c772de] AbstractNumbers v0.2.1
[537997a7] AbstractPlotting v0.9.17 #master (https://github.com/JuliaPlots/AbstractPlotting.jl.git)
[27a7e980] Animations v0.3.1
[7d9fca2a] Arpack v0.4.0
@Datseris
Datseris / TraceCalls.jl
Created Feb 12, 2020 — forked from pfitzseb/TraceCalls.jl
TraceCalls.jl with Cassette
View TraceCalls.jl
module TraceCalls
using Cassette
mutable struct Trace
level::Int
cutoff::Int
end
Cassette.@context TraceCtx
@Datseris
Datseris / agents_logo.jl
Created Oct 11, 2019
WIP code to generate the logo of Agents.jl
View agents_logo.jl
using Luxor, DSP;
cd(@__DIR__);
const AGENTSTEXT = "Agents.jl"
# const FONT = "Montserrat SemiBold"
const FONT = "Tamil MN Bold"
const FONTSIZE = 200
using Random
Random.seed!(9)
@Datseris
Datseris / forward.jl
Created Apr 21, 2019
Method forwarding macro from Lazy
View forward.jl
"""
@forward T.x functions...
Define methods for `functions` on type `T`, which call the relevant function
on the field `x`.
# Example
```julia
struct Wrapper
x
end