Skip to content

Commit

Permalink
min_log_range
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Jul 15, 2024
1 parent 4279696 commit ab3c509
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/NMFkMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ab3c509

Please sign in to comment.