Skip to content

Commit

Permalink
Fix Gaussian filter (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
giriPHM authored Nov 14, 2024
1 parent 079de79 commit 6e78f4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ DSP = "0.6, 0.7"
DocStringExtensions = "0.8, 0.9"
ElasticArrays = "1"
FFTW = "1"
FillArrays = "0.8.4, 0.9, 0.10, 0.11, 0.12, 0.13, 1"
FillArrays = "0.13, 1"
FunctionChains = "0.1"
GPUArraysCore = "0.1"
IntervalSets = "0.7"
Expand Down
10 changes: 6 additions & 4 deletions src/gaussian_filter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ $(TYPEDFIELDS)
length::T = 100.

"the amount of standard deviations to cover in the gaussian window"
alpha::U = 1.
alpha::U = 3.

"scaling factor"
beta::U = 100.
beta::U = 1.
end

export Gauss1DFilter
Expand Down Expand Up @@ -67,8 +67,10 @@ function gaussian_coeffs(N::Int, sigma::V, alpha::U, beta::U
xᵢ::T = -sigma*alpha
Δx::T = abs(2*xᵢ)/(N-1)
for i=Base.OneTo(N)
y[i] = beta*exp(-0.5*(xᵢ/alpha)^2) / N
y[i] = beta*exp(-0.5*(xᵢ/sigma)^2)
xᵢ += Δx
end
y
sum_arr=sum(y)
y_norm= y./sum_arr
y_norm
end
1 change: 1 addition & 0 deletions src/new_filter.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#Just kidding. lol

0 comments on commit 6e78f4c

Please sign in to comment.