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.
|
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...
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... | |
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.
function PAData::PAData | ( | in | fullFilenameOrPath, |
in | pStruct | ||
) |
Constructor for PAData class.
fullFilenameOrPath | Either
|
pStruct | Optional struct of parameters to use. If it is not included then parameters from getDefaultParameters method are used. |
Instance | of PAData. |
|
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.
ltStruct | A structure whose fields are to be appended by the other. |
rtStruct | A structure whose fields are will be appened to the other. |
ltStruct | The resultof append rtStruct to ltStruct. |
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.
obj | Instance of PAData. |
didClassify | True/False depending on success. |
function PAData::classifyUsageState | ( | in | obj, |
in | countActivity | ||
) |
Categorizes the study's usage state.
obj | Instance of PAData. |
vector | of count activity to apply classification rules too. If not provided, then the vector magnitude is used by default. |
usageVec | A vector of length obj.dateTimeNum whose values represent the usage category at each sample instance specified by dateTimeNum.
|
usageState | A 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). |
startStopDatenums | Start 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.
obj | Instance of PAData. |
datenumSample | A date number (datenum) that should be in the range of instance variable dateTimeNum |
structType | String (optional) identifying the type of data to obtain the offset from. Can be
|
window | The window. |
function PAData::describeActivity | ( | in | obj, |
in | categoryStr | ||
) |
Describes an activity.
obj | Instance of PAData. |
categoryStr | The type of activity to describe. This is a string. Values include:
|
activityStruct | A struct describing the activity. Fields include:
|
function PAData::durationSamples | ( | in | obj | ) |
Returns the number of samples contained in the time series data.
obj | Instance of PAData |
durationSamp | Number 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.
obj | Instance of PAData. |
signalTagLine | Tag identifying the signal to extract features from. Default is 'accel.count.vecMag' |
method | String name of the extraction method. Possible values include:
|
|
static |
function PAData::getAggregateDurationInMinutes | ( | in | obj | ) |
Returns the current aggregate duration in minutes.
obj | Instance of PAData |
aggregateDuration | The 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.
obj | Instance of PAData |
featureFcn | Function name or handle to use to obtain features. |
signalTagLine | String name of the field to obtain data from. |
elapsedStartHour | Elapsed hour (starting from 00:00 for new day) to begin aligning feature vectors. |
intervalDurationHours | number of hours between consecutively aligned feature vectors. |
alignedFeatureVecs | Matrix 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. |
alignedStartDateVecs | Nx6 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.
obj | Instance of PAData |
binCount | The total number of frames contained in the data. |
function PAData::getBinRate | ( | in | obj | ) |
Returns the aggregate bin rate in units of aggregate bins/second.
obj | Instance of PAData |
fs | Aggregate bins per second. |
function PAData::getColor | ( | in | obj, |
in | structType | ||
) |
Returns the color instance variable.
obj | Instance of PAData |
structType | String specifying the structure type of label to retrieve. Possible values include (all are included if this is not)
|
colorStruct | A 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.
obj | Instance of PAData. |
structType | Optional string identifying the type of data to obtain the offset from. Can be
|
A | 2x1 vector with start, stop range of the current window returned as samples beginning with 1 for the first sample. |
function PAData::getCurWindow | ( | in | obj | ) |
Returns the current window.
obj | Instance of PAData |
curWindow | The current window; |
function PAData::getCurWindowRange | ( | in | obj, |
in | structType | ||
) |
Returns a structure of PAData's time series data.
obj | Instance of PAData. |
structType | Optional string identifying the type of data to obtain the offset from. Can be
|
A | 2x1 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(). |
|
static |
Returns a structure of PAData's default parameters as a struct.
pStruct | A structure of default parameters which include the following fields
|
|
static |
returns a cell of tag lines and the associated label describing the tag line.
tagLines | Cell of tag lines |
labels | Cell of string descriptions that correspond to tag lines in the tagLines cell. |
function PAData::getDisplayMinMax | ( | in | obj | ) |
Returns the minimum and maximum amplitudes that can be displayed uner the current configuration.
obj | Instance of PAData. |
yLim | 1x2 vector containing ymin and ymax. |
|
static |
Returns a struct with subfields that hold the line properties for graphic display of the time series instance variables.
structType | (Optional) String identifying the type of data to obtain the offset from. Can be
|
dat | A struct of PAData's time series instance variables, which include:
|
|
static |
Returns an empty struct with fields that mirror PAData's time series instance variables that contain.
structType | (Optional) String identifying the type of data to obtain the offset from. Can be
|
dat | A struct of PAData's time series, feature, or aggregate bin instance variables. Time series include:
|
|
static |
Returns a cell listing of available feature extraction methods as strings.
extractorDescriptions | Cell listing with description of feature extraction methods.
|
|
static |
Returns a struct of feature extraction methods and string descriptions as the corresponding values.
featureStruct | A struct of feature extraction methods and string descriptions as the corresponding values. |
|
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.
obj | Instance of PAData |
filename | The short filename of the accelerometer data. |
pathname | The pathname of the accelerometer data. |
fullFilename | The 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.
obj | Instance of PAData |
frameCount | The total number of frames contained in the data. |
function PAData::getFrameDuration | ( | in | obj | ) |
Returns the frame duration (in hours and minutes)
obj | Instance of PAData |
curFrameDurationMin | The current frame duration minutes field; |
curFramDurationHour | The current frame duration hours field; |
function PAData::getFrameDurationInMinutes | ( | in | obj | ) |
function PAData::getFrameRate | ( | in | obj | ) |
Returns the frame rate in units of frames/second.
obj | Instance of PAData |
fs | Frames rate in Hz. |
function PAData::getFullFilename | ( | in | obj | ) |
Returns the full filename (pathname + filename) of the accelerometer data.
obj | Instance of PAData |
fullFilename | The full filenmae of the accelerometer data. |
function PAData::getHeaderAsString | ( | in | obj | ) |
Returns header values as a single, printable string. Results include.
obj | Instance of PAData. |
headerStr | Character 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.
obj | Instance of PAData |
structType | String specifying the structure type of label to retrieve. Possible values include:
|
labelStruct | A 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.
obj | Instance of PAData. |
fieldType | String value identifying the time series data to perform the minmax operation on. Can be one of the following:
|
minMax | Minimum 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.
obj | Instance 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). |
offAccelType | Enumerated type which is either
|
function PAData::getOffset | ( | in | obj, |
in | structType | ||
) |
Returns the offset instance variable.
obj | Instance of PAData |
structType | String specifying the structure type of label to retrieve. Possible values include (all are included if this not):
|
offsetStruct | A struct of scalar values correspodning to the struct type fields of obj.offset. |
|
static |
Returns a cell listing of available prefilter methods as strings.
prefilterMethods | Cell listing of prefilter methods.
|
function PAData::getPropertyStruct | ( | in | obj, |
in | propertyName, | ||
in | structType | ||
) |
Returns the visible instance variable.
obj | Instance of PAData |
propertyName | Name of instance variable being requested. |
structType | String specifying the structure type of label to retrieve. Possible values include (all are included if this is not)
|
visibileStruct | A struct of obj's visible field values |
function PAData::getPSD | ( | in | obj | ) |
|
static |
function PAData::getPSDBands | ( | in | obj, |
in | numBands | ||
) |
|
static |
|
static |
function PAData::getPSDSettings | ( | in | obj | ) |
|
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.
dataStruct | A structure whose fields are either structures or vectors. |
minmaxVec | Nx2 vector of minmax values for the given dataStruct. |
function PAData::getSampleRate | ( | in | obj | ) |
Returns the samplerate of the x-axis accelerometer.
obj | Instance of PAData |
fs | Sample 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).
obj | Instance of PAData. |
structType | Optional string identifying the type of data to obtain the offset from. Can be
|
Number | of samples, frames, or bins per window display; |
function PAData::getSaveParameters | ( | in | obj | ) |
function PAData::getScale | ( | in | obj, |
in | structType | ||
) |
Returns the scale instance variable.
obj | Instance of PAData |
structType | String specifying the structure type of label to retrieve. Possible values include (all are included if this not):
|
scaleStruct | A 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.
obj | Instance of PAData |
startstopnum | A 1x2 vector.
|
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.
obj | Instance of PAData. |
choice | (optional) String indicating the type of structure to be returned; optional. Can be
|
structType | String (optional) identifying the type of data to obtain the offset from. Can be
|
dat | A struct of PAData's time series, aggregate bins, or features instance data. The fields for time series data include:
|
|
static |
Returns the fieldname of PAData's struct types (see getStructTypes()) that matches the string argument.
description | String description that can be
|
structName | Name of the field that matches the description. |
|
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'; structType | Struct with the following fields and corresponding string values. |
function PAData::getStudyID | ( | in | obj, |
in | outputType | ||
) |
Returns studyID instance variable.
Instance | of PAData |
Optional | output format for the study id. Can be
|
Study | ID that identifies the data (i.e. what or who it is attributed to). |
|
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.
File | basename (i.e. sans path and file extension). |
Study | ID |
function PAData::getUsageClassificationRules | ( | in | this | ) |
function PAData::getVisible | ( | in | obj, |
in | structType | ||
) |
Returns the visible instance variable.
obj | Instance of PAData |
structType | String specifying the structure type of label to retrieve. Possible values include (all are included if this is not)
|
visibileStruct | A 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.
obj | Instance of PAData |
windowCount | The maximum/last window allowed |
function PAData::getWindowDurSec | ( | in | obj | ) |
Returns the private intance variable windowDurSec.
obj | Instance of PAData |
windowDurationSec | The value of windowDurSec |
function PAData::getWindowSamplerate | ( | in | obj, |
in | structType | ||
) |
Returns the sampling rate for the current window display selection.
obj | Instance of PAData |
structType | Optional string identifying the type of data to obtain the offset from. Can be
|
Sample | rate of the data being viewed in Hz. |
function PAData::loadCountFile | ( | in | obj, |
in | fullCountFilename | ||
) |
Loads an accelerometer "count" data file.
obj | Instance of PAData. |
fullCountFilename | The full (i.e. with path) filename to load. |
function PAData::loadFile | ( | in | obj, |
in | fullfilename | ||
) |
Loads an accelerometer data file.
obj | Instance 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).
obj | Instance of PAData. |
fullFilename | The 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.
obj | Instance of PAData. |
pathWithRawBinaryFiles | Name of the path (a string) that contains raw acceleromater data stored in one or more binary files. |
function PAData::loadPathOfRawBinary | ( | in | obj, |
in | pathWithRawBinaryFiles | ||
) |
Loads an accelerometer's raw data from binary files stored in the path name given.
obj | Instance of PAData. |
pathWithRawBinaryFiles | Name of the path (a string) that contains raw acceleromater data stored in one or more binary files. |
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).
obj | Instance of PAData. |
fullRawCSVFilename | The full (i.e. with path) filename for raw data to load. |
|
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.
event_mat_in | is a two column matrix |
min_samples | is a scalar value |
merged_events | The output of merging event_mat's events that are separated by less than min_samples. |
merged_indices | is 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 |
|
static |
Helper function for loading raw and count file formats to ensure proper ordering and I/O error handling.
startDateNum | The start date number that the ordered data cell should begin at. (should be generated using datenum()) |
stopDateNum | The date number (generated using datenum()) that the ordered data cell ends at. |
dateNumDelta | The difference between two successive date number samples. |
sampledDateVec | Vector of date number values taken between startDateNum and stopDateNum (inclusive) and are in the order and size as the individual cell components of tmpDataCell |
tmpDataCell | A 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'. |
orderedDataCell | A cell of vectors that are taken from tmpDataCell but initially filled with the missing value parameter and ordered according to synthDateNum. |
synthDateVec | Matrix 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 |
synthDateNum | Vector of date numbers corresponding to the date vector matrix return argument. |
|
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.
ltStruct | A structure whose fields are to be appended by the other. |
rtStruct | A structure whose fields are will be appened to the other. |
ltStruct | The result of merging rtStruct with ltStruct. |
|
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.
dataStruct | A structure whose fields are either structures or vectors. |
structMinMax | a 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. |
|
static |
Moving summer finite impulse response filter.
signal | Vector of sample data to filter. |
filterOrder | filter order; number of taps in the filter |
summedSignal | The filtered signal. |
|
static |
Inserts the second argument into any empty fields of the first struct argument.
ltStruct | A structure whose empty fields will be set to the second argument. |
rtStruct | A structure |
ltStruct | The structure that results from inserting rtStruct into ltStruct. |
|
static |
Parses the information found in input file name and returns the result as a struct of field-value pairs.
obj | Instance of PAData. |
infoTxtFullFilename | Name of the info.txt that contains sensor meta data. |
infoStruct | A struct of the field value pairings parsed from info.txt |
firmware | String value of Firmware field as found in the info.txt file. It is set to the empty string when not found. |
function PAData::prefilter | ( | in | obj, |
in | method | ||
) |
Prefilters accelerometer data.
obj | Instance of PAData. |
method | String name of the prefilter method. |
function PAData::pruneStruct | ( | in | obj, |
in | accelStruct | ||
) |
|
static |
Removes periods of activity that are too short and groups nearby activity groups together.
logicalVec | Initial vector which has 1's where an event or activity is occurring at that sample. |
min_duration_samples | The minimum number of consecutive samples required for a run of on (1) samples to be kept. |
merge_distance_samples | The 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. |
processVec | A 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()).
obj | Instance of PAData. % |
function PAData::sample2window | ( | in | obj, |
in | sample, | ||
in | windowDurSec, | ||
in | samplerate | ||
) |
Calculates, and returns, the window for the given sample index of a signal.
obj | Instance of PAData. |
sample | Sample point to discover the containing window of. |
windowDurSec | Window duration in seconds (scalar) (optional) |
samplerate | Sample rate of the data (optional) |
window | The window. |
function PAData::saveToFile | ( | in | obj, |
in | activityType, | ||
in | saveFilename | ||
) |
Saves data to an ascii file.
obj | Instance of PAData. |
activityType | The type of activity to save. This is a string. Values include:
|
saveFilename | Name of the file to save data to. |
function PAData::setAggregateDurationMinutes | ( | in | obj, |
in | aggregateDurationMin | ||
) |
Set the aggregate duration (in minutes) instance variable.
obj | Instance of PAData |
aggregateDurationMin | The aggregate duration to set aggregateDurMin to. |
aggregateDurationMin | The current value of instance variable aggregateDurMin. |
function PAData::setColor | ( | in | obj, |
in | fieldName, | ||
in | newColor | ||
) |
Sets the color instance variable for a particular sub field.
obj | Instance of PAData |
fieldName | Dynamic field name to set in the 'color' struct. |
newColor | 1x3 vector to set obj.color.(fieldName) to. |
function PAData::setCurWindow | ( | in | obj, |
in | window | ||
) |
Set the current window for the instance variable accelObj (PAData)
obj | Instance of PAData |
window | The window to set curWindow to. |
curWindow | The current value of instance variable curWindow. |
function PAData::setFrameDurationHours | ( | in | obj, |
in | frameDurationHours | ||
) |
Set the frame duration (hours) instance variable.
obj | Instance of PAData |
frameDurationHours | The frame duration to set frameDurHours instance variable to. |
frameDurationHours | The current value of instance variable frameDurHour. |
function PAData::setFrameDurationMinutes | ( | in | obj, |
in | frameDurationMin | ||
) |
Set the frame duration (in minutes) instance variable.
obj | Instance of PAData |
frameDurationMin | The frame duration to set frameDurMin to. |
frameDurationMin | The current value of instance variable frameDurMin. |
function PAData::setFullFilename | ( | in | obj, |
in | fullfilename | ||
) |
Sets the pathname and filename instance variables using the input full filename.
obj | Instance of PAData |
fullfilename | The full filenmae of the accelerometer data that will be set |
success | (T/F) -true: if fullfilename exists and is instance variables are set
|
function PAData::setOffset | ( | in | obj, |
in | fieldName, | ||
in | newOffset | ||
) |
Sets the offset instance variable for a particular sub field.
obj | Instance of PAData |
fieldName | Dynamic field name to set in the 'offset' struct. |
newOffset | y-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.
obj | Instance of PAData |
propertyName | instance variable to set the property of. |
fieldName | Dynamic field name to set in the propertyName struct. |
propertyValueStr | String 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.
obj | Instance of PAData |
fieldName | Dynamic field name to set in the 'scale' struct. |
newScale | Scalar value to set obj.scale.(fieldName) to. |
function PAData::setUsageClassificationRules | ( | in | this, |
in | ruleStruct | ||
) |
Updates the usage state rules with an input struct.
function PAData::setVisible | ( | in | obj, |
in | fieldName, | ||
in | newVisibilityStr | ||
) |
Sets the visible instance variable for a particular sub field.
obj | Instance of PAData |
fieldName | Dynamic field name to set in the 'visible' struct. |
newVisibilityStr | Visibility property value. |
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.
obj | Instance of PAData |
durSec | Duration in seconds. Must be positive. Value is first rounded to ensure it is an integer. |
durSec | Window duration in seconds of obj. |
|
static |
flattens a structure to a single dimensional array (i.e. a vector)
structure | A struct with any number of fields. |
vector | A vector with values that are taken from the structure. |
|
static |
Evaluates the two structures, field for field, using the function name provided.
operand | A string name of the operation (via 'eval') to conduct at the lowest level. Additional operands include:
|
ltStruct | A structure whose fields are either structures or vectors. |
rtStruct | A structure whose fields are either structures or vectors. |
optionalDestField | Optional 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. |
resultStruct | A structure with same fields as ltStruct and rtStruct whose values are the result of applying operand to corresponding fields. |
|
static |
Evaluates the two structures, field for field, using the function name provided.
operand | A string name of the operation (via 'eval') to conduct at the lowest level. |
ltStruct | A structure whose fields are either structures or vectors. |
A | Matrix value of the same dimension as the first structure's (ltStruct) non-struct field values. |
optionalDestField | Optional 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. |
resultStruct | A 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. |
function PAData::subsindex | ( | in | obj, |
in | indices, | ||
in | structType | ||
) |
overloaded subsindex method returns structure of time series data at indices provided.
obj | Instance of PAData |
indices | Vector (logical or ordinal) of indices to select time series data by. |
structType | String (optional) identifying the type of data to obtain the offset from. Can be
|
dat | A struct of PAData's time series instance data for the indices provided. The fields include:
|
function PAData::subsref | ( | in | obj, |
in | s | ||
) |
|
static |
Returns structure whose values are taken from the struct and indices provided.
structIn | Struct of indicable data. |
indices | Vector (logical or ordinal) of indices to select time series data by. |
structOut | Struct with matching fields as input struct, with values taken at indices. |
|
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.
|
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.
eventStartStop | |
vectorSize | The length or size of the sample data to unroll the start stop events back to. |
vector |
|
static |
function PAData::window2datenum | ( | in | obj, |
in | windowSample | ||
) |
Returns the starting datenum for the window given.
obj | Instance of PAData. |
windowSample | Index of the window to check. % |
dateNum | the datenum value at the start of windowSample. |
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: count
Structure of actigraph derived counts for x,y,z acceleration readings. Fields are: Property PAData::accelType |
Type of acceleration stored; can be.
raw
This is not processedcount
This is preprocessedall
- 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:
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: raw
Structure of raw x,y,z accelerations. Fields are: 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.
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:
Property PAData::visible |
Property PAData::yDelta |