From ab3c5093836cdb27458d1557de353c1dca20b1c6 Mon Sep 17 00:00:00 2001 From: "Velimir (monty) Vesselinov" Date: Mon, 15 Jul 2024 12:53:20 -0600 Subject: [PATCH] min_log_range --- src/NMFkMatrix.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NMFkMatrix.jl b/src/NMFkMatrix.jl index f40c5af..e33a352 100644 --- a/src/NMFkMatrix.jl +++ b/src/NMFkMatrix.jl @@ -129,15 +129,16 @@ function normalizearray(a::AbstractArray, dim::Integer; kw...) return normalizearray!(copy(a), dim; kw...) end -function normalizearray!(a::AbstractArray, dim::Integer; rev::Bool=false, log::Bool=false, logv::AbstractVector=[]) +function normalizearray!(a::AbstractArray, dim::Integer; rev::Bool=false, log::Bool=false, logv::AbstractVector=[], min_skewness::Number=1, min_log_range::Number=1.5) n = size(a, dim) if length(logv) == 0 logv = falses(n) if log for i = 1:n nt = ntuple(k->(k == dim ? (i:i) : Colon()), ndims(a)) + log_range = log10(maximum(a[nt...])) - log10(minimum(a[nt...])) s = StatsBase.skewness(vec(a[nt...])) - if s > 1 + if s > min_skewness || log_range > min_log_range a[nt...] .= NMFk.log10s(a[nt...]) logv[i] = true end