-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18b3883
commit d2f11ef
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |