Padaco  1.6
Toolbox for interpreting Actigraph accelerometer data collected from children in order to better understand their physical activity and sleep patterns with the intent of reducing obesity and improving their overall health.
Public Member Functions | Static Public Member Functions | List of all members
PAFitBit Class Reference

The PAFitBit class helps loads and stores accelerometer data used in the physical activity monitoring project. The project is aimed at reducing obesity and improving health in children. More...

Inheritance diagram for PAFitBit:
PAData

Public Member Functions

function PAFitBit (in fullFilenameOrPath, in pStruct)
 Constructor for PAFitBit class. More...
 
function getStudyID (in obj, in outputType)
 Returns studyID instance variable. More...
 
function loadFileHeader (in obj, in fullFilename)
 Load CSV header values (start time, start date, and window period). More...
 
function getHeaderAsString (in obj)
 Returns header values as a single, printable string. Results include. More...
 
function loadFile (in obj, in fullfilename)
 Loads an accelerometer data file. More...
 
function loadFitBitFile (in obj, in fullCountFilename)
 Loads an accelerometer "count" data file. More...
 
function resampleCountData (in obj)
 Resamples previously loaded 'count' data to match sample rate of raw accelerometer data that has been loaded in a following step (see loadFile()). More...
 
function extractFeature (in obj, in signalTagLine, in method)
 Extracts features from the identified signal. More...
 
function saveToFile (in obj, in activityType, in saveFilename)
 Saves data to an ascii file. More...
 
function subsindex (in obj, in indices, in structType)
 overloaded subsindex method returns structure of time series data at indices provided. More...
 
function subsref (in obj, in s)
 
- Public Member Functions inherited from PAData
function PAData (in fullFilenameOrPath, in pStruct)
 Constructor for PAData class. More...
 
function getCurWindowRange (in obj, in structType)
 Returns a structure of PAData's time series data. More...
 
function getCurUncorrectedWindowRange (in obj, in structType)
 Returns the current windows range. More...
 
function getSamplesPerWindow (in obj, in structType)
 Returns the number of sample units (samples, bins, frames) for the for the current window resolution (duration in seconds). More...
 
function getWindowSamplerate (in obj, in structType)
 Returns the sampling rate for the current window display selection. More...
 
function getSampleRate (in obj)
 Returns the samplerate of the x-axis accelerometer. More...
 
function getUsageClassificationRules (in this)
 
function setUsageClassificationRules (in this, in ruleStruct)
 Updates the usage state rules with an input struct. More...
 
function getFrameRate (in obj)
 Returns the frame rate in units of frames/second. More...
 
function getBinRate (in obj)
 Returns the aggregate bin rate in units of aggregate bins/second. More...
 
function setCurWindow (in obj, in window)
 Set the current window for the instance variable accelObj (PAData) More...
 
function getCurWindow (in obj)
 Returns the current window. More...
 
function setAggregateDurationMinutes (in obj, in aggregateDurationMin)
 Set the aggregate duration (in minutes) instance variable. More...
 
function getAggregateDurationInMinutes (in obj)
 Returns the current aggregate duration in minutes. More...
 
function getBinCount (in obj)
 Returns the total number of aggregated bins the data can be divided into based on frame rate and the duration of the time series data. More...
 
function getStudyID (in obj, in outputType)
 Returns studyID instance variable. More...
 
function setFrameDurationMinutes (in obj, in frameDurationMin)
 Set the frame duration (in minutes) instance variable. More...
 
function setFrameDurationHours (in obj, in frameDurationHours)
 Set the frame duration (hours) instance variable. More...
 
function getFrameDuration (in obj)
 Returns the frame duration (in hours and minutes) More...
 
function getFrameDurationInMinutes (in obj)
 
function getFrameCount (in obj)
 Returns the total number of frames the data can be divided into evenly based on frame rate and the duration of the time series data. More...
 
function durationSamples (in obj)
 Returns the number of samples contained in the time series data. More...
 
function setWindowDurSec (in obj, in durSec)
 Set the window duration value in seconds. This is the displays window size (i.e. one window shown at a time), in seconds. More...
 
function getVisible (in obj, in structType)
 Returns the visible instance variable. More...
 
function getColor (in obj, in structType)
 Returns the color instance variable. More...
 
function getScale (in obj, in structType)
 Returns the scale instance variable. More...
 
function getOffset (in obj, in structType)
 Returns the offset instance variable. More...
 
function getLabel (in obj, in structType)
 Returns the label instance variable. More...
 
function getOffAccelType (in obj, in accelTypeStr)
 Retuns the accelType that is not set. This is useful in later removing unwanted accel fields. More...
 
function getPropertyStruct (in obj, in propertyName, in structType)
 Returns the visible instance variable. More...
 
function pruneStruct (in obj, in accelStruct)
 
function setOffset (in obj, in fieldName, in newOffset)
 Sets the offset instance variable for a particular sub field. More...
 
function setScale (in obj, in fieldName, in newScale)
 Sets the scale instance variable for a particular sub field. More...
 
function setColor (in obj, in fieldName, in newColor)
 Sets the color instance variable for a particular sub field. More...
 
function setVisible (in obj, in fieldName, in newVisibilityStr)
 Sets the visible instance variable for a particular sub field. More...
 
function setProperty (in obj, in propertyName, in fieldName, in propertyValueStr)
 Sets the specified instance variable for a particular sub field. More...
 
function getWindowCount (in obj)
 Returns the total number of windows the data can be divided into based on sampling rate, window resolution (i.e. duration), and the size of the time series data. More...
 
function getStartStopDatenum (in obj)
 Returns the start and stop datenums for the study. More...
 
function getDisplayMinMax (in obj)
 Returns the minimum and maximum amplitudes that can be displayed uner the current configuration. More...
 
function getMinmax (in obj, in fieldType)
 Returns the minmax value(s) for the object's (obj) time series data Returns either a structure or 1x2 vector of [min, max] values for the field specified. More...
 
function getFilename (in obj)
 Returns the filename, pathname, and full filename (pathname + filename) of the file that the accelerometer data was loaded from. More...
 
function setFullFilename (in obj, in fullfilename)
 Sets the pathname and filename instance variables using the input full filename. More...
 
function getFullFilename (in obj)
 Returns the full filename (pathname + filename) of the accelerometer data. More...
 
function getWindowDurSec (in obj)
 Returns the private intance variable windowDurSec. More...
 
function loadFileHeader (in obj, in fullFilename)
 Load CSV header values (start time, start date, and window period). More...
 
function getHeaderAsString (in obj)
 Returns header values as a single, printable string. Results include. More...
 
function loadFile (in obj, in fullfilename)
 Loads an accelerometer data file. More...
 
function loadCountFile (in obj, in fullCountFilename)
 Loads an accelerometer "count" data file. More...
 
function loadRawCSVFile (in obj, in fullRawCSVFilename)
 Loads an accelerometer raw data file. This function is intended to be called from loadFile() to ensure that loadCountFile is called in advance to guarantee that the auxialiary sensor measurements are loaded into the object (obj). The auxialiary measures (e.g. lux, steps) are upsampled to the sampling rate of the raw data (typically 40 Hz). More...
 
function loadGT3XFile (in obj, in fullFilename)
 Loads an accelerometer's raw data from binary files stored in the path name given. More...
 
function loadPathOfRawBinary (in obj, in pathWithRawBinaryFiles)
 Loads an accelerometer's raw data from binary files stored in the path name given. More...
 
function resampleCountData (in obj)
 Resamples previously loaded 'count' data to match sample rate of raw accelerometer data that has been loaded in a following step (see loadFile()). More...
 
function sample2window (in obj, in sample, in windowDurSec, in samplerate)
 Calculates, and returns, the window for the given sample index of a signal. More...
 
function datenum2window (in obj, in datenumSample, in structType)
 Returns the display window for the given datenum. More...
 
function window2datenum (in obj, in windowSample)
 Returns the starting datenum for the window given. More...
 
function prefilter (in obj, in method)
 Prefilters accelerometer data. More...
 
function getFrameableSampleCount (in obj)
 
function extractFeature (in obj, in signalTagLine, in method)
 Extracts features from the identified signal. More...
 
function calculatePSD (in obj, in signalTagLine)
 Calculates the PSD for the current frames and assigns the result to obj.psd.frames. Will also assign obj.frames_signalTagLine to the signalTagLine argument when provided, otherwise the current value for obj.frames_signalTagLine is assumed to be correct and specific for the source of the frame data. PSD bands are assigned to their named fields (e.g. psd_band_1) in the obj.features.(bandName) field. More...
 
function getPSD (in obj)
 
function getPSDBands (in obj, in numBands)
 
function getPSDSettings (in obj)
 
function getAlignedFeatureVecs (in obj, in featureFcn, in signalTagLine, in elapsedStartHour, in intervalDurationHours)
 Calculates a desired feature for a particular acceleration object's field value. and returns it as a matrix of elapsed time aligned vectors. More...
 
function classifyUsageForAllAxes (in obj)
 Classifies the usage state for each axis using count data from each axis. More...
 
function classifyUsageState (in obj, in countActivity)
 Categorizes the study's usage state. More...
 
function describeActivity (in obj, in categoryStr)
 Describes an activity. More...
 
function saveToFile (in obj, in activityType, in saveFilename)
 Saves data to an ascii file. More...
 
function subsindex (in obj, in indices, in structType)
 overloaded subsindex method returns structure of time series data at indices provided. More...
 
function subsref (in obj, in s)
 
function getStruct (in obj, in choice, in structType)
 Returns a structure of PAData's time series fields and values, depending on the user's input selection. More...
 
function getSaveParameters (in obj)
 Returns a structure of PAData's saveable parameters as a struct. More...
 

Static Public Member Functions

static function getDefaultTagLineLabels ()
 returns a cell of tag lines and the associated label describing the tag line. More...
 
static function getDefaultParameters ()
 Returns a structure of PAFitBit's default parameters as a struct. More...
 
static function getStudyIDFromBasename (in baseName)
 Parses the input file's basename (i.e. sans folder and extension) for the study id. This will vary according from site to site as there is little standardization for file naming. More...
 
- Static Public Member Functions inherited from PAData
static function parseInfoTxt (in infoTxtFullFilename)
 Parses the information found in input file name and returns the result as a struct of field-value pairs. More...
 
static function reprocessEventVector (in logicalVec, in min_duration_samples, in merge_distance_samples)
 Removes periods of activity that are too short and groups nearby activity groups together. More...
 
static function movingSummer (in signal, in filterOrder)
 Moving summer finite impulse response filter. More...
 
static function unrollEvents (in eventsStartStop, in vectorSize)
 Helper function to convert an Nx2 matrix of start stop events into a single logical vector with 1's located at the locations corresponding to the samples inclusively between eventStartStops row entries. More...
 
static function getDefaultTagLineLabels ()
 returns a cell of tag lines and the associated label describing the tag line. More...
 
static function getDefaultParameters ()
 Returns a structure of PAData's default parameters as a struct. More...
 
static function subsStruct (in structIn, in indices)
 Returns structure whose values are taken from the struct and indices provided. More...
 
static function mergedCell (in startDateNum, in stopDateNum, in dateNumDelta, in sampledDateVec, in tmpDataCell, in missingValue)
 Helper function for loading raw and count file formats to ensure proper ordering and I/O error handling. More...
 
static function structEval (in operand, in ltStruct, in rtStruct, in optionalDestFieldOrValue)
 Evaluates the two structures, field for field, using the function name provided. More...
 
static function structScalarEval (in operand, in ltStruct, in A, in optionalDestField)
 Evaluates the two structures, field for field, using the function name provided. More...
 
static function appendStruct (in ltStruct, in rtStruct)
 Appends the fields of one to another. Values for fields of the same name are taken from the right struct (rtStruct) and built into the output struct. If the left struct does not have a matching field, then it will be created with the right structs value. More...
 
static function mergeStruct (in ltStruct, in rtStruct)
 Merge the fields of one struct with another. Copies over matching field values. Similar to appendStruct, but now the second argument is itself a struct with similar organization as the first argument. More...
 
static function overwriteEmptyStruct (in ltStruct, in rtStruct)
 Inserts the second argument into any empty fields of the first struct argument. More...
 
static function struct2vec (in structure, in vector)
 flattens a structure to a single dimensional array (i.e. a vector) More...
 
static function minmax (in dataStruct)
 Evaluates the range (min, max) of components found in the input struct argument and returns the range as struct values with matching fieldnames/organization as the input struct's highest level. More...
 
static function updateStructWithStruct (in structToUpdate, in structToUpdateWith)
 
static function getRecurseMinmax (in dataStruct)
 Recursive helper function for minmax() input struct argument and returns the range as struct values with matching fieldnames/organization as the input struct's highest level. More...
 
static function getDummyStruct (in structType)
 Returns an empty struct with fields that mirror PAData's time series instance variables that contain. More...
 
static function getDummyDisplayStruct (in structType)
 Returns a struct with subfields that hold the line properties for graphic display of the time series instance variables. More...
 
static function getPrefilterMethods ()
 Returns a cell listing of available prefilter methods as strings. More...
 
static function getExtractorDescriptions ()
 Returns a cell listing of available feature extraction methods as strings. More...
 
static function getFeatureDescriptionStruct ()
 Returns a struct of feature extraction methods and string descriptions as the corresponding values. More...
 
static function getFeatureDescriptionStructWithPSDBands ()
 
static function getPSDFeatureDescriptionStruct ()
 
static function getPSDExtractorDescriptions ()
 
static function getStructTypes ()
 Returns a struct representing the internal architecture used by PAData to hold and process acceleration data. More...
 
static function getStructNameFromDescription (in description)
 Returns the fieldname of PAData's struct types (see getStructTypes()) that matches the string argument. More...
 
static function thresholdcrossings (in line_in, in threshold_line)
 Returns start and stop pairs of the sample points where where line_in is greater (i.e. crosses) than threshold_line threshold_line and line_in must be of the same length if threshold_line is not a scalar value. More...
 
static function merge_nearby_events (in event_mat_in, in min_samples)
 Merges events, that are separated by less than some minimum number of samples, into a single event that stretches from the start of the first event and spans until the last event of each minimally separated event pairings. Events that are not minimally separated by another event are retained with the output. More...
 
static function getStudyIDFromBasename (in baseName)
 Parses the input file's basename (i.e. sans folder and extension) for the study id. This will vary according from site to site as there is little standardization for file naming. More...
 
static function getActivityTags ()
 
static function getPSDBandNames ()
 

Additional Inherited Members

- Public Attributes inherited from PAData
Constant Property NUM_PSD_BANDS = 5
 
Property accelType
 Type of acceleration stored; can be. More...
 
Property accel
 Structure of count and raw accelerations structs (x,y,z). Fields are: More...
 
Property usage
 Structure of usage states determined from the following axes counts: More...
 
Property psd
 Structure of power spectral densities for count and raw accelerations structs (x,y,z). Fields are: More...
 
Property inclinometer
 Structure of inclinometer values. Fields include: More...
 
Property steps
 Steps - unknown? Maybe pedometer type reading? More...
 
Property timeStamp
 Time of day (HH:MM:SS) of sample reading. More...
 
Property lux
 Luminance levels. More...
 
Property startTime
 Start Time. More...
 
Property startDate
 Start Date. More...
 
Property durationSec
 Durtion of the sampled data in seconds. More...
 
Property dateTimeNum
 The numeric value for each date time sample provided by. More...
 
Property startDatenums
 Numeric values for date time sample for the start of extracted features. More...
 
Property stopDatenums
 Numeric values for date time sample for when the extracted features stop/end. More...
 
Property lineproperty
 Struct of line handle properties corresponding to the fields of linehandle. These are derived from the input files loaded by the PAData class. More...
 
Property label
 
Property color
 
Property offset
 
Property scale
 
Property visible
 
Property yDelta
 
Property studyID
 Identifier (string) for the file data that was loaded. More...
 

Detailed Description

The PAFitBit class helps loads and stores accelerometer data used in the physical activity monitoring project. The project is aimed at reducing obesity and improving health in children.

Constructor & Destructor Documentation

function PAFitBit::PAFitBit ( in  fullFilenameOrPath,
in  pStruct 
)

Constructor for PAFitBit class.

Parameters
fullFilenameOrPathEither
  • (1) the full filename (i.e. with pathname) of accelerometer data to load.
  • or (2) the path that contains raw accelerometer data stored in binary file(s) - Firmware versions 2.5 or 3.1 only.
pStructOptional struct of parameters to use. If it is not included then parameters from getDefaultParameters method are used.
Return values
Instanceof PAFitBit.

Member Function Documentation

function PAFitBit::extractFeature ( in  obj,
in  signalTagLine,
in  method 
)

Extracts features from the identified signal.

Parameters
objInstance of PAFitBit.
signalTagLineTag identifying the signal to extract features from. Default is 'accel.fitbit.steps'
methodString name of the extraction method. Possible values include:
  • c none
  • c all
  • c rms
  • c median
  • c mean
  • c sum
  • c var
  • c std
  • c mode
  • c usagestate
  • c psd
static function PAFitBit::getDefaultParameters ( )
static

Returns a structure of PAFitBit's default parameters as a struct.

Return values
pStructA structure of default parameters which include the following fields
  • curWindow
  • pathname
  • filename
  • windowDurSec
  • aggregateDurMin
  • frameDurMin
  • frameDurHour
  • windowDurSec
  • scale
  • label
  • offset
  • color
  • visible
  • usageState Struct defining usage state classification thresholds and parameters.
Note
This is useful with the PASettings companion class.
When adding default parameters, be sure to match saveable parameters in getSaveParameters()
static function PAFitBit::getDefaultTagLineLabels ( )
static

returns a cell of tag lines and the associated label describing the tag line.

Return values
tagLinesCell of tag lines
labelsCell of string descriptions that correspond to tag lines in the tagLines cell.
Note
Tag lines are useful for dynamic struct indexing into structs returned by getStruct.
function PAFitBit::getHeaderAsString ( in  obj)

Returns header values as a single, printable string. Results include.

  • Filename
  • Duration ([dd] Days, [hh] hr [mm] min [ss] sec]
  • Window count
  • Start Date
  • Start Time
    Parameters
    objInstance of PAFitBit.
    Return values
    headerStrCharacter array listing header fields and corresponding values. Field and values are separated by colon (:), while field:values are separated from each other with newlines (
    ).
function PAFitBit::getStudyID ( in  obj,
in  outputType 
)

Returns studyID instance variable.

Parameters
Instanceof PAFitBit
Optionaloutput format for the study id. Can be
  • 'string'
  • 'numeric'
Return values
StudyID that identifies the data (i.e. what or who it is attributed to).
static function PAFitBit::getStudyIDFromBasename ( in  baseName)
static

Parses the input file's basename (i.e. sans folder and extension) for the study id. This will vary according from site to site as there is little standardization for file naming.

Parameters
Filebasename (i.e. sans path and file extension).
Return values
StudyID
function PAFitBit::loadFile ( in  obj,
in  fullfilename 
)

Loads an accelerometer data file.

Parameters
objInstance of PAFitBit.
fullfilename(optional) Full filename to load. If this is not included, or does not exist, then the instance variables pathname and filename are used to identify the file to load.
function PAFitBit::loadFileHeader ( in  obj,
in  fullFilename 
)

Load CSV header values (start time, start date, and window period).

Parameters
objInstance of PAFitBit.
fullFilenameThe full filename to open and examine.
function PAFitBit::loadFitBitFile ( in  obj,
in  fullCountFilename 
)

Loads an accelerometer "count" data file.

Parameters
objInstance of PAFitBit.
fullCountFilenameThe full (i.e. with path) filename to load.
function PAFitBit::resampleCountData ( in  obj)

Resamples previously loaded 'count' data to match sample rate of raw accelerometer data that has been loaded in a following step (see loadFile()).

Parameters
objInstance of PAFitBit. %
Note
countPeriodSec, sampleRate, steps, lux, and accel values must be set in advance of this call.
function PAFitBit::saveToFile ( in  obj,
in  activityType,
in  saveFilename 
)

Saves data to an ascii file.

Note
This is not yet implemented.
Parameters
objInstance of PAFitBit.
activityTypeThe type of activity to save. This is a string. Values include:
  • c usageState
  • c activitiy
  • c inactivity
  • c sleep
saveFilenameName of the file to save data to.
Note
This method is under construction and does not actually save any data at the moment.
function PAFitBit::subsindex ( in  obj,
in  indices,
in  structType 
)

overloaded subsindex method returns structure of time series data at indices provided.

Parameters
objInstance of PAFitBit
indicesVector (logical or ordinal) of indices to select time series data by.
structTypeString (optional) identifying the type of data to obtain the offset from. Can be
  • timeSeries (default) - units are sample points
  • features - units are frames
  • bins - units are bins
Return values
datA struct of PAFitBit's time series instance data for the indices provided. The fields include:
  • accel.(accelType).x
  • accel.(accelType).y
  • accel.(accelType).z
  • accel.(accelType).vecMag
  • steps
  • lux
  • inclinometer
function PAFitBit::subsref ( in  obj,
in  s 
)

The documentation for this class was generated from the following file: