Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
^.*\.Rproj$
^\.Rproj\.user$
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
src/*.o
src/*.so
src/*.dll
17 changes: 17 additions & 0 deletions GGIR.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
4 changes: 2 additions & 2 deletions R/g.part3.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
g.part3 = function(metadatadir=c(),f0,f1,anglethreshold = 5,
timethreshold = 5,ignorenonwear=FALSE,overwrite=FALSE,desiredtz="Europe/London") {
timethreshold = 5,ignorenonwear=FALSE,overwrite=FALSE,desiredtz="Europe/London",strategy=1) {
# description: function to apply sleep detection functions to milestone data generated by g.part1
#------------------------------------
# create output directory if it does not exist
Expand Down Expand Up @@ -57,7 +57,7 @@ g.part3 = function(metadatadir=c(),f0,f1,anglethreshold = 5,
M = c()
load(paste(metadatadir,"/meta/basic/",fnames[i],sep=""))
if (M$filecorrupt == FALSE & M$filetooshort == FALSE) {
IMP = g.impute(M,I,strategy=1,hrs.del.start=0,hrs.del.end=0,maxdur=0)
IMP = g.impute(M,I,strategy=strategy,hrs.del.start=0,hrs.del.end=0,maxdur=0)
SLE = g.sib.det(M,IMP,I,twd=c(-12,12),timethreshold=timethreshold,anglethreshold=anglethreshold,desiredtz=desiredtz)
L5list = SLE$L5list
if (length(SLE$output) > 0 & SLE$detection.failed == FALSE) {
Expand Down
11 changes: 9 additions & 2 deletions R/g.part5.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ g.part5 = function(datadir=c(),metadatadir=c(),f0=c(),f1=c(),strategy=1,maxdur=7
# specify parameters
ffdone = fnames.ms5 #ffdone is now a list of files that have already been processed by g.part5
wdaynames = c("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
nfeatures = 500
nfeatures = 1000
ws3 = windowsizes[1]
ds_names = rep("",nfeatures)
di = 1
Expand Down Expand Up @@ -110,7 +110,14 @@ g.part5 = function(datadir=c(),metadatadir=c(),f0=c(),f1=c(),strategy=1,maxdur=7
}
# load output g.part2
selp = which(fnames.ms2 == fnames.ms3[i]) # so, fnames.ms3[i] is the reference point for filenames
try({
hayError=TRUE
load(file=paste(metadatadir,"/meta/ms2.out/",fnames.ms2[selp],sep=""))
hayError=FALSE
})
if(hayError){
stop(paste(metadatadir,"/meta/ms2.out/",fnames.ms2[selp],sep=""))
}
daysummary = SUM$daysummary
summary = SUM$summary
# load output g.part4
Expand Down Expand Up @@ -763,4 +770,4 @@ g.part5 = function(datadir=c(),metadatadir=c(),f0=c(),f1=c(),strategy=1,maxdur=7
}
}
}
}
}
2 changes: 1 addition & 1 deletion R/g.shell.GGIR.R
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ g.shell.GGIR = function(mode=c(1,2),datadir=c(),outputdir=c(),studyname=c(),f0=1
if (f1 == 0) f1 = length(dir(paste(metadatadir,"/meta/basic",sep="")))
g.part3(metadatadir=metadatadir,f0=f0,
f1=f1,anglethreshold=anglethreshold,timethreshold=timethreshold,
ignorenonwear=ignorenonwear,overwrite=overwrite,desiredtz=desiredtz)
ignorenonwear=ignorenonwear,overwrite=overwrite,desiredtz=desiredtz,strategy=strategy)
}
if (dopart4 == TRUE) {
cat('\n')
Expand Down