예제 #1
0
    except:
        sys.exit('not found file '+fileName+':  exiting')

try:
    session = getSession(username = '******',password='******')
except:
    print 'not able to start session'


#processing the data. 
tempInsert = ''
for subject in range(len(data)):
    start_time2 = time.time();
    batchInsert = []
    tempData = data[subject]
    tempCreate = prepareCreateTable(fileName[:-4]+'t'+str(subject))
    session.execute(tempCreate)
    '''
    When you read pieman.mat from matlab, you will get a 58x40x46x274 data.
    58 --> Z. from lower to top
    40 --> Y, from front to back
    46 --> X, from left to right.
    274 --> time, from lower time to higher time
    '''    
    
    for t in xrange(len(data[0][0][0][0])):
        start_time3 = time.time();
        batchInsert=[]
        batchInsert.append('BEGIN BATCH')
        print 'at time: ',t
        for z in xrange(len(data[0])):
예제 #2
0
    except:
        sys.exit('not found file '+fileName+':  exiting')

try:
    session = getSession(username = '******',password='******')
    session.default_timeout = 30  # this is in *seconds* setting the default timeout will prevent the exception. 
except:
    print 'not able to start db session'





#processing the data. 
tempInsert = ''
tempCreate = prepareCreateTable(fileName[:-4]+'total')
print('creating table:' + tempCreate)
tryInsert(session,tempCreate,1)
for subject in xrange(len(data)):
    data2 = np.array(f[data[subject][0]])
    start_time2 = time.time();
    batchInsert = []
    tempData = data[subject]
    
    
    '''
    When you read pieman.mat from matlab, you will get a 58x40x46x274 datc.

    58 --> Z. from lower to top
    40 --> Y, from front to back
    46 --> X, from left to right.
예제 #3
0
# reading data from file specified in fileNames array.
for fileName in fileNames:
    try:
        f, data = readMat2(fileName)
    except:
        sys.exit("not found file " + fileName + ":  exiting")

try:
    session = getSession(username="******", password="******")
    session.default_timeout = 30  # this is in *seconds* setting the default timeout will prevent the exception.
except:
    print "not able to start db session"

# processing the data.
tempInsert = ""
tempCreate = prepareCreateTable(fileName[:-4] + "total2")
print ("creating table:" + tempCreate)
tryInsert(session, tempCreate, 1)
for subject in xrange(len(data)):
    if subject >= 16:
        continue
    data2 = np.array(f[data[subject][0]])
    start_time2 = time.time()
    batchInsert = []
    tempData = data[subject]

    """
    When you read pieman.mat from matlab, you will get a 58x40x46x274 datc.
    58 --> Z. from lower to top
    40 --> Y, from front to back
    46 --> X, from left to right.
예제 #4
0
subjects=range(22)
def tryInsert(session,s,time):
    try:
        session.execute(s)
    except:
        print('failed to insert, retrying: '+s[0:100]+' '+str(time))
        tryInsert(session,s,time+1)

#getting the cassandra db session
try:
    session = getSession(username = '******',password='******')
    session.default_timeout = 30  # this is in *seconds* setting the default timeout will prevent the exception.
except:
    print 'not able to start db session'

tempCreate = prepareCreateTable("pieman_corr_new",valueNames=['id1','id2','corr'],valueTypes=['text','text','double'],primaryKeys=['id1','id2'],comment='corr_results')
tryInsert(session,tempCreate,1)
'''



#processing the data.
tempInsert = ''
for fileName in fileNames:
    for subject in subjects:
        tempCreate = prepareCreateTable(fileName[:-4]+'corrResults'+str(subject),valueNames=['id1','id2','corr'],valueTypes=['text','text','double'],primaryKeys=['id1','id2'],comment='corr_results')
        print('creating table:' + tempCreate)
        tryInsert(session,tempCreate,1)
for fileName in fileNames:
    tempCreate = prepareCreateTable(fileName[:-4]+'normalTest',valueNames=['id1','id2','normality'],valueTypes=['text','text','boolean'],primaryKeys=['id1','id2'],comment='normal_test_results')
    print('creating table:' + tempCreate)