Skip to content

Commit 126788f

Browse files
committed
pushing group plot logic, not yet tailored for vosslab linux
1 parent 4883613 commit 126788f

File tree

4 files changed

+33
-18
lines changed

4 files changed

+33
-18
lines changed

code/main.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
from utils.mnt import create_symlinks
22
from utils.save import Save
3+
from utils.group import Group
34
from core.gg import GG
45
import sys
56

6-
INT_DIR = '/mnt/nfs/lss/vosslabhpc/Projects/BOOST/InterventionStudy/3-experiment/data/act-int-test'
7-
OBS_DIR = '/mnt/nfs/lss/vosslabhpc/Projects/BOOST/ObservationalStudy/3-experiment/data/act-obs-test'
8-
RDSS_DIR = '/mnt/nfs/rdss/vosslab/Repositories/Accelerometer_Data'
97

10-
class pipe:
8+
class Pipe:
9+
INT_DIR = '/mnt/nfs/lss/vosslabhpc/Projects/BOOST/InterventionStudy/3-experiment/data/act-int-test'
10+
OBS_DIR = '/mnt/nfs/lss/vosslabhpc/Projects/BOOST/ObservationalStudy/3-experiment/data/act-obs-test'
11+
RDSS_DIR = '/mnt/nfs/rdss/vosslab/Repositories/Accelerometer_Data'
1112
def __init__(self, token, daysago):
1213
self.token = token
1314
self.daysago = daysago
1415

1516
def run_pipe(self):
1617
self._create_syms()
1718
matched = Save(
18-
intdir=INT_DIR,
19-
obsdir=OBS_DIR,
20-
rdssdir=RDSS_DIR,
19+
intdir=self.INT_DIR,
20+
obsdir=self.OBS_DIR,
21+
rdssdir=self.RDSS_DIR,
2122
token=self.token,
2223
daysago=self.daysago
2324
).save()
@@ -26,7 +27,10 @@ def run_pipe(self):
2627
file.write('{\n}')
2728
file.write(',\n'.join(f' "{key}": "{value}"' for key, value in matched.items()))
2829

29-
GG(matched=matched, intdir=INT_DIR, obsdir=OBS_DIR).run_gg()
30+
GG(matched=matched, intdir=self.INT_DIR, obsdir=self.OBS_DIR).run_gg()
31+
Group().plot_person()
32+
Group().plot_session()
33+
3034
return None
3135

3236
def _create_syms(self):
@@ -53,5 +57,5 @@ def _create_syms(self):
5357
print("Error: <token> cannot be empty.")
5458
sys.exit(1)
5559

56-
p = pipe(token, daysago)
60+
p = Pipe(token, daysago)
5761
p.run_pipe()

code/utils/group.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pandas as pd
33
import plotly.graph_objects as go
44
import logging
5+
from main import Pipe
56

67
# Set up logging
78
logging.basicConfig(level=logging.INFO)
@@ -10,11 +11,12 @@
1011

1112
class Group:
1213
def __init__(self):
13-
self.obs_path = "/Volumes/vosslabhpc/Projects/BOOST/ObservationalStudy/3-experiment/data/act-obs-test/derivatives/GGIR-3.2.6-test"
14-
self.int_path = "/Volumes/vosslabhpc/Projects/BOOST/InterventionStudy/3-experiment/data/act-int-test/derivatives/GGIR-3.2.6-test"
14+
self.obs_path = Pipe.OBS_DIR
15+
self.int_path = Pipe.INT_DIR
1516
self.paths = [self.obs_path, self.int_path]
1617
self.path = './plots/group'
1718

19+
1820
def _parse_person_file(self, file_path):
1921
try:
2022
df = pd.read_csv(file_path)

code/utils/qc.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import pandas as pd
3+
from main import Pipe
34
from utils.plots import ACT_PLOTS, create_json
45

56

@@ -26,16 +27,11 @@ def __init__(self, project: str):
2627

2728
# Determine the expected days worn based on project type
2829
if project == 'obs':
29-
self.base_dir = ( "/Volumes/vosslabhpc/Projects/BOOST/ObservationalStudy/"
30-
"3-experiment/data/act-obs-test/derivatives/GGIR-3.2.6-test"
31-
)
30+
self.base_dir = (Pipe.OBS_DIR)
3231
self.n_days_worn = 7
3332
elif project == 'int':
3433
self.n_days_worn = 9
35-
self.base_dir = (
36-
"/Volumes/vosslabhpc/Projects/BOOST/InterventionStudy/"
37-
"3-experiment/data/act-int-test/derivatives/GGIR-3.2.6-test"
38-
)
34+
self.base_dir = (Pipe.INT_DIR)
3935
else:
4036
raise ValueError("Project must be 'obs' or 'int'")
4137

cron.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Source the Conda activate script
4+
source /opt/anaconda3-2024.10-1/etc/profile.d/conda.sh
5+
6+
# Activate Conda env
7+
conda activate act
8+
9+
# Move to project home dir
10+
cd "$(dirname "$0")"
11+
12+
# run pipe
13+
cd code && python main.py 1

0 commit comments

Comments
 (0)