Skip to content

Commit

Permalink
roxygen fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davebraze committed Oct 11, 2016
1 parent d468405 commit adfeb40
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 67 deletions.
56 changes: 33 additions & 23 deletions R/readELascii.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
##' @details Used by readELascii(). Not intended for end-users. Extract fixations, saccades, blinks
##' and other data from an individual trial.
##'
##' @param bounds A numeric tuple. e1 is index marking beginning of trial. e2 is index indicating
##' end of trial.
##' @param lines A vector of strings, each corresponding to 1 line of the EL ASCII file.
##' @param msgSet A character vector of regular expressions to identify eyelink MSG lines to catch.
##' @return A list of 6 elements, data.frames enumerating fixations, saccades, blinks, TRIAL_VARs,
##' samples and messages for the trial.
##' @param bounds A numeric tuple. e1 is index marking beginning of
##' trial. e2 is index indicating end of trial.
##' @param lines A vector of strings, each corresponding to 1 line of
##' the EL ASCII file.
##' @param msgSet A character vector of regular expressions to
##' identify eyelink MSG lines to catch.
##' @return A list of 6 elements, data.frames enumerating fixations,
##' saccades, blinks, TRIAL_VARs, samples and messages for the
##' trial.
##' @author Dave Braze \email{davebraze@@gmail.com}
getEyelinkTrialData <- function(bounds,
lines,
Expand Down Expand Up @@ -264,25 +267,32 @@ getEyelinkTrialData <- function(bounds,

##' @title Get events from SR Research ASCII data files.
##'
##' @description Convenience function to call SRR utility edf2asc from inside R.
##' @description Convenience function to call SRR utility edf2asc from
##' inside R.
##'
##' @details
##' SR Research provides a utility (EDF2ASC.exe) that dumps ASCII renderings of their proprietary
##' EDF data file format. This function reads those ASCII files and extracts eye-movement events
##' (fixations, saccades, blinks), specified MSG events, and TRIAL_VARs from them.
##' @details SR Research provides a utility (EDF2ASC.exe) that dumps
##' ASCII renderings of their proprietary EDF data file
##' format. This function reads those ASCII files and extracts
##' eye-movement events (fixations, saccades, blinks), specified
##' MSG events, and TRIAL_VARs from them.
##'
##' @param file A string giving path/fname to input file (ELascii file).
##' @param tStartRE A string containing regular expression that uniquely identifies beginnings of
##' trials.
##' @param tEndRE A string containing regular expression that uniquely identifies ends of trials. If
##' an experiment is aborted prematurely, then the *edf file (and so the *asc file) may not have
##' a proper trial end event. TODO: test for that case and handle it while throwing a warning.
##' @param msgSet A character vector. Each element identifies a MSG event to recover from the data
##' file.
##' @param subjID If NULL (default), use filename as subject ID. Otherwise use specified string.
##' @return List with two elements, one for session information, and one containing a list of
##' trials. Each trial element is itself a list of 6 elements: data.frames enumerating
##' fixations, saccades, blinks, samples, TRIAL_VARs and MSGs for the trial.
##' @param file A string giving path/fname to input file (ELascii
##' file).
##' @param tStartRE A string containing regular expression that
##' uniquely identifies beginnings of trials.
##' @param tEndRE A string containing regular expression that uniquely
##' identifies ends of trials. If an experiment is aborted
##' prematurely, then the *edf file (and so the *asc file) may not
##' have a proper trial end event. TODO: test for that case and
##' handle it while throwing a warning.
##' @param msgSet A character vector. Each element identifies a MSG
##' event to recover from the data file.
##' @param subjID If NULL (default), use filename as subject
##' ID. Otherwise use specified string.
##' @return List with two elements, one for session information, and
##' one containing a list of trials. Each trial element is itself
##' a list of 6 elements: data.frames enumerating fixations,
##' saccades, blinks, samples, TRIAL_VARs and MSGs for the trial.
##' @author Dave Braze \email{davebraze@@gmail.com}
##' @export
readELascii <- function(file,
Expand Down
17 changes: 11 additions & 6 deletions R/textRegions.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
##' This vector can be written to file and hand edited to add or
##' correct information in the yaml block, or to re-specify region
##' placements.
##' @seealso regdef2ias
##' @author Dave Braze \email{davebraze@@gmail.com}
##' @export

Expand Down Expand Up @@ -173,9 +174,11 @@ reg2regdef <- function(reg, scrnW=NA, scrnH=NA,
##' @param fname A string containing the name of a "region definition"
##' file, such as might be created by reg2regdef(). See Details.
##'
##' @return A data.frame specifying the content of an SRR interest area file (*.ias). Use
##' readr::write_delim(..., delim="\n", col_names=FALSE) to save the interest area specification
##' to file.
##' @return A data.frame specifying the content of an SRR interest
##' area file (*.ias). Use \code{readr::write_delim(...,
##' delim="\n", col_names=FALSE)} to save the interest area
##' specification to file.
##' @seealso reg2regdef
##' @author Dave Braze \email{davebraze@@gmail.com}
##' @export
regdef2ias <- function(fname) {
Expand Down Expand Up @@ -220,16 +223,18 @@ regdef2ias <- function(fname) {
## find the (vertical) beginnings and ends of regions, in pixel units
x1 <- (x1_char * 12) + (parms$margins$left - 1) ## translate char to pix
if (!is.na(parms$regions$padL)) x1[1] <- x1[1] - parms$regions$padL
x1 <- as.integer(x1)
x2 <- (x2_char * 12) + (parms$margins$left - 1) ## translate char to pix
if (!is.na(parms$regions$padR)) x2[length(x2)] <- x2[length(x2)] + parms$regions$padR
x2 <- as.integer(x2)

## get the upper and lower y coordinates (pixels) of regions
y1 <- parms$lines$baseline[1] - parms$regions$maxH
y2 <- parms$lines$baseline[1] + parms$regions$minH
y1 <- as.integer(parms$lines$baseline[1] - parms$regions$maxH)
y2 <- as.integer(parms$lines$baseline[1] + parms$regions$minH)

## other columns for current text/mark line
type <- "RECTANGLE" ## region type
regnum <- 1:length(x1) ## region numbers
regnum <- as.integer(1:length(x1)) ## region numbers
labs <- txt ## region labels
labs <- stringr::str_replace_all(labs, " ", "_")
labs <- stringr::str_replace_all(labs, '"', "'")
Expand Down
15 changes: 9 additions & 6 deletions man/getEyelinkTrialData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 24 additions & 16 deletions man/readELascii.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/reg2regdef.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 7 additions & 16 deletions man/regdef2ias.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit adfeb40

Please sign in to comment.