Skip to content

Instantly share code, notes, and snippets.

View sdwfrost's full-sized avatar

Simon Frost sdwfrost

View GitHub Profile
@sdwfrost
sdwfrost / ode_uncertainty.jmd
Created December 20, 2021 19:29
SIR model with uncertainty
# Ordinary differential equation model with uncertainty quantification
Simon Frost (@sdwfrost), 2021-12-20
## Introduction
The classical ODE version of the SIR model is:
- Deterministic
- Continuous in time
- Continuous in state
@sdwfrost
sdwfrost / frequency_estimator.py
Created June 7, 2021 23:28 — forked from endolith/frequency_estimator.py
Frequency estimation methods in Python
from __future__ import division
from numpy.fft import rfft
from numpy import argmax, mean, diff, log, nonzero
from scipy.signal import blackmanharris, correlate
from time import time
import sys
try:
import soundfile as sf
except ImportError:
from scikits.audiolab import flacread

GCC compiler optimization for ARM-based systems

2017-03-03 fm4dd

The gcc compiler can optimize code by taking advantage of CPU specific features. Especially for ARM CPU's, this can have impact on application performance. ARM CPU's, even under the same architecture, could be implemented with different versions of floating point units (FPU). Utilizing full FPU potential improves performance of heavier operating systems such as full Linux distributions.

-mcpu, -march: Defining the CPU type and architecture

These flags can both be used to set the CPU type. Setting one or the other is sufficient.

@sdwfrost
sdwfrost / sine_esn.jmd
Last active May 19, 2021 18:26
Fitting a sine curve using an echo state network in ReservoirComputing.jl
# Sine regression using echo state networks in ReservoirComputing.jl
## Loading libraries
```julia
using Random
using Distributions
using Plots
using StatsPlots
using ParameterizedFunctions
# Ordinary differential equation model using ModiaSim
Simon Frost (@sdwfrost), 2021-04-15
## Introduction
The classical ODE version of the SIR model is:
- Deterministic
- Continuous in time
- Continuous in state
@sdwfrost
sdwfrost / ode_algebraicdynamics.jmd
Created March 24, 2021 22:07
Example of an SIR model using AlgebraicDynamics.jl
# Composing ODE models using AlgebraicDynamics.jl
Simon Frost (@sdwfrost), 2021-03-17
## Introduction
To keep things simple, I only consider a reduced system with susceptibles and infected individuals, with a constant population size.
## Libraries
```julia
@sdwfrost
sdwfrost / mbp.jmd
Created March 15, 2021 23:27
Multivariate birth process version of an SIR model
# Multivariate birth process reparameterisation of the SDE model
Simon Frost (@sdwfrost), 2020-06-12
## Introduction
[Fintzi et al.](https://arxiv.org/abs/2001.05099) reparameterise a stochastic epidemiological model in two ways:
- they consider the dynamics of time-integrated rates (infection and recovery in the SIR model); and
- they use a log-transformed scale, to model stochastic perturbations due to stochasticity on a multiplicative scale.
There are lots of advantages to this parameterisation, not the least that the states in this model more closely match the kind of data that are usually collected.
@sdwfrost
sdwfrost / sir_bridge.jmd
Created March 14, 2021 15:50
SIR example in Bridge.jl
# Stochastic differential equation model using Bridge.jl
Simon Frost (@sdwfrost), 2021-03-13
## Introduction
A stochastic differential equation version of the SIR model is:
- Stochastic
- Continuous in time
- Continuous in state
# Moment closure of an SIR reaction network model using MomentClosure
Simon Frost (@sdwfrost), 2021-03-10
## Libraries
```julia
using DifferentialEquations
using OrdinaryDiffEq
using MomentClosure
using ModelingToolkit
# Moment closure of an SIR reaction network model using MomentClosure
Simon Frost (@sdwfrost), 2021-03-10
## Libraries
```julia
using OrdinaryDiffEq
using MomentClosure
using ModelingToolkit
using Tables