Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
hapiersiak authored Feb 5, 2025
1 parent 18b3883 commit d2f11ef
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions software/management/dashboard/1_tottags_batch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""
Function: This script finds all .pkl files in a specified directory, extracts the subject_id from the filename,
loads the corresponding data, and processes it using the get_daily_ranging_statistics function.
Usage:
cd SociTrack/software/management/dashboard
python3 1_tottags_batch.py
"""

import os
from processing import *


def process_pkl_files(directory):
"""Find all .pkl files in the directory, extract subject_id, load data, and process it."""
for filename in os.listdir(directory):
if filename.endswith(".pkl"):
filepath = os.path.join(directory, filename)

# Extract subject_id from filename
subject_id = filename.split("_")[0]

# Load pkl data
TC = load_data(filepath)

# Call the function with formatted parameters
get_daily_ranging_statistics(TC, [f"{subject_id}_CG1", f"{subject_id}_CG2"], 3)


# Define directory path
directory_path = "/Users/hannahpiersiak/Desktop/tottags"

# Run the function
process_pkl_files(directory_path)

0 comments on commit d2f11ef

Please sign in to comment.