In [2]:
import utils.conversion as conv
import utils.summary_scores as sums
import pandas as pd
import numpy as np
In [3]:
data_dir = '/nobackup/adenauer2/LSD/Originals/Raw'
internal_dir = '/nobackup/adenauer2/LSD/Originals/Converted/Questionnaires'
restricted_dir = '/nobackup/adenauer2/LSD/Restricted/Questionnaires'
open_dir = '/nobackup/adenauer2/LSD/Open/Questionnaires'
In [4]:
# raw data
f_A = '%s/Questionnaires/surveyA_151013.csv' % data_dir
df_A = pd.read_csv(f_A, sep = ",", parse_dates =[1,5])
In [6]:
conv.run_SelfCtrl(df_A.copy(), out_dir = '%s/SCS' % internal_dir, public = False)
conv.run_SelfCtrl(df_A.copy(), out_dir = '%s/SCS' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/SCS/SCS.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_SelfCtrl(raw_A.copy(), out_dir = '%s/SCS' % open_dir)
In [7]:
conv.run_IAT(df_A.copy(), out_dir = '%s/IAT' % internal_dir, public = False)
conv.run_IAT(df_A.copy(), out_dir = '%s/IAT' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/IAT/IAT.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_IAT(raw_A.copy(), out_dir = '%s/IAT' % open_dir)
In [8]:
conv.run_VIS(df_A.copy(), out_dir = '%s/VISQ' % internal_dir, public = False)
conv.run_VIS(df_A.copy(), out_dir = '%s/VISQ' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/VISQ/VISQ.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_VIS(raw_A.copy(), out_dir = '%s/VISQ' % open_dir)
In [9]:
conv.run_MW_SD(df_A.copy(), out_dir = '%s/S-D-MW' % internal_dir, public = False)
conv.run_MW_SD(df_A.copy(), out_dir = '%s/S-D-MW' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/S-D-MW/S-D-MW.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_MW_SD(raw_A.copy(), out_dir = '%s/S-D-MW' % open_dir)
In [10]:
conv.run_SDT(df_A.copy(), out_dir = '%s/SD3' % internal_dir, public = False)
conv.run_SDT(df_A.copy(), out_dir = '%s/SD3' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/SD3/SD3.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_SDT(raw_A.copy(), out_dir = '%s/SD3' % open_dir)
In [11]:
conv.run_SDS(df_A.copy(), out_dir = '%s/SDS' % internal_dir, public = False)
conv.run_SDS(df_A.copy(), out_dir = '%s/SDS' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/SDS/SDS.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_SDS(raw_A.copy(), out_dir = '%s/SDS' % open_dir)
In [12]:
conv.run_UPPSP(df_A.copy(), out_dir = '%s/UPPS-P' % internal_dir, public = False)
conv.run_UPPSP(df_A.copy(), out_dir = '%s/UPPS-P' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/UPPS-P/UPPS-P.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_UPPSP(raw_A.copy(), out_dir = '%s/UPPS-P' % open_dir)
In [13]:
conv.run_TPS(df_A.copy(), out_dir = '%s/TPS' % internal_dir, public = False)
conv.run_TPS(df_A.copy(), out_dir = '%s/TPS' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/TPS/TPS.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_TPS(raw_A.copy(), out_dir = '%s/TPS' % open_dir)
In [15]:
conv.run_ASR(df_A.copy(), out_dir = '%s/ASR' % internal_dir, public = False)
conv.run_ASR(df_A.copy(), out_dir = '%s/ASR' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/ASR/ASR.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_ASR(raw_A.copy(), out_dir = '%s/ASR' % open_dir)
In [16]:
conv.run_SE(df_A.copy(), out_dir = '%s/SE' % internal_dir, public = False)
conv.run_SE(df_A.copy(), out_dir = '%s/SE' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/SE/SE.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_SE(raw_A.copy(), out_dir = '%s/SE' % open_dir)
In [17]:
conv.run_IMIS(df_A.copy(), out_dir = '%s/IMIS' % internal_dir, public = False)
conv.run_IMIS(df_A.copy(), out_dir = '%s/IMIS' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/IMIS/IMIS.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_IMIS(raw_A.copy(), out_dir = '%s/IMIS' % open_dir)
In [18]:
conv.run_GoldMSI(df_A.copy(), out_dir = '%s/Gold-MSI' % internal_dir, public = False)
conv.run_GoldMSI(df_A.copy(), out_dir = '%s/Gold-MSI' % restricted_dir, public = True)
raw_A = pd.read_csv('%s/Gold-MSI/Gold-MSI.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_GoldMSI(raw_A.copy(), out_dir = '%s/Gold-MSI' % open_dir)
In [19]:
conv.run_MGIQ(df_A.copy(), out_dir = '%s/MGIQ' % internal_dir, public = False)
conv.run_MGIQ(df_A.copy(), out_dir = '%s/MGIQ' % restricted_dir, public = True)
In [20]:
# raw data
f_B = '%s/Questionnaires/surveyB_151013.csv' % data_dir
f2_B = '%s/Questionnaires/surveyF_151013.csv' % data_dir # due to neo ffi items
df_B = pd.read_csv(f_B, sep = ",", parse_dates =[1,5])
In [22]:
conv.run_NEOPIR(f_B, f2_B, out_dir = '%s/NEO-PI-R' % internal_dir, public = False)
conv.run_NEOPIR(f_B, f2_B, out_dir = '%s/NEO-PI-R' % restricted_dir, public = True)
raw_B = pd.read_csv('%s/NEO-PI-R/NEO-PI-R.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_NEOPIR(raw_B.copy(), out_dir = '%s/NEO-PI-R' % open_dir)
In [23]:
conv.run_ESS(df_B.copy(), out_dir = '%s/ESS' % internal_dir, public = False)
conv.run_ESS(df_B.copy(), out_dir = '%s/ESS' % restricted_dir, public = True)
raw_B = pd.read_csv('%s/ESS/ESS.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_ESS(raw_B.copy(), out_dir = '%s/ESS' % open_dir)
In [24]:
conv.run_BDI(df_B.copy(), out_dir = '%s/BDI' % internal_dir, public = False)
conv.run_BDI(df_B.copy(), out_dir = '%s/BDI' % restricted_dir, public = True)
raw_B = pd.read_csv('%s/BDI/BDI.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_BDI(raw_B.copy(), out_dir = '%s/BDI' % open_dir)
In [25]:
conv.run_HADS(df_B.copy(), out_dir = '%s/HADS' % internal_dir, public = False)
conv.run_HADS(df_B.copy(), out_dir = '%s/HADS' % restricted_dir, public = True)
raw_B = pd.read_csv('%s/HADS/HADS.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_HADS(raw_B.copy(), out_dir = '%s/HADS' % open_dir)
In [26]:
conv.run_BPS(df_B.copy(), out_dir = '%s/BP' % internal_dir, public = False)
conv.run_BPS(df_B.copy(), out_dir = '%s/BP' % restricted_dir, public = True)
raw_B = pd.read_csv('%s/BP/BP.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_BPS(raw_B.copy(), out_dir = '%s/BP' % open_dir)
In [27]:
conv.run_ACS(df_B.copy(), out_dir = '%s/ACS' % internal_dir, public = False)
conv.run_ACS(df_B.copy(), out_dir = '%s/ACS' % restricted_dir, public = True)
raw_B = pd.read_csv('%s/ACS/ACS.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_ACS(raw_B.copy(), out_dir = '%s/ACS' % open_dir)
In [28]:
conv.run_PSSI(df_B.copy(), out_dir = '%s/PSSI' % internal_dir, public = False)
conv.run_PSSI(df_B.copy(), out_dir = '%s/PSSI' % restricted_dir, public = True)
raw_B = pd.read_csv('%s/PSSI/PSSI.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_PSSI(raw_B.copy(), out_dir = '%s/PSSI' % open_dir)
In [29]:
conv.run_MMI(df_B.copy(), out_dir = '%s/MMI' % internal_dir, public = False)
conv.run_MMI(df_B.copy(), out_dir = '%s/MMI' % restricted_dir, public = True)
raw_B = pd.read_csv('%s/MMI/MMI.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_MMI(raw_B.copy(), out_dir = '%s/MMI' % open_dir)
In [30]:
conv.run_mobile(df_B.copy(), out_dir = '%s/MPU' % internal_dir, public = False)
conv.run_mobile(df_B.copy(), out_dir = '%s/MPU' % open_dir, public = True)
In [31]:
# raw data
f_C1 = '%s/Questionnaires/surveyCactive_151013.csv' % data_dir
f_C2 = '%s/Questionnaires/surveyCinactive_151013.csv' % data_dir
f_C3 = '%s/Questionnaires/surveyCcorrected_151013.csv' % data_dir
df_C1 = pd.read_csv(f_C1, sep = ",", parse_dates =[1,5])
df_C1['DS14 answer codes'] = pd.Series(np.zeros(len(df_C1)), index=df_C1.index)
df_C2 = pd.read_csv(f_C2, sep = ",", parse_dates =[1,5])
df_C2['DS14 answer codes'] = pd.Series(np.zeros(len(df_C2)), index=df_C2.index)
df_C3 = pd.read_csv(f_C3, sep = ",", parse_dates =[1,5])
df_C3['DS14 answer codes'] = pd.Series(np.ones(len(df_C3)), index=df_C3.index)
df_C = pd.concat([df_C1, df_C2, df_C3])
In [32]:
conv.run_FIS(df_C.copy(), out_dir = '%s/FBI' % internal_dir, public = False)
conv.run_FIS(df_C.copy(), out_dir = '%s/FBI' % restricted_dir, public = True)
In [33]:
# raw data
f_NYCQ_postscan = '%s/Questionnaires/LIMIT -NYC-Q post Scan.ods - LIMIT_20151215.csv' % data_dir
df_postscan = pd.read_csv(f_NYCQ_postscan)
In [34]:
conv.run_NYCQ_postscan(df_postscan, out_dir = '%s/NYC-Q_postscan' % internal_dir, public = False)
conv.run_NYCQ_postscan(df_postscan, out_dir = '%s/NYC-Q_postscan' % open_dir, public = True)
In [35]:
conv.run_NYCQ_posttasks(df_C.copy(), out_dir = '%s/NYC-Q_posttasks' % internal_dir, public = False)
conv.run_NYCQ_posttasks(df_C.copy(), out_dir = '%s/NYC-Q_posttasks' % open_dir, public = True)
In [36]:
# raw data
f_NYCQ_prescan = '%s/Questionnaires/Prescan short NYC-Q_20151215.csv' % data_dir
f_NYCQ_inscan = '%s/Questionnaires/NYCQ-short_inscanner.csv' % data_dir
f_NYCQ_postETS = '%s/Questionnaires/NYCQ-short-slider post Win_20151215.csv' % data_dir
df_prescan = pd.read_csv(f_NYCQ_prescan)
df_inscan = pd.read_csv(f_NYCQ_inscan)
df_postETS = pd.read_csv(f_NYCQ_postETS)
In [37]:
conv.run_NYCQ_prescan(df_prescan.copy(), out_dir = '%s/Short-NYC_prescan' % internal_dir, public = False)
conv.run_NYCQ_prescan(df_prescan.copy(), out_dir = '%s/Short-NYC_prescan' % open_dir, public = True)
In [39]:
conv.run_NYCQ_inscan(df_inscan.copy(), scan=1, out_dir = '%s/Short-NYC_inscan1' % internal_dir, public = False)
conv.run_NYCQ_inscan(df_inscan.copy(), scan=1, out_dir = '%s/Short-NYC_inscan1' % open_dir, public = True)
In [40]:
conv.run_NYCQ_inscan(df_inscan.copy(), scan=2, out_dir = '%s/Short-NYC_inscan2' % internal_dir, public = False)
conv.run_NYCQ_inscan(df_inscan.copy(), scan=2, out_dir = '%s/Short-NYC_inscan2' % open_dir, public = True)
In [41]:
conv.run_NYCQ_inscan(df_inscan.copy(), scan=3, out_dir = '%s/Short-NYC_inscan3' % internal_dir, public = False)
conv.run_NYCQ_inscan(df_inscan.copy(), scan=3, out_dir = '%s/Short-NYC_inscan3' % open_dir, public = True)
In [42]:
conv.run_NYCQ_inscan(df_inscan.copy(), scan=4, out_dir = '%s/Short-NYC_inscan4' % internal_dir, public = False)
conv.run_NYCQ_inscan(df_inscan.copy(), scan=4, out_dir = '%s/Short-NYC_inscan4' % open_dir, public = True)
In [43]:
# where to put this
conv.run_NYCQ_postETS(df_postETS.copy(), out_dir = '%s/Short-NYC_postETS' % internal_dir, public = False)
conv.run_NYCQ_postETS(df_postETS.copy(), out_dir = '%s/Short-NYC_postETS' % open_dir, public = True)
In [44]:
# raw data
f_F = '%s/Questionnaires/surveyF_151013.csv' % data_dir
df_F = pd.read_csv(f_F, sep = ",", parse_dates =[1,5])
lemon_dir = '/nobackup/adenauer2/XNAT/Emotion Battery LEMON001-229_ 1-4 Rounds_CSV files'
In [45]:
conv.run_STAI(df_F.copy(), out_dir = '%s/STAI-G-X2' % internal_dir, public = False)
conv.run_STAI(df_F.copy(), out_dir = '%s/STAI-G-X2' % restricted_dir, public = True)
raw_STAI_lsd = pd.read_csv('%s/STAI-G-X2/STAI-G-X2.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
raw_STAI_lemon = pd.read_csv('%s/STAI/STAI_G_Form_x2__20.csv' % lemon_dir,
sep = ",",
dtype={'ids':str})
cols = ['STAI_1', 'STAI_2', 'STAI_3', 'STAI_4', 'STAI_5', 'STAI_6',
'STAI_7', 'STAI_8', 'STAI_9', 'STAI_10', 'STAI_11', 'STAI_12',
'STAI_13', 'STAI_14', 'STAI_15', 'STAI_16', 'STAI_17', 'STAI_18',
'STAI_19', 'STAI_20']
idx = raw_STAI_lemon[cols].dropna(how='all').index
raw_STAI_lemon = raw_STAI_lemon.ix[idx]
raw_STAI = pd.concat([raw_STAI_lsd, raw_STAI_lemon])
raw_STAI.set_index([range(len(raw_STAI.index))], inplace=True)
sums.run_STAI(raw_STAI.copy(), out_dir = '%s/STAI-G-X2' % open_dir)
In [46]:
conv.run_STAXI(df_F.copy(), out_dir = '%s/STAXI' % internal_dir, public = False)
conv.run_STAXI(df_F.copy(), out_dir = '%s/STAXI' % restricted_dir, public = True)
raw_STAXI_lsd = pd.read_csv('%s/STAXI/STAXI.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
raw_STAXI_lemon = pd.read_csv('%s/STAXI/STAXI_44.csv' % lemon_dir,
sep = ",",
dtype={'ids':str})
cols = ['STAXI_1', 'STAXI_2', 'STAXI_3', 'STAXI_4', 'STAXI_5',
'STAXI_6', 'STAXI_7', 'STAXI_8', 'STAXI_9', 'STAXI_10', 'STAXI_11',
'STAXI_12', 'STAXI_13', 'STAXI_14', 'STAXI_15', 'STAXI_16',
'STAXI_17', 'STAXI_18', 'STAXI_19', 'STAXI_20', 'STAXI_21',
'STAXI_22', 'STAXI_23', 'STAXI_24', 'STAXI_25', 'STAXI_26',
'STAXI_27', 'STAXI_28', 'STAXI_29', 'STAXI_30', 'STAXI_31',
'STAXI_32', 'STAXI_33', 'STAXI_34', 'STAXI_35', 'STAXI_36',
'STAXI_37', 'STAXI_38', 'STAXI_39', 'STAXI_40', 'STAXI_41',
'STAXI_42', 'STAXI_43', 'STAXI_44']
idx = raw_STAXI_lemon[cols].dropna(how='all').index
raw_STAXI_lemon = raw_STAXI_lemon.ix[idx]
raw_STAXI = pd.concat([raw_STAXI_lsd, raw_STAXI_lemon])
raw_STAXI.set_index([range(len(raw_STAXI.index))], inplace=True)
sums.run_STAXI(raw_STAXI.copy(), out_dir = '%s/STAXI' % open_dir)
In [47]:
conv.run_BISBAS(df_F.copy(), out_dir = '%s/BISBAS' % internal_dir, public = False)
conv.run_BISBAS(df_F.copy(), out_dir = '%s/BISBAS' % restricted_dir, public = True)
raw_BISBAS_lsd = pd.read_csv('%s/BISBAS/BISBAS.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
raw_BISBAS_lemon = pd.read_csv('%s/BISBAS/BISBAS_24.csv' % lemon_dir,
sep = ",",
dtype={'ids':str})
cols = ['BISBAS_1', 'BISBAS_2', 'BISBAS_3', 'BISBAS_4', 'BISBAS_5',
'BISBAS_6', 'BISBAS_7', 'BISBAS_8', 'BISBAS_9', 'BISBAS_10',
'BISBAS_11', 'BISBAS_12', 'BISBAS_13', 'BISBAS_14', 'BISBAS_15',
'BISBAS_16', 'BISBAS_17', 'BISBAS_18', 'BISBAS_19', 'BISBAS_20',
'BISBAS_21', 'BISBAS_22', 'BISBAS_23', 'BISBAS_24']
idx = raw_BISBAS_lemon[cols].dropna(how='all').index
raw_BISBAS_lemon = raw_BISBAS_lemon.ix[idx]
raw_BISBAS = pd.concat([raw_BISBAS_lsd, raw_BISBAS_lemon])
raw_BISBAS.set_index([range(len(raw_BISBAS.index))], inplace=True)
sums.run_BISBAS(raw_BISBAS.copy(), out_dir = '%s/BISBAS' % open_dir)
In [48]:
# raw data
f_G = '%s/Questionnaires/surveyG_151013.csv' % data_dir
# AMAS was part of F and G
df_G = pd.read_csv(f_G, sep = ",", parse_dates =[1,5])
df_G = pd.concat([df_F, df_G])
In [49]:
conv.run_AMAS(df_G.copy(), out_dir = '%s/AMAS' % internal_dir, public = False)
conv.run_AMAS(df_G.copy(), out_dir = '%s/AMAS' % restricted_dir, public = True)
raw_G = pd.read_csv('%s/AMAS/AMAS.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_AMAS(raw_G.copy(), out_dir = '%s/AMAS' % open_dir)
In [4]:
# raw data
f_Cr = '%s/Questionnaires/survey_creativity_metacog.csv' % data_dir
f_syn = '%s/Questionnaires/synesthesia_color_picker.csv' % data_dir
df_Cr = pd.read_csv(f_Cr, sep = ",", parse_dates =[1,5],
encoding="utf-8-sig").rename(columns = {'IDcode' : 'ID'})
df_syn = pd.read_csv(f_syn, sep = ",", parse_dates =[1,5]).rename(columns = {'DB_ID' : 'ID'})
In [6]:
conv.run_CAQ(df_Cr.copy(), out_dir = '%s/CAQ' % internal_dir, public = False)
conv.run_CAQ(df_Cr.copy(), out_dir = '%s/CAQ' % restricted_dir, public = True)
raw_Cr = pd.read_csv('%s/CAQ/CAQ.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_CAQ(raw_Cr.copy(), out_dir = '%s/CAQ' % open_dir)
In [7]:
conv.run_MCQ30(df_Cr.copy(), out_dir = '%s/MCQ-30' % internal_dir, public = False)
conv.run_MCQ30(df_Cr.copy(), out_dir = '%s/MCQ-30' % restricted_dir, public = True)
raw_Cr = pd.read_csv('%s/MCQ-30/MCQ30.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_MCQ30(raw_Cr.copy(), out_dir = '%s/MCQ-30' % open_dir)
In [8]:
conv.run_BCQ(df_Cr.copy(), out_dir = '%s/BCQ' % internal_dir, public = False)
conv.run_BCQ(df_Cr.copy(), out_dir = '%s/BCQ' % restricted_dir, public = True)
raw_Cr = pd.read_csv('%s/BCQ/BCQ.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_BCQ(raw_Cr.copy(), out_dir = '%s/BCQ' % open_dir)
In [9]:
conv.run_FFMQ(df_Cr.copy(), out_dir = '%s/FFMQ' % internal_dir, public = False)
conv.run_FFMQ(df_Cr.copy(), out_dir = '%s/FFMQ' % restricted_dir, public = True)
raw_Cr = pd.read_csv('%s/FFMQ/FFMQ.csv' % restricted_dir,
sep = ",", parse_dates =[1,5],
dtype={'ids':str})
sums.run_FFMQ(raw_Cr.copy(), out_dir = '%s/FFMQ' % open_dir)
In [11]:
conv.run_syn(df_syn.copy(), out_dir = '%s/SYN' % internal_dir, public = False)
conv.run_syn(df_syn.copy(), out_dir = '%s/SYN' % open_dir, public = True)