Commit 64f59098 authored by Victor's avatar Victor
Browse files

Adding moving average

parent bf579c78
name = "ABMEv"
uuid = "837ac870-fb52-4b0c-9a0e-030f2f36f5ed"
authors = ["Victor Boussange "]
version = "0.1.6"
version = "0.1.7"
[deps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
......
......@@ -21,5 +21,5 @@ module ABMEv
export copy,runWorld_store_WF,runWorld_store_G #,runWorld_G!,runWorld_WF!,
export H_discrete,findclusters,var,covgeo,hamming
export update_afterbirth_std!,update_afterdeath_std!
export generalised_gaussian,gaussian
export generalised_gaussian,gaussian,ma
end
......@@ -9,3 +9,13 @@ end
gaussian(x::Number,mu::Number,sigma::Number) = generalised_gaussian(x,mu,sigma,2)
"""
gaussian(x::Number,mu::Number,sigma::Number) = generalised_gaussian(x,mu,sigma,2.)
"""
ma(x::Array{T},f) where T <: Number
Moving average over array x, using f as the filter, i.e. the number of points to average on. Better choosing an odd number
"""
function ma(x::Array{T},f) where T <: Number
_N = length(x)
_s = Int((f-1)/2)
return conv(x,ones(f)./f)[_s:_s+_N-1]
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment