aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Mikulicz <szymon.mikulicz@posteo.net>2019-08-16 23:37:28 +0200
committerSzymon Mikulicz <szymon.mikulicz@posteo.net>2019-08-16 23:37:28 +0200
commit769282d806321e1dab6491397de0b3638ce720e3 (patch)
tree08afe9ba83c06187adcec756b720f20f0bb4d898
parent06048b5e366d50238502d167983e514ed3e91596 (diff)
Ignore NaNsHEADmaster
-rw-r--r--src/IOLA.jl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/IOLA.jl b/src/IOLA.jl
index 0c751d9..1e8ec15 100644
--- a/src/IOLA.jl
+++ b/src/IOLA.jl
@@ -166,9 +166,11 @@ function findperiod(vector::AbstractVector{T},
end
function radiusofmean(radiuses::AbstractVector,
- angles::AbstractVector)
+ angles::AbstractVector,
+ na_rm = true)
M = length(radiuses)
- sqrt(sum(radiuses.*sin.(angles))^2 + sum(radiuses.*cos.(angles))^2)/M
+ idxs = na_rm ? isfinite.(radiuses) : Colon()
+ sqrt(sum(radiuses[idxs].*sin.(angles[idxs]))^2 + sum(radiuses[idxs].*cos.(angles[idxs]))^2)/M
end
end