locoDataMunger
extractDateStr
extractDateStr (s)
readMetaAndCount
readMetaAndCount (dataFolder, companionEspObj, startMin, endMin, initialResamplePeriod, smoothing, longForm=False)
Reads the MetaDatas, CountLogs, FeedLogs, PortLocations from the path provided
| Type | Default | Details | |
|---|---|---|---|
| dataFolder | str | path to folder that contains all the relevant data files. | |
| companionEspObj | data object | calculated from espresso package. | |
| startMin | int, | the starting minute for the period to be included in the analysis. | |
| endMin | int | the ending minute for the period to be included in the analysis. | |
| initialResamplePeriod | int | period for resampling functions in milliseconds, default 50. | |
| smoothing | boolean | parameter for whether or not to smooth the data. | |
| longForm | bool | False | parameter to indicate whether or not the multiple data files were from one longitudinal experiment. |
| Returns | pandas dataframe | contains all the metaData tables. |
calculateSpeedinCountLog
calculateSpeedinCountLog (countLogDf, companionPortLocationsDf, smoothing, speedThreshold=30, gaussianWindowSize=10, gaussianSTD=3)
Calcualtes speed from data in countLogs
| Type | Default | Details | |
|---|---|---|---|
| countLogDf | pandas dataframe | contains all the countLog tables. | |
| companionPortLocationsDf | pandas dataframe | contains all of the portLocation tables. | |
| smoothing | |||
| speedThreshold | int | 30 | threshold to remove data points where speed is deemed too high, default value 30. |
| gaussianWindowSize | int | 10 | window size for gaussian smoothing, default value 10. |
| gaussianSTD | int | 3 | |
| Returns | pandas dataframe | contains all updated countLogs, including newly calculated speed. |
calculatePeriFeedLoco
calculatePeriFeedLoco (countLogDf, companionPortLocationsDf, companionEspObj, exptSum, monitorWindow=120, startMin=0, endMin=120)
Calculates speed around feeds
| Type | Default | Details | |
|---|---|---|---|
| countLogDf | pandas dataframe | contains all the countLog tables. | |
| companionPortLocationsDf | pandas dataframe | contains all of the portLocation tables. | |
| companionEspObj | data object | calculated from espresso package. | |
| exptSum | |||
| monitorWindow | int | 120 | window size in seconds for the period before and after feed for speed to be calculated |
| startMin | int | 0 | the starting minute for the period to be included in the analysis |
| endMin | int | 120 | the ending minute for the period to be included in the analysis |
| Returns | pandas dataframe | contains updated feeds with associated per feed metrics. |
fallEvents
fallEvents (countLogDf, nstd=4, windowsize=1000, ewm1=12, ewm2=26, ewm3=9)
Calculates fall events
| Type | Default | Details | |
|---|---|---|---|
| countLogDf | pandas dataframe | contains all the countLog tables. | |
| nstd | int | 4 | number of standards deviations for calculating speed threshold for fall detection, default value 4 |
| windowsize | int | 1000 | number of samples around the fall event for speed threshold to be calculated. |
| ewm1 | int | 12 | |
| ewm2 | int | 26 | moving average analysis parameter 2, default value 26. |
| ewm3 | int | 9 | moving average analysis parameter 3, default value 9. |
| Returns | pandas series | a list of timestamps where falls happened |
labelStretches
labelStretches (vector)
correctInPortData
correctInPortData (countLogDf)
intrapolateUnderThreshold
intrapolateUnderThreshold (s, th)
assignStatus
assignStatus (metaDataDf)