Esempio n. 1
0
 def test_eda(self):
     eda_file = qLogFile("uploads/eda/eda")
     slice_start_time = eda_file.startTime #datetime.datetime object
     end_time = eda_file.endTime
     while slice_start_time<end_time:
         slice_end_time = slice_start_time+self.SLICE_LENGTH if (slice_start_time+self.SLICE_LENGTH < end_time) else end_time
         
         slice = eda_file.qLogFileSlice(slice_start_time,slice_end_time)
         
         eda = ",".join(str(x) for x in slice[0])
         temperature =",".join(str(x) for x in slice[1])
         acc_x = ",".join(str(x) for x in slice[2])
         acc_y = ",".join(str(x) for x in slice[3])
         acc_z = ",".join(str(x) for x in slice[4])
         
         start_time_string = slice_start_time.strftime("%Y-%m-%d %H:%M:%S")
         end_time_string = slice_end_time.strftime("%Y-%m-%d %H:%M:%S")
         
         timezone = slice_start_time.strftime("%z")
         
         self.save_eda_data(start_time_string, end_time_string, timezone, eda, temperature, acc_x, acc_y, acc_z)
         
         slice_start_time = slice_start_time+self.SLICE_LENGTH
     
    # print "|".join(str(x) for x in eda_file.EDA())
                                                   
         
Esempio n. 2
0
    def test_eda(self):
        eda_file = qLogFile("uploads/eda/eda")
        slice_start_time = eda_file.startTime  #datetime.datetime object
        end_time = eda_file.endTime
        while slice_start_time < end_time:
            slice_end_time = slice_start_time + self.SLICE_LENGTH if (
                slice_start_time + self.SLICE_LENGTH < end_time) else end_time

            slice = eda_file.qLogFileSlice(slice_start_time, slice_end_time)

            eda = ",".join(str(x) for x in slice[0])
            temperature = ",".join(str(x) for x in slice[1])
            acc_x = ",".join(str(x) for x in slice[2])
            acc_y = ",".join(str(x) for x in slice[3])
            acc_z = ",".join(str(x) for x in slice[4])

            start_time_string = slice_start_time.strftime("%Y-%m-%d %H:%M:%S")
            end_time_string = slice_end_time.strftime("%Y-%m-%d %H:%M:%S")

            timezone = slice_start_time.strftime("%z")

            self.save_eda_data(start_time_string, end_time_string, timezone,
                               eda, temperature, acc_x, acc_y, acc_z)

            slice_start_time = slice_start_time + self.SLICE_LENGTH
Esempio n. 3
0
def save_eda_file_in_slices(user_id, hand_side, file_name):

    eda_file = qLogFile(file_name)
    slice_start_time = eda_file.startTime #datetime.datetime object
    end_time = eda_file.endTime
    while slice_start_time < end_time:
        slice_end_time = slice_start_time + SLICE_LENGTH if (slice_start_time + SLICE_LENGTH < end_time) else end_time
        
        slice = eda_file.qLogFileSlice(slice_start_time,slice_end_time)
        sample_rate = eda_file.sampleRate
        eda = ",".join(str(x) for x in slice[0])
        temperature =",".join(str(x) for x in slice[1])
        acc_x = ",".join(str(x) for x in slice[2])
        acc_y = ",".join(str(x) for x in slice[3])
        acc_z = ",".join(str(x) for x in slice[4])
                
        save_eda_data(user_id, slice_start_time, slice_end_time, sample_rate, eda, hand_side, temperature, acc_x, acc_y, acc_z)
        
        slice_start_time = slice_start_time + SLICE_LENGTH
Esempio n. 4
0
from edatoolkit import qLogFile
import os, sys

rpf = 5000 # read per file

edafile = qLogFile(sys.argv[1])
eda = edafile.EDA()
acc_x = edafile.ACC_X()
acc_y = edafile.ACC_Y()
acc_z = edafile.ACC_Z()
temp = edafile.Temperature()

# assume the lengths are the same
num_reads = len(eda)
num_files = num_reads/read_per_file

index = 0
while index < num_reads:
	limit = index+rpf if index+rpf < num_reads else num_reads-1
	eda_c = eda[index:limit]
	acc_x_c = acc_x[index:limit]
	acc_y_c = acc_y[index:limit]
	acc_z_c = acc_z[index:limit]
	temp_c = temp[index:limit]
	f_name = 
	index = index + rpf
print "|".join([str(x) for x in edafile.EDA()]) #Access list of float values for EDA
print "|".join([str(x) for x in edafile.ACC_X()]) #Access list of float values for X
print "|".join([str(x) for x in edafile.ACC_Y()]) #Access list of float values for Y
print "|".join([str(x) for x in edafile.ACC_Z()]) #Access list of float values for Z
print "|".join([str(x) for x in edafile.Temperature()]) #Access list of float values for Temperature