Skip to content

Commit

Permalink
refactor: cleanup: rm unused nonWearFile variable
Browse files Browse the repository at this point in the history
  • Loading branch information
chanshing committed Dec 20, 2024
1 parent b362508 commit 462c2b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
5 changes: 1 addition & 4 deletions src/accelerometer/accProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def main(): # noqa: C901

# Set default output filenames
args.summaryFile = os.path.join(args.outputFolder, inputFileName + "-summary.json")
args.nonWearFile = os.path.join(args.outputFolder, inputFileName + "-nonWearBouts.csv.gz")
args.epochFile = os.path.join(args.outputFolder, inputFileName + "-epoch.csv.gz")
args.stationaryFile = os.path.join(args.outputFolder, inputFileName + "-stationaryPoints.csv.gz")
args.tsFile = os.path.join(args.outputFolder, inputFileName + "-timeSeries.csv.gz")
Expand All @@ -276,8 +275,6 @@ def deleteIntermediateFiles():
try:
if os.path.exists(args.stationaryFile):
os.remove(args.stationaryFile)
if os.path.exists(args.nonWearFile):
os.remove(args.nonWearFile)
if os.path.exists(args.epochFile):
os.remove(args.epochFile)
except OSError:
Expand Down Expand Up @@ -326,7 +323,7 @@ def deleteIntermediateFiles():

# Summarise epoch
epochData, labels = accelerometer.summarisation.getActivitySummary(
args.epochFile, args.nonWearFile, summary,
args.epochFile, summary,
activityClassification=args.activityClassification,
timeZone=args.timeZone, startTime=args.startTime,
endTime=args.endTime, epochPeriod=args.epochPeriod,
Expand Down
9 changes: 3 additions & 6 deletions src/accelerometer/summarisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def getActivitySummary( # noqa: C901
epochFile, nonWearFile, summary,
epochFile, summary,
activityClassification=True, timeZone='Europe/London',
startTime=None, endTime=None,
epochPeriod=30, stationaryStd=13, minNonWearDuration=60,
Expand All @@ -31,7 +31,6 @@ def getActivitySummary( # noqa: C901
7) derive main movement summaries (overall, weekday/weekend, and hour)
:param str epochFile: Input csv.gz file of processed epoch data
:param str nonWearFile: Output filename for non wear .csv.gz episodes
:param dict summary: Output dictionary containing all summary metrics
:param bool activityClassification: Perform machine learning of activity states
:param str timeZone: timezone in country/city format to be used for daylight savings crossover check
Expand All @@ -51,16 +50,14 @@ def getActivitySummary( # noqa: C901
:return: A tuple containing a pandas dataframe of activity epoch data,
activity prediction labels (empty if <activityClassification>==False), and
movement summary values written to dict <summary>. Also writes .csv.gz non
wear episodes file to <nonWearFile>.
movement summary values written to dict <summary>.
:rtype: tuple
.. code-block:: python
import summariseEpoch
summary = {}
epochData, labels = summariseEpoch.getActivitySummary( "epoch.csv.gz",
"nonWear.csv.gz", summary)
epochData, labels = summariseEpoch.getActivitySummary("epoch.csv.gz", summary)
"""

utils.toScreen("=== Summarizing ===")
Expand Down

0 comments on commit 462c2b6

Please sign in to comment.