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 | Public Attributes | List of all members
PAData Class Reference

The PAData 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 PAData:
PAFitBit

Public Member Functions

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 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 ()
 

Public Attributes

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 PAData 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 PAData::PAData ( in  fullFilenameOrPath,
in  pStruct 
)

Constructor for PAData 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 PAData.

Member Function Documentation

static function PAData::appendStruct ( in  ltStruct,
in  rtStruct 
)
static

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.

Parameters
ltStructA structure whose fields are to be appended by the other.
rtStructA structure whose fields are will be appened to the other.
Return values
ltStructThe resultof append rtStruct to ltStruct.
Note
For example:
ltStruct =
ydata: [1 1]
accel: [1x1 struct]
[x]: 0.5000
[y]: 1
rtStruct =
xdata: [1 100]
PAData.structEval(ltStruct,rtStruct)
ans =
ydata: [1 1]
xdata: [1 100]
accel: [1x1 struct]
[xdata]: [1 100]
[x]: [10.5000 10.5000 2.5000]
[y]: [2 3 4]
function PAData::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.

function PAData::classifyUsageForAllAxes ( in  obj)

Classifies the usage state for each axis using count data from each axis.

Parameters
objInstance of PAData.
Return values
didClassifyTrue/False depending on success.
function PAData::classifyUsageState ( in  obj,
in  countActivity 
)

Categorizes the study's usage state.

Parameters
objInstance of PAData.
vectorof count activity to apply classification rules too. If not provided, then the vector magnitude is used by default.
Return values
usageVecA vector of length obj.dateTimeNum whose values represent the usage category at each sample instance specified by dateTimeNum.
  • c usageVec(activeVec) = 30
  • c usageVec(inactiveVec) = 25
  • c usageVec(~awakeVsAsleepVec) = 20
  • c usageVec(sleepVec) = 15 sleep period (could be a nap)
  • c usageVec(remSleepVec) = 10 REM sleep
  • c usageVec(nonwearVec) = 5 Non-wear
  • c usageVec(studyOverVec) = 0 Non-wear, study over.
usageStateA three column matrix identifying usage state and duration. Column 1 is the usage state, column 2 and column 3 are the states start and stop times (datenums).
Note
Usage states are categorized as follows:
  • c -1 Nonwear
  • c 0 Sleep - 0.25 rem, 0.75 nonrem
  • c 1 Wake - inactive
  • c 1 Wake - wake
Return values
startStopDatenumsStart and stop datenums for each usage state row entry of usageState.
function PAData::datenum2window ( in  obj,
in  datenumSample,
in  structType 
)

Returns the display window for the given datenum.

Parameters
objInstance of PAData.
datenumSampleA date number (datenum) that should be in the range of instance variable dateTimeNum
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
windowThe window.
function PAData::describeActivity ( in  obj,
in  categoryStr 
)

Describes an activity.

Note
This is not yet implemented.
Parameters
objInstance of PAData.
categoryStrThe type of activity to describe. This is a string. Values include:
  • c sleep
  • c wake
  • c inactivity
Return values
activityStructA struct describing the activity. Fields include:
  • c empty
function PAData::durationSamples ( in  obj)

Returns the number of samples contained in the time series data.

Parameters
objInstance of PAData
Return values
durationSampNumber of elements contained in durSamples instance var (initialized by number of elements in accelRaw.x
function PAData::extractFeature ( in  obj,
in  signalTagLine,
in  method 
)

Extracts features from the identified signal.

Parameters
objInstance of PAData.
signalTagLineTag identifying the signal to extract features from. Default is 'accel.count.vecMag'
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 PAData::getActivityTags ( )
static
function PAData::getAggregateDurationInMinutes ( in  obj)

Returns the current aggregate duration in minutes.

Parameters
objInstance of PAData
Return values
aggregateDurationThe current window;
function PAData::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.

Parameters
objInstance of PAData
featureFcnFunction name or handle to use to obtain features.
signalTagLineString name of the field to obtain data from.
elapsedStartHourElapsed hour (starting from 00:00 for new day) to begin aligning feature vectors.
intervalDurationHoursnumber of hours between consecutively aligned feature vectors.
Note
For example if elapsedStartHour is 1 and intervalDurationHours is 24, then alignedFeatureVecs will start at 01:00 of each day (and last for 24 hours a piece).
Return values
alignedFeatureVecsMatrix of row vectors, each of which is a feature calculated according to featureFcn and aligned according to elapsed start time and interval duration in hours. Consecutive rows are vector values in order of the section they are calculated from.
alignedStartDateVecsNx6 matrix of datevec values whose rows correspond to the start datevec of the corresponding row of alignedFeatureVecs.
function PAData::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.

Parameters
objInstance of PAData
Return values
binCountThe total number of frames contained in the data.
Note
In the case of data size is not broken perfectly into frames, but has an incomplete frame, the window count is rounded down. For example, if the frame duration 1 min, and the study is 1.5 minutes long, then the frame count is 1.
function PAData::getBinRate ( in  obj)

Returns the aggregate bin rate in units of aggregate bins/second.

Parameters
objInstance of PAData
Return values
fsAggregate bins per second.
function PAData::getColor ( in  obj,
in  structType 
)

Returns the color instance variable.

Parameters
objInstance of PAData
structTypeString specifying the structure type of label to retrieve. Possible values include (all are included if this is not)
  • timeSeries (default)
  • features
  • bins
Return values
colorStructA struct of color values correspodning to the time series fields of obj.color.
function PAData::getCurUncorrectedWindowRange ( in  obj,
in  structType 
)

Returns the current windows range.

Parameters
objInstance of PAData.
structTypeOptional string identifying the type of data to obtain the offset from. Can be
  • timeSeries (default)
  • features
  • bins
Return values
A2x1 vector with start, stop range of the current window returned as samples beginning with 1 for the first sample.
Note
This uses instance variables windowDurSec, curWindow, and sampleRate to determine the sample range for the current window. The first value is floored and the second is ceil'ed.
function PAData::getCurWindow ( in  obj)

Returns the current window.

Parameters
objInstance of PAData
Return values
curWindowThe current window;
function PAData::getCurWindowRange ( in  obj,
in  structType 
)

Returns a structure of PAData's time series data.

Parameters
objInstance of PAData.
structTypeOptional string identifying the type of data to obtain the offset from. Can be
  • timeSeries (default)
  • features
  • bins
Return values
A2x1 vector with start, stop range of the current window returned as samples beginning with 1 for the first sample. The second value (i.e. the stop sample) is capped at the current value of durationSamples().
Note
This uses instance variables windowDurSec, curWindow, and sampleRate to determine the sample range for the current window.
static function PAData::getDefaultParameters ( )
static

Returns a structure of PAData'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 PAData::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 PAData::getDisplayMinMax ( in  obj)

Returns the minimum and maximum amplitudes that can be displayed uner the current configuration.

Parameters
objInstance of PAData.
Return values
yLim1x2 vector containing ymin and ymax.
static function PAData::getDummyDisplayStruct ( in  structType)
static

Returns a struct with subfields that hold the line properties for graphic display of the time series instance variables.

Parameters
structType(Optional) String 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 PAData's time series instance variables, which include:
  • accel.(accelType).x.(xdata, ydata, color)
  • accel.(accelType).y.(xdata, ydata, color)
  • accel.(accelType).z.(xdata, ydata, color)
  • accel.(accelType).vecMag.(xdata, ydata, color)
  • inclinometer.(xdata, ydata, color)
  • lux.(xdata, ydata, color)
static function PAData::getDummyStruct ( in  structType)
static

Returns an empty struct with fields that mirror PAData's time series instance variables that contain.

Parameters
structType(Optional) String 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 PAData's time series, feature, or aggregate bin instance variables. Time series include:
  • accel.(accelType).x
  • accel.(accelType).y
  • accel.(accelType).z
  • accel.(accelType).vecMag
  • steps
  • lux
  • inclinometer
static function PAData::getExtractorDescriptions ( )
static

Returns a cell listing of available feature extraction methods as strings.

Return values
extractorDescriptionsCell listing with description of feature extraction methods.
  • none No feature extraction
  • rms Root mean square
  • hash
  • sum
  • median
  • mean
Note
These methods can be passed as the argument to PAData's prefilter() method.
static function PAData::getFeatureDescriptionStruct ( )
static

Returns a struct of feature extraction methods and string descriptions as the corresponding values.

Return values
featureStructA struct of feature extraction methods and string descriptions as the corresponding values.
static function PAData::getFeatureDescriptionStructWithPSDBands ( )
static
function PAData::getFilename ( in  obj)

Returns the filename, pathname, and full filename (pathname + filename) of the file that the accelerometer data was loaded from.

Parameters
objInstance of PAData
Return values
filenameThe short filename of the accelerometer data.
pathnameThe pathname of the accelerometer data.
fullFilenameThe full filename of the accelerometer data.
function PAData::getFrameableSampleCount ( in  obj)
function PAData::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.

Parameters
objInstance of PAData
Return values
frameCountThe total number of frames contained in the data.
Note
In the case of data size is not broken perfectly into frames, but has an incomplete frame, the window count is rounded down (floor). For example, if the frame duration 1 min, and the study is 1.5 minutes long, then the frame count is 1.
function PAData::getFrameDuration ( in  obj)

Returns the frame duration (in hours and minutes)

Parameters
objInstance of PAData
Return values
curFrameDurationMinThe current frame duration minutes field;
curFramDurationHourThe current frame duration hours field;
function PAData::getFrameDurationInMinutes ( in  obj)
function PAData::getFrameRate ( in  obj)

Returns the frame rate in units of frames/second.

Parameters
objInstance of PAData
Return values
fsFrames rate in Hz.
function PAData::getFullFilename ( in  obj)

Returns the full filename (pathname + filename) of the accelerometer data.

Parameters
objInstance of PAData
Return values
fullFilenameThe full filenmae of the accelerometer data.
Note
See also getFilename()
function PAData::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 PAData.
    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 PAData::getLabel ( in  obj,
in  structType 
)

Returns the label instance variable.

Parameters
objInstance of PAData
structTypeString specifying the structure type of label to retrieve. Possible values include:
  • timeSeries (default)
  • features
  • bins
Return values
labelStructA struct of string values which serve to label the correspodning to the time series fields of obj.label.
function PAData::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.

Parameters
objInstance of PAData.
fieldTypeString value identifying the time series data to perform the minmax operation on. Can be one of the following:
  • struct Returns a structure of minmax values with organization correspoding to that found by getStruct() instance method.
  • all Returns a 1x2 vector of the global minimum and maximum value found for any of the time series data stored in obj.
  • accel.count Returns a struct of minmax values for x,y, and z - accel.raw Returns a struct of minmax values for x,y, and z - lux Returns a 1x2 minmax vector for lux values.
  • inclinometer Returns a struct of minmax values for lux fields.
  • steps Returns a struct of minmax values for step fields.
Return values
minMaxMinimum maximum values for each time series field contained in obj.getStruct() or a single 2x1 vector of min max values for the field name specified.
function PAData::getOffAccelType ( in  obj,
in  accelTypeStr 
)

Retuns the accelType that is not set. This is useful in later removing unwanted accel fields.

Parameters
objInstance of PAData.
accelTypeStr(optional) String that can be used in place of obj.accelType for determining the current accel type to find the opposing accel type of (i.e. the offAccelType).
Return values
offAccelTypeEnumerated type which is either
  • count When accelType is raw
  • raw When accelType is count
  • [] All other cases.
function PAData::getOffset ( in  obj,
in  structType 
)

Returns the offset instance variable.

Parameters
objInstance of PAData
structTypeString specifying the structure type of label to retrieve. Possible values include (all are included if this not):
  • timeSeries (default)
  • features
  • bins
Return values
offsetStructA struct of scalar values correspodning to the struct type fields of obj.offset.
static function PAData::getPrefilterMethods ( )
static

Returns a cell listing of available prefilter methods as strings.

Return values
prefilterMethodsCell listing of prefilter methods.
  • none No prefiltering
  • rms Root mean square
  • hash
  • sum
  • median
  • mean
Note
These methods can be passed as the argument to PAData's prefilter() method.
function PAData::getPropertyStruct ( in  obj,
in  propertyName,
in  structType 
)

Returns the visible instance variable.

Parameters
objInstance of PAData
propertyNameName of instance variable being requested.
structTypeString specifying the structure type of label to retrieve. Possible values include (all are included if this is not)
  • timeSeries (default)
  • features
  • bins
Return values
visibileStructA struct of obj's visible field values
function PAData::getPSD ( in  obj)
static function PAData::getPSDBandNames ( )
static
function PAData::getPSDBands ( in  obj,
in  numBands 
)
static function PAData::getPSDExtractorDescriptions ( )
static
static function PAData::getPSDFeatureDescriptionStruct ( )
static
function PAData::getPSDSettings ( in  obj)
static function PAData::getRecurseMinmax ( in  dataStruct)
static

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.

Parameters
dataStructA structure whose fields are either structures or vectors.
Return values
minmaxVecNx2 vector of minmax values for the given dataStruct.
function PAData::getSampleRate ( in  obj)

Returns the samplerate of the x-axis accelerometer.

Parameters
objInstance of PAData
Return values
fsSample rate of the x-axis accelerometer.
function PAData::getSamplesPerWindow ( in  obj,
in  structType 
)

Returns the number of sample units (samples, bins, frames) for the for the current window resolution (duration in seconds).

Parameters
objInstance of PAData.
structTypeOptional string 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
Numberof samples, frames, or bins per window display;
Note
Calcuation based on instance variables windowDurSec and sampleRate
function PAData::getSaveParameters ( in  obj)

Returns a structure of PAData's saveable parameters as a struct.

Parameters
objInstance of PAData.
Return values
pStructA structure of save parameters which include the following fields
  • curWindow
  • pathname
  • filename
  • windowDurSec
  • aggregateDurMin
  • frameDurMin
  • frameDurHour
function PAData::getScale ( in  obj,
in  structType 
)

Returns the scale instance variable.

Parameters
objInstance of PAData
structTypeString specifying the structure type of label to retrieve. Possible values include (all are included if this not):
  • timeSeries (default)
  • features
  • bins
Return values
scaleStructA struct of scalar values correspodning to the time series fields of obj.scale.
function PAData::getStartStopDatenum ( in  obj)

Returns the start and stop datenums for the study.

Parameters
objInstance of PAData
Return values
startstopnumA 1x2 vector.
  • startstopnum(1) The datenum of the study's start
  • startstopnum(2) The datenum of the study's end.
function PAData::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.

Parameters
objInstance of PAData.
choice(optional) String indicating the type of structure to be returned; optional. Can be
  • dummy Empty data.
  • dummydisplay Holds generic line properties for the time series structure.
  • current Time series data with offset and scaling values applied.
  • currentdisplay Time series data with offset and scaling values applied and stored as 'ydata' child fields.
  • displayoffset [x,y,z] offsets of the current time series data being displayed. Values are stored in .position child field
  • all All (default) All available sensor fields
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 PAData's time series, aggregate bins, or features instance data. The fields for time series data include:
  • accel.(obj.accelType).x
  • accel.(obj.accelType).y
  • accel.(obj.accelType).z
  • accel.(obj.accelType).vecMag
  • steps
  • inclinometer
  • lux
static function PAData::getStructNameFromDescription ( in  description)
static

Returns the fieldname of PAData's struct types (see getStructTypes()) that matches the string argument.

Parameters
descriptionString description that can be
  • timeSeries = 'time series';
  • bins = 'aggregate bins';
  • features = 'features';
Return values
structNameName of the field that matches the description.
Note
For example:
structName = PAData.getStructNameFromDescription('time series');
results in structName = 'timeSeries'
static function PAData::getStructTypes ( )
static

Returns a struct representing the internal architecture used by PAData to hold and process acceleration data.

  • timeSeries = 'time series';
  • bins = 'aggregate bins';
  • features = 'features';
    Return values
    structTypeStruct with the following fields and corresponding string values.
    Note
    This is helpful in identifying different offset, scale, label, color, and miscellaneous graphic and data choices.
function PAData::getStudyID ( in  obj,
in  outputType 
)

Returns studyID instance variable.

Parameters
Instanceof PAData
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 PAData::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 PAData::getUsageClassificationRules ( in  this)
function PAData::getVisible ( in  obj,
in  structType 
)

Returns the visible instance variable.

Parameters
objInstance of PAData
structTypeString specifying the structure type of label to retrieve. Possible values include (all are included if this is not)
  • timeSeries (default)
  • features
  • bins
Return values
visibileStructA struct of obj's visible field values
function PAData::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.

Parameters
objInstance of PAData
Return values
windowCountThe maximum/last window allowed
Note
In the case of data size is not broken perfectly into windows, but has an incomplete window, the window count is rounded up. For example, if the time series data is 10 s in duration and the window size is defined as 30 seconds, then the windowCount is 1.
function PAData::getWindowDurSec ( in  obj)

Returns the private intance variable windowDurSec.

Parameters
objInstance of PAData
Return values
windowDurationSecThe value of windowDurSec
function PAData::getWindowSamplerate ( in  obj,
in  structType 
)

Returns the sampling rate for the current window display selection.

Parameters
objInstance of PAData
structTypeOptional string identifying the type of data to obtain the offset from. Can be
  • timeSeries (default) - sample units are sample points
  • features - sample units are frames
  • bins - sample units are bins
Return values
Samplerate of the data being viewed in Hz.
function PAData::loadCountFile ( in  obj,
in  fullCountFilename 
)

Loads an accelerometer "count" data file.

Parameters
objInstance of PAData.
fullCountFilenameThe full (i.e. with path) filename to load.
function PAData::loadFile ( in  obj,
in  fullfilename 
)

Loads an accelerometer data file.

Parameters
objInstance of PAData.
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 PAData::loadFileHeader ( in  obj,
in  fullFilename 
)

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

Parameters
objInstance of PAData.
fullFilenameThe full filename to open and examine.
function PAData::loadGT3XFile ( in  obj,
in  fullFilename 
)

Loads an accelerometer's raw data from binary files stored in the path name given.

Parameters
objInstance of PAData.
pathWithRawBinaryFilesName of the path (a string) that contains raw acceleromater data stored in one or more binary files.
Note
Currently, only two firmware versions are supported:
  • 2.5.0
  • 3.1.0
function PAData::loadPathOfRawBinary ( in  obj,
in  pathWithRawBinaryFiles 
)

Loads an accelerometer's raw data from binary files stored in the path name given.

Parameters
objInstance of PAData.
pathWithRawBinaryFilesName of the path (a string) that contains raw acceleromater data stored in one or more binary files.
Note
Currently, only two firmware versions are supported:
  • 2.5.0
  • 3.1.0
function PAData::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).

Parameters
objInstance of PAData.
fullRawCSVFilenameThe full (i.e. with path) filename for raw data to load.
static function PAData::merge_nearby_events ( in  event_mat_in,
in  min_samples 
)
static

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.

Parameters
event_mat_inis a two column matrix
min_samplesis a scalar value
Return values
merged_eventsThe output of merging event_mat's events that are separated by less than min_samples.
merged_indicesis a logical vector of the row indices that were merged from event_mat_in. - these are the indices of the in event_mat_in that are removed/replaced
Note
Lifted from SEV's CLASS_events.m - authored by Hyatt Moore IV
static function PAData::mergedCell ( in  startDateNum,
in  stopDateNum,
in  dateNumDelta,
in  sampledDateVec,
in  tmpDataCell,
in  missingValue 
)
static

Helper function for loading raw and count file formats to ensure proper ordering and I/O error handling.

Parameters
startDateNumThe start date number that the ordered data cell should begin at. (should be generated using datenum())
stopDateNumThe date number (generated using datenum()) that the ordered data cell ends at.
dateNumDeltaThe difference between two successive date number samples.
sampledDateVecVector of date number values taken between startDateNum and stopDateNum (inclusive) and are in the order and size as the individual cell components of tmpDataCell
tmpDataCellA cell of vectors whose individual values correspond to the order of sampledDateVec
missingValue(Optional) Value to be used in the ordered output data cell where the tmpDataCell does not have corresponding values. The default is 'nan'.
Return values
orderedDataCellA cell of vectors that are taken from tmpDataCell but initially filled with the missing value parameter and ordered according to synthDateNum.
synthDateVecMatrix of date vectors ([Y, Mon,Day, Hr, Mn, Sec]) generated by startDateNum:dateNumDelta:stopDateNum which correponds to the row order of orderedDataCell cell values/vectors
synthDateNumVector of date numbers corresponding to the date vector matrix return argument.
Note
This is a helper function for loading raw and count file formats to ensure proper ordering and I/O error handling.
static function PAData::mergeStruct ( in  ltStruct,
in  rtStruct 
)
static

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.

Parameters
ltStructA structure whose fields are to be appended by the other.
rtStructA structure whose fields are will be appened to the other.
Return values
ltStructThe result of merging rtStruct with ltStruct.
Note
For example:
ltStruct =
accel: [1x1 struct]
[x]: 0.5000
[y]: 1
lux: [1x1 struct]
[z]: 0.5000
rtStruct =
accel: [1x1 struct]
[pos]: [0.5000, 1, 0]
PAData.structEval(rtStruct,ltStruct)
ans =
accel: [1x1 struct]
[x]: 0.5000
[y]: 1
[pos]: [0.5000, 1, 0]
lux: [1x1 struct]
[z]: 0.5000
[pos]: [0.5000, 1, 0]
static function PAData::minmax ( in  dataStruct)
static

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.

Parameters
dataStructA structure whose fields are either structures or vectors.
Return values
structMinMaxa struct whose fields correspond to those of the input struct and whose values are [min, max] vectors that correspond to the minimum and maximum values found in the input structure for that field.
Note
Consider the example
dataStruct.accel.x = [-1 20 5 13];
dataStruct.accel.y = [1 70 9 3];
dataStruct.accel.z = [-10 2 5 1];
dataStruct.lux = [0 0 0 9];
structRange.accel is [-10 70]
structRange.lux is [0 9]
static function PAData::movingSummer ( in  signal,
in  filterOrder 
)
static

Moving summer finite impulse response filter.

Parameters
signalVector of sample data to filter.
filterOrderfilter order; number of taps in the filter
Return values
summedSignalThe filtered signal.
Note
The filter delay is taken into account such that the return signal is offset by half the delay.
static function PAData::overwriteEmptyStruct ( in  ltStruct,
in  rtStruct 
)
static

Inserts the second argument into any empty fields of the first struct argument.

Parameters
ltStructA structure whose empty fields will be set to the second argument.
rtStructA structure
Return values
ltStructThe structure that results from inserting rtStruct into ltStruct.
Note
For example:
ltStruct =
accel: [1x1 struct]
[x]: []
[y]: []
lux: []
rtStruct =
color: 'k'
data: [1x1 struct]
[pos]: [0.5000, 1, 0]
PAData.structEval(rtStruct,ltStruct)
ans =
accel: [1x1 struct]
[x]: [1x1 struct]
color: 'k'
data: [1x1 struct]
[pos]: [0.5000, 1, 0]
[y]: [1x1 struct]
color: 'k'
data: [1x1 struct]
[pos]: [0.5000, 1, 0]
lux: [1x1 struct]
color: 'k'
data: [1x1 struct]
[pos]: [0.5000, 1, 0]
static function PAData::parseInfoTxt ( in  infoTxtFullFilename)
static

Parses the information found in input file name and returns the result as a struct of field-value pairs.

Parameters
objInstance of PAData.
infoTxtFullFilenameName of the info.txt that contains sensor meta data.
Return values
infoStructA struct of the field value pairings parsed from info.txt
firmwareString value of Firmware field as found in the info.txt file. It is set to the empty string when not found.
Note
Currently, only two firmware versions are supported:
  • 2.5.0
  • 3.1.0
function PAData::prefilter ( in  obj,
in  method 
)

Prefilters accelerometer data.

Note
Not currently implemented.
Parameters
objInstance of PAData.
methodString name of the prefilter method.
function PAData::pruneStruct ( in  obj,
in  accelStruct 
)
static function PAData::reprocessEventVector ( in  logicalVec,
in  min_duration_samples,
in  merge_distance_samples 
)
static

Removes periods of activity that are too short and groups nearby activity groups together.

Parameters
logicalVecInitial vector which has 1's where an event or activity is occurring at that sample.
min_duration_samplesThe minimum number of consecutive samples required for a run of on (1) samples to be kept.
merge_distance_samplesThe maximum number of samples considered when looking for adjacent runs to merge together. Adjacent runs that are within this distance are merged into a single run beginning at the start of the first and stopping at the end of the last run.
Return values
processVecA vector of size (logicalVec) that has removed runs (of 1) that are too short and merged runs that are close enough together.
function PAData::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 PAData. %
Note
countPeriodSec, sampleRate, steps, lux, and accel values must be set in advance of this call.
function PAData::sample2window ( in  obj,
in  sample,
in  windowDurSec,
in  samplerate 
)

Calculates, and returns, the window for the given sample index of a signal.

Parameters
objInstance of PAData.
sampleSample point to discover the containing window of.
windowDurSecWindow duration in seconds (scalar) (optional)
samplerateSample rate of the data (optional)
Return values
windowThe window.
function PAData::saveToFile ( in  obj,
in  activityType,
in  saveFilename 
)

Saves data to an ascii file.

Note
This is not yet implemented.
Parameters
objInstance of PAData.
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 PAData::setAggregateDurationMinutes ( in  obj,
in  aggregateDurationMin 
)

Set the aggregate duration (in minutes) instance variable.

Parameters
objInstance of PAData
aggregateDurationMinThe aggregate duration to set aggregateDurMin to.
Return values
aggregateDurationMinThe current value of instance variable aggregateDurMin.
Note
If the input argument for aggregateDurationMin is negative or exceeds the current frame duration value (in minutes), then it is not used and the current frame duration is retained (and also returned).
function PAData::setColor ( in  obj,
in  fieldName,
in  newColor 
)

Sets the color instance variable for a particular sub field.

Parameters
objInstance of PAData
fieldNameDynamic field name to set in the 'color' struct.
Note
For example if fieldName = 'timeSeries.accel.vecMag' then obj.color.timeSerie.accel.vecMag = newColor; is evaluated.
Parameters
newColor1x3 vector to set obj.color.(fieldName) to.
function PAData::setCurWindow ( in  obj,
in  window 
)

Set the current window for the instance variable accelObj (PAData)

Parameters
objInstance of PAData
windowThe window to set curWindow to.
Return values
curWindowThe current value of instance variable curWindow.
Note
If the input argument for window is negative or exceeds the maximum window value for the time series data, then it is not used and the curWindow value is retained, and also returned.
function PAData::setFrameDurationHours ( in  obj,
in  frameDurationHours 
)

Set the frame duration (hours) instance variable.

Parameters
objInstance of PAData
frameDurationHoursThe frame duration to set frameDurHours instance variable to.
Return values
frameDurationHoursThe current value of instance variable frameDurHour.
Note
If the input argument for frameDurationHours is negative or exceeds the maximum duration of data, then it is not used and the current frame duration is retained (and also returned).
function PAData::setFrameDurationMinutes ( in  obj,
in  frameDurationMin 
)

Set the frame duration (in minutes) instance variable.

Parameters
objInstance of PAData
frameDurationMinThe frame duration to set frameDurMin to.
Return values
frameDurationMinThe current value of instance variable frameDurMin.
Note
If the input argument for frameDurationMin is negative or exceeds the maximum duration of data, then it is not used and the current frame duration is retained (and also returned).
function PAData::setFullFilename ( in  obj,
in  fullfilename 
)

Sets the pathname and filename instance variables using the input full filename.

Parameters
objInstance of PAData
fullfilenameThe full filenmae of the accelerometer data that will be set
Return values
success(T/F) -true: if fullfilename exists and is instance variables are set
  • false: otherwise
Note
See also getFilename()
function PAData::setOffset ( in  obj,
in  fieldName,
in  newOffset 
)

Sets the offset instance variable for a particular sub field.

Parameters
objInstance of PAData
fieldNameDynamic field name to set in the 'offset' struct.
Note
For example if fieldName = 'timeSeries.vecMag' then obj.offset.timeSeries.vecMag = newOffset; is evaluated.
Parameters
newOffsety-axis offset to set obj.offset.(fieldName) to.
function PAData::setProperty ( in  obj,
in  propertyName,
in  fieldName,
in  propertyValueStr 
)

Sets the specified instance variable for a particular sub field.

Parameters
objInstance of PAData
propertyNameinstance variable to set the property of.
fieldNameDynamic field name to set in the propertyName struct.
propertyValueStrString value of property to set fieldName to.
function PAData::setScale ( in  obj,
in  fieldName,
in  newScale 
)

Sets the scale instance variable for a particular sub field.

Parameters
objInstance of PAData
fieldNameDynamic field name to set in the 'scale' struct.
Note
For example if fieldName = 'timeSeries.vecMag' then obj.scale.timeSeries.vecMag = newScale; is evaluated.
Parameters
newScaleScalar value to set obj.scale.(fieldName) to.
function PAData::setUsageClassificationRules ( in  this,
in  ruleStruct 
)

Updates the usage state rules with an input struct.

Parameters
function PAData::setVisible ( in  obj,
in  fieldName,
in  newVisibilityStr 
)

Sets the visible instance variable for a particular sub field.

Parameters
objInstance of PAData
fieldNameDynamic field name to set in the 'visible' struct.
newVisibilityStrVisibility property value.
Note
Valid values include
  • on
  • off
function PAData::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.

Parameters
objInstance of PAData
durSecDuration in seconds. Must be positive. Value is first rounded to ensure it is an integer.
Return values
durSecWindow duration in seconds of obj.
Note
Instance variable curWindow is recalculated based on new window duration.
static function PAData::struct2vec ( in  structure,
in  vector 
)
static

flattens a structure to a single dimensional array (i.e. a vector)

Parameters
structureA struct with any number of fields.
Return values
vectorA vector with values that are taken from the structure.
static function PAData::structEval ( in  operand,
in  ltStruct,
in  rtStruct,
in  optionalDestFieldOrValue 
)
static

Evaluates the two structures, field for field, using the function name provided.

Parameters
operandA string name of the operation (via 'eval') to conduct at the lowest level. Additional operands include:
  • passthrough Requires Optional field name to be set.
  • calculateposition (requires rtStruct to have .xdata and .ydata fields.
ltStructA structure whose fields are either structures or vectors.
rtStructA structure whose fields are either structures or vectors.
optionalDestFieldOptional field name to subset the resulting output structure to (see last example). This can be useful if the output structure will be passed as input that expects a specific sub field name for the values (e.g. line properties). See last example below.
Return values
resultStructA structure with same fields as ltStruct and rtStruct whose values are the result of applying operand to corresponding fields.
Note
In the special case that operand is set to 'passthrough' only ltStruct is used (enter ltStruct as the rtStruct value) and the optionalDestField must be set (i.e. cannot be empty). The purpose of the 'passthrough' operation is to insert a field named optionalDestField between any field/non-struct value pairs.
For example:
ltStruct =
x: 2
accel: [1x1 struct]
[x]: 0.5000
[y]: 1
rtStruct =
x: [10 10 2]
accel: [1x1 struct]
[x]: [10 10 2]
[y]: [1 2 3]
PAData.structEval('plus',rtStruct,ltStruct)
ans =
x: [12 12 4]
accel: [1x1 struct]
[x]: [10.5000 10.5000 2.5000]
[y]: [2 3 4]
PAData.structEval('plus',rtStruct,ltStruct,'ydata')
ans =
x.ydata: [12 12 4]
accel: [1x1 struct]
[x].ydata: [10.5000 10.5000 2.5000]
[y].ydata: [2 3 4]
PAData.structEval('passthrough',ltStruct,ltStruct,'string')
ans =
x.string: 2
accel: [1x1 struct]
[x].string: 0.5000
[y].string: 1
PAData.structEval('overwrite',ltStruct,ltStruct,value)
ans =
x: value
accel: [1x1 struct]
[x]: value
[y]: value
static function PAData::structScalarEval ( in  operand,
in  ltStruct,
in  A,
in  optionalDestField 
)
static

Evaluates the two structures, field for field, using the function name provided.

Parameters
operandA string name of the operation (via 'eval') to conduct at the lowest level.
ltStructA structure whose fields are either structures or vectors.
AMatrix value of the same dimension as the first structure's (ltStruct) non-struct field values.
optionalDestFieldOptional field name to subset the resulting output structure to (see last example). This can be useful if the output structure will be passed as input that expects a specific sub field name for the values (e.g. line properties). See last example below.
Return values
resultStructA structure with same fields as ltStruct and optionally the optionalDestField whose values are the result of applying operand to corresponding fields and the input matrix.
Note
For example:
ltStruct =
x.position: [10 10 2]
accel: [1x1 struct]
[x.position]: [10 10 2]
[y.position]: [1 2 3]
A =
[1 1 0]
PAData.structEval('plus',ltStruct,A)
ans =
x.position: [11 11 2]
accel: [1x1 struct]
[x.position]: [11 11 2]
[y.position]: [2 3 3]
function PAData::subsindex ( in  obj,
in  indices,
in  structType 
)

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

Parameters
objInstance of PAData
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 PAData'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 PAData::subsref ( in  obj,
in  s 
)
static function PAData::subsStruct ( in  structIn,
in  indices 
)
static

Returns structure whose values are taken from the struct and indices provided.

Parameters
structInStruct of indicable data.
indicesVector (logical or ordinal) of indices to select time series data by.
Return values
structOutStruct with matching fields as input struct, with values taken at indices.
static function PAData::thresholdcrossings ( in  line_in,
in  threshold_line 
)
static

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.

Return values
static function PAData::unrollEvents ( in  eventsStartStop,
in  vectorSize 
)
static

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.

Parameters
eventStartStop
vectorSizeThe length or size of the sample data to unroll the start stop events back to.
Note
eventStartStop = thresholdCrossings(vector,0);
Return values
vector
static function PAData::updateStructWithStruct ( in  structToUpdate,
in  structToUpdateWith 
)
static
function PAData::window2datenum ( in  obj,
in  windowSample 
)

Returns the starting datenum for the window given.

Parameters
objInstance of PAData.
windowSampleIndex of the window to check. %
Return values
dateNumthe datenum value at the start of windowSample.
Note
The starting point is adjusted based on obj startDatenum value and its windowDurSec instance variable.

Member Data Documentation

Property PAData::accel

Structure of count and raw accelerations structs (x,y,z). Fields are:

  • raw Structure of raw x,y,z accelerations. Fields are:
    • x x-axis
    • y y-axis
    • z z-axis
  • count Structure of actigraph derived counts for x,y,z acceleration readings. Fields are:
    • x x-axis
    • y y-axis
    • z z-axis
    • vecMag vectorMagnitude
Property PAData::accelType

Type of acceleration stored; can be.

  • raw This is not processed
  • count This is preprocessed
  • all - This is both raw and count accel fields.
Property PAData::color
Property PAData::dateTimeNum

The numeric value for each date time sample provided by.

Property PAData::durationSec

Durtion of the sampled data in seconds.

Property PAData::inclinometer

Structure of inclinometer values. Fields include:

  • off
  • standing
  • sitting
  • lying
Property PAData::label
Property PAData::lineproperty

Struct of line handle properties corresponding to the fields of linehandle. These are derived from the input files loaded by the PAData class.

Property PAData::lux

Luminance levels.

Constant Property PAData::NUM_PSD_BANDS = 5
Property PAData::offset
Property PAData::psd

Structure of power spectral densities for count and raw accelerations structs (x,y,z). Fields are:

  • frames PSD of the data currently in the frames member variable.
  • count Structure of actigraph derived counts for x,y,z acceleration readings. Fields are:
    • x x-axis
    • y y-axis
    • z z-axis
    • vecMag vectorMagnitude
  • raw Structure of raw x,y,z accelerations. Fields are:
    • x x-axis
    • y y-axis
    • z z-axis
Property PAData::scale
Property PAData::startDate

Start Date.

Property PAData::startDatenums

Numeric values for date time sample for the start of extracted features.

Property PAData::startTime

Start Time.

Property PAData::steps

Steps - unknown? Maybe pedometer type reading?

Property PAData::stopDatenums

Numeric values for date time sample for when the extracted features stop/end.

Property PAData::studyID

Identifier (string) for the file data that was loaded.

Note
See getStudyIDFromBasename()
Property PAData::timeStamp

Time of day (HH:MM:SS) of sample reading.

Property PAData::usage

Structure of usage states determined from the following axes counts:

  • x x-axis
  • y y-axis
  • z z-axis
  • vecMag vectorMagnitude
Property PAData::visible
Property PAData::yDelta

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