Skip to content

Commit

Permalink
Merge pull request #52 from jhmigueles/Time-detection-g.part5
Browse files Browse the repository at this point in the history
Time detection in g.part5
  • Loading branch information
vincentvanhees authored Oct 8, 2017
2 parents 72fae88 + 8ab1e26 commit fc78c74
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
15 changes: 15 additions & 0 deletions R/g.part5.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ g.part5 = function(datadir=c(),metadatadir=c(),f0=c(),f1=c(),strategy=1,maxdur=7
}
s0 = which(timebb == gik.ons[g])[1]
s1 = which(timebb == gik.end[g])[1]
#Change 1 - 03/10/2017
if ( timebb[s0] != as.character(timebb[s0])){
timebb = as.character(timebb)
s0 = which(timebb == gik.ons[g])[1]
s1 = which(timebb == gik.end[g])[1]
}
#End of change 1
if (is.na(s0) == TRUE) s0 = which(timebb == paste(gik.ons[g]," 00:00:00",sep=""))[1]
if (is.na(s1) == TRUE) s1 = which(timebb == paste(gik.end[g]," 00:00:00",sep=""))[1]
s0 = s0 + pr0 - 1
Expand Down Expand Up @@ -279,6 +286,14 @@ g.part5 = function(datadir=c(),metadatadir=c(),f0=c(),f1=c(),strategy=1,maxdur=7
}
if (is.na(s0) == TRUE) s0 = which(timebb == paste(w0c," 00:00:00",sep=""))[1]
if (is.na(s1) == TRUE) s1 = which(timebb == paste(w1c," 00:00:00",sep=""))[1]
#Change 2 - 03/10/2017
if ( timebb[s0] != as.character(timebb[s0])){
timebb = as.character(timebb)
timebb = as.character(timebb)
if (is.na(s0) == TRUE) s0 = which(timebb == w0c)[1]
if (is.na(s1) == TRUE) s1 = which(timebb == w1c)[1]
}
#End of change 2
# }
if (length(s1) != 0 & length(s0) != 0 & is.na(s0) == FALSE & is.na(s1) == FALSE) {
diur[s0:s1] = 1
Expand Down
7 changes: 4 additions & 3 deletions R/g.shell.GGIR.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ g.shell.GGIR = function(mode=c(1,2),datadir=c(),outputdir=c(),studyname=c(),f0=1
if (length(which(ls() == "closedbout")) == 0) closedbout = FALSE
if (length(which(ls() == "IVIS_windowsize_minutes")) == 0) IVIS_windowsize_minutes=60
if (length(which(ls() == "IVIS_epochsize_seconds")) == 0) IVIS_epochsize_seconds=30
if (length(which(ls() == "acc.metric")) == 0) acc.metric = "ENMO"


# # specific for part 5
Expand Down Expand Up @@ -197,7 +198,7 @@ g.shell.GGIR = function(mode=c(1,2),datadir=c(),outputdir=c(),studyname=c(),f0=1
cat(paste0(rep('_',options()$width),collapse=''))
cat("\nPart 3\n")
if (f1 == 0) f1 = length(dir(paste(metadatadir,"/meta/basic",sep="")))
g.part3(metadatadir=metadatadir,f0=f0,
g.part3(metadatadir=metadatadir,f0=f0, acc.metric = acc.metric,
f1=f1,anglethreshold=anglethreshold,timethreshold=timethreshold,
ignorenonwear=ignorenonwear,overwrite=overwrite,desiredtz=desiredtz)
}
Expand All @@ -220,9 +221,9 @@ g.shell.GGIR = function(mode=c(1,2),datadir=c(),outputdir=c(),studyname=c(),f0=1
cat("\nPart 5\n")
if (f1 == 0) f1 = length(dir(paste(metadatadir,"/meta/ms4.out",sep="")))
g.part5(datadir=datadir,metadatadir=metadatadir,f0=f0,f1=f1,strategy=strategy,maxdur=maxdur,
hrs.del.start=hrs.del.start,
hrs.del.start=hrs.del.start,
hrs.del.end=hrs.del.end,
loglocation=loglocation,excludefirstlast=excludefirstlast,
loglocation=loglocation,excludefirstlast=excludefirstlast, acc.metric=acc.metric,
windowsizes=windowsizes,boutcriter.in=boutcriter.in,boutcriter.lig=boutcriter.lig,
boutcriter.mvpa=boutcriter.mvpa,storefolderstructure=storefolderstructure,
threshold.lig = threshold.lig,
Expand Down

0 comments on commit fc78c74

Please sign in to comment.