-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_data.py
More file actions
29 lines (24 loc) · 1.01 KB
/
load_data.py
File metadata and controls
29 lines (24 loc) · 1.01 KB
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
"""
Small script for loading MMPI data to run questionnaire from matlab .mat files.
Takes one optional command line argument:
(nothing) = load MMPI2.mat (the original file)
aq = load MMPI2_AntiQuestions.mat (the doubled questions file)
de = load MMPI2.Depolarized.mat (the depolarized file)
Fix the DEFAULT_DATA_PATH before using.
"""
import scipy.io
import sys
DEFAULT_DATA_PATH = "/users/jerrod/Google Drive/Yale_Research/Questionnaire_2D_20130614/Examples/"
if len(sys.argv) == 1:
data_file = "MMPI2.mat"
elif sys.argv[1] == "aq":
data_file = "MMPI2_AntiQuestions.mat"
elif sys.argv[1] == "de":
data_file = "MMPI2_Depolarized.mat"
#scipy.io will handle matlab files and load them into numpy structures.
#to load the tree files into trees, use matlab_util.
mdict = scipy.io.loadmat(DEFAULT_DATA_PATH+data_file)
data = mdict["matrix"]
q_descs = [x[0][0] for x in mdict["sensors_dat"][0,0][0]]
p_score_descs = [x[0] for x in mdict["points_dat"][0,0][1][0]]
p_scores = mdict["points_dat"][0,0][0]