Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtuck committed Oct 7, 2023
1 parent 328f5ae commit 64330e6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
6 changes: 3 additions & 3 deletions R/geometry.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ findkarcherinv <- function(warps, times, round = F){
#' @keywords srvf alignment
#' @export
gam_to_v<-function(gam, smooth=TRUE){
if (ndims(gam_obs) == 0){
if (ndims(gam) == 0){
TT = length(gam)
eps = .Machine$double.eps
time <- seq(0,1,length.out=TT)
Expand All @@ -164,7 +164,7 @@ gam_to_v<-function(gam, smooth=TRUE){
if (smooth) {
tmp.spline <- stats::smooth.spline(gam)
g <- stats::predict(tmp.spline, deriv = 1)$y / binsize
g[x<0] = 0
g[g<0] = 0
psi = sqrt(g)
} else {
psi = sqrt(gradient(gam,binsize))
Expand All @@ -186,7 +186,7 @@ gam_to_v<-function(gam, smooth=TRUE){
for (i in 1:n) {
tmp.spline <- stats::smooth.spline(gam[,i])
g[, i] <- stats::predict(tmp.spline, deriv = 1)$y / binsize
g[x<0, i] = 0
g[g[,i]<0, i] = 0
psi[,i] = sqrt(g[, i])
}
} else {
Expand Down
19 changes: 16 additions & 3 deletions R/multiple_align_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,22 @@ multiple_align_functions <- function(f, time, mu, lambda = 0, pen="roughness",
amp.var = trapz(time,std_fn^2)
phase.var = trapz(time,var_fgam)

out <- list(f0=f,time=time,fn=fn,qn=qn,q0=q0,fmean=fmean,mqn=mqn,gam=gam,
orig.var=orig.var,amp.var=amp.var,phase.var=phase.var,
qun=0,lambda=lambda,method="mean",omethod=omethod,gamI=gamI,rsamps=F)
out <- list(f0=f,time=time,fn=fn,qn=qn,q0=q0,fmean=fmean,mqn=mqn,warping_functions=gam,
original_variance=orig.var,amplitude_variance=amp.var,phase_variance=phase.var,
qun=0,
inverse_average_warping_function = gamI,
rsamps = FALSE,
call = list(
lambda = lambda,
penalty_method = pen,
centroid_type = "mean",
center_warpings = FALSE,
smooth_data = smooth_data,
sparam = sparam,
parallel = parallel,
optim_method = omethod,
max_iter = MaxItr
))

class(out) <- 'fdawarp'

Expand Down

0 comments on commit 64330e6

Please sign in to comment.