Skip to content

Commit 53a6269

Browse files
committed
refactor: rename parameter 'p' to 'assym' in baseline_als and process_rois functions for clarity and consistency
1 parent 5150e68 commit 53a6269

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Analysis/NanoImgPro/BaselineData.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Asymmetric Least Squares baseline correction.
1515
If the peaks are very sudden, p gives you the best chance of fixing it
1616
Uses a second–difference regularization (similar to Eilers & Boelens, 2005).
1717
"""
18-
function baseline_als(y::Vector{T}; lam::T=1e4, p::T=0.075, niter::Int=100) where T<:Real
18+
function baseline_als(y::Vector{T}; lam::T=1e4, assym::T=0.075, niter::Int=100) where T<:Real
1919
L = length(y)
2020
# Construct D as an L×(L–2) difference operator so that
2121
# (D*y)[i] = y[i] - 2y[i+1] + y[i+2]
@@ -36,7 +36,7 @@ function baseline_als(y::Vector{T}; lam::T=1e4, p::T=0.075, niter::Int=100) wher
3636
Z = W + Dmat
3737
z .= Z \ (w .* y)
3838
# Update weights elementwise
39-
w = [ y[i] > z[i] ? p : (y[i] < z[i] ? 1-p : 0.5 ) for i in 1:L ]
39+
w = [ y[i] > z[i] ? assym : (y[i] < z[i] ? 1-p : 0.5 ) for i in 1:L ]
4040
end
4141
return z
4242
end

src/Analysis/NanoImgPro/ROIProcess.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function process_rois(data::Experiment{TWO_PHOTON, T};
3232
window::Int=15,
3333
n_stds=2.0,
3434
sig_window=50.0, # Time window in ms to look for significant responses after stimulus
35-
lam::T=1e4, p::T=0.075, niter::Int=100,
35+
lam::T=1e4, assym::T=0.075, niter::Int=100,
3636
kwargs...
3737
) where T<:Real
3838

@@ -76,7 +76,7 @@ function process_rois(data::Experiment{TWO_PHOTON, T};
7676
dFoF = baseline_trace(roi_trace;
7777
stim_frame=pre_stim_idx,
7878
window=window,
79-
lam=lam, p=p, niter=niter,
79+
lam=lam, assym=assym, niter=niter,
8080
)
8181
t_series = collect(1:length(dFoF))*data.dt
8282

0 commit comments

Comments
 (0)