-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_sessions.py
70 lines (55 loc) · 2.42 KB
/
prepare_sessions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 21 11:01:06 2023
@author: Guido Meijer
"""
from os import mkdir
from os.path import join, isdir, isfile
from datetime import date
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-e", "--ephys", help="Ephys session", action='store_true')
args = parser.parse_args()
# Set path to save data
if args.ephys:
PATH = 'D:\\NeuropixelData' # SSD
else:
PATH = 'K:\\Subjects'
# Get date of today
this_date = date.today().strftime('%Y%m%d')
# Get mouse name
subject_name = input('Subject name (q to quit): ')
while subject_name != 'q':
# Make directories
while not isdir(join(PATH, subject_name)):
if not isdir(join(PATH, subject_name)):
create_folder = input('Subject does not exist, create subject folder? (y/n) ')
if create_folder == 'y':
mkdir(join(PATH, subject_name))
else:
subject_name = input('Subject name (q to quit): ')
if not isdir(join(PATH, subject_name, this_date)):
mkdir(join(PATH, subject_name, this_date))
mkdir(join(PATH, subject_name, this_date, 'raw_behavior_data'))
mkdir(join(PATH, subject_name, this_date, 'raw_video_data'))
if args.ephys:
mkdir(join(PATH, subject_name, this_date, 'raw_ephys_data'))
print(f'Created ephys session {this_date} for {subject_name}')
else:
print(f'Created session {this_date} for {subject_name}')
# Create flags
if not isfile(join(PATH, subject_name, this_date, 'extract_me.flag')):
with open(join(PATH, subject_name, this_date, 'extract_me.flag'), 'w') as fp:
pass
if not isfile(join(PATH, subject_name, this_date, 'transfer_me.flag')):
with open(join(PATH, subject_name, this_date, 'transfer_me.flag'), 'w') as fp:
pass
if not isfile(join(PATH, subject_name, this_date, 'eyetrack_me.flag')):
with open(join(PATH, subject_name, this_date, 'eyetrack_me.flag'), 'w') as fp:
pass
if args.ephys:
if not isfile(join(PATH, subject_name, this_date, 'videotrack_me.flag')):
with open(join(PATH, subject_name, this_date, 'videotrack_me.flag'), 'w') as fp:
pass
# Get mouse name
subject_name = input('Subject name (q to quit): ')